Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
<?php
2
$db = mysql_connect("$dbHost","$dbUser","$dbPass"); 
3
#connect to the database
4
 
5
mysql_select_db($dbname,$db); 
6
#select our database
7
 
8
$requete = "SELECT * FROM ShoutBox ORDER BY Date DESC LIMIT 0,$ShoutDisplay"; 
9
#query that grabs all the columns from shoutbox
10
#it uses the shoutdisplay variable set before the include to limit how many rows
11
#descending by date because it gives the latests dates
12
 
13
$result = mysql_query ($requete,$db); 
14
#result of query
15
 
16
echo '<div class="fullshout">&nbsp;';
17
#This is a little design this div wraps around the whole table.
18
 
19
echo '<div class="halfshout">&nbsp;<br />';
20
#This is a little design this div wraps around all but the form.
21
 
22
 
23
$i=0;
24
#we're using this variable to create the alternating rows
25
 
26
    while ($article = mysql_fetch_object($result))  
27
	#looping through our result $article is the row we're on
28
    {  
29
	$today = date("F j, Y, g:i a", $article->Date); 
30
	#Sets up the date
31
 
32
	$URL = $article->URL;
33
	#grabs the URL/email of poster from the database
34
 
35
	if (mailcheck($URL))
36
	#defined in the shoutfunctions.php regular expression check
37
	#determines if this is an email address
38
		{
39
		$ShoutURL = '<a';
40
		#first part of anchor
41
 
42
			if (($Alternate==1)&&($i==0)) 
43
				$ShoutURL .= ' class="shoutname2"'; 
44
			else
45
				$ShoutURL .= ' class="shoutname"';
46
			#if alternate is on and i is 0, otherwise regular
47
 
48
		$ShoutURL .=' href="mailto:'.$URL.'"';
49
		#Finishes the beginning anchor tag
50
 
51
		}
52
	else if (URLcheck($URL))
53
	#regular expression to determine if url and if starts with http://
54
	#function found in phpfunctions.php
55
		{
56
		$ShoutURL = '<a';
57
			if (($Alternate==1)&&($i==0))
58
				$ShoutURL .= ' class="shoutname2"';
59
			else
60
				$ShoutURL .= ' class="shoutname"';
61
		$ShoutURL .=' href="'.$URL.'"';
62
		}
63
	else if ($URL!=NULL)
64
	#as long as URL isn't empty let's just assume they forgot http:// 
65
		{
66
		$ShoutURL = '<a';
67
			if (($Alternate==1)&&($i==0))
68
				$ShoutURL .= ' class="shoutname2"';
69
			else
70
				$ShoutURL .= ' class="shoutname"';
71
		$ShoutURL .=' href="http://'.$URL.'"';
72
		}
73
	else {
74
	#empty url, we'll give them an empty javascript command
75
		$ShoutURL = '<a';
76
			if (($Alternate==1)&&($i==0))
77
				$ShoutURL .= ' class="shoutname2"';
78
			else
79
				$ShoutURL .= ' class="shoutname"';
80
		$ShoutURL .= ' href="javascript:()" onclick="return false;" onkeypress="return false;"';
81
		}
82
 
83
	if (($Alternate==1)&&($i==0))
84
	#will only display if i is 0 and alternate mode, set in shoutoptions, is on
85
	{
86
	echo '<div class="shoutentry2">'.$ShoutURL.' title="'.$today.'">'.stripslashes($article->Name).'</a>';
87
	echo '<div class="shoutmessage2">';
88
	if ($WordWrap!=0) #only wraps if set
89
		echo webcode(wrap_text(stripslashes($article->Message),$WordWrap));
90
	else
91
		echo webcode(stripslashes($article->Message));
92
	echo '</div>';
93
 
94
	#webcode() is a function of mine to add smilies color and bb depending on if they're on
95
	#strip slashes removes the \ that often are used to protect the database when messages are inward
96
	#it's safe because now they're out in the open
97
 
98
		if ($SelfDelete==1)
99
		#if in phpoptions.php self delete is on
100
		{
101
		if ($article->IP==$IP)
102
			echo '<a href="'.$_SERVER['SCRIPT_NAME'].'?SelfDel='.$article->ID.'">Delete this entry?</a>';
103
		#this if checks if this user owns the message
104
		#if so it gives them the option of self deleting their post
105
		#in case you care, $_SERVER['SCRIPT_NAME'] is the main script running
106
		#the one before includes, I set the $IP before calling this include
107
		}
108
	echo '</div><br />';
109
	$i=1;
110
	#set i to 1 so it will alternate, remember this only turns on if $Alternate=1
111
	}
112
	else {
113
	#normal execution
114
	echo '<div class="shoutentry">'.$ShoutURL.' title="'.$today.'">'.stripslashes($article->Name).'</a>';
115
	echo '<div class="shoutmessage">';
116
 
117
	if ($WordWrap!=0)
118
		echo webcode(wrap_text(stripslashes($article->Message),$WordWrap));
119
	else
120
		echo webcode(stripslashes($article->Message));
121
 
122
	echo '</div>';
123
		if ($SelfDelete==1)
124
		#same as above
125
		{
126
		if ($article->IP==$IP)
127
			echo '<a href="'.$_SERVER['SCRIPT_NAME'].'?SelfDel='.$article->ID.'">Delete this entry?</a>';
128
		}
129
	echo '</div><br />';
130
	$i=0;
131
	}
132
    } 
133
 
134
echo '</div>';
135
#closes halfshout div
136
?>