Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
<?
2
if ($name_id_c){
3
setcookie ("name_id_c", $name_id_c, time()+86400);
4
}
5
if ($link_c){
6
setcookie ("link_c", $link_c, time()+86400);
7
}
8
// 2002 - Andy Sørensen - andy@nospam.andys.dk (remove nospam)
9
// Visit http://www.andys.dk
10
// Shout It Out v1.0
11
?>
12
<link rel="stylesheet" href="stylesheet.css" type="text/css">
13
<body onload="window.scrollTo(0,99999);">
14
<?
15
include("connect.php");
16
$result = mysql_query("SELECT * FROM shout");
17
$all_rows = mysql_num_rows($result);
18
if ($all == "true"){
19
	$start = "0";
20
	$posts = "999";
21
} else {
22
	if ($all_rows < 15){
23
			$start = "0";
24
		} else {
25
			$start = $all_rows - 15;
26
		}
27
		$posts = "15";
28
}
29
$result = mysql_query("SELECT * FROM shout ORDER BY time ASC LIMIT $start,$posts");
30
$rows = mysql_num_rows($result);
31
if ($rows > 0) {
32
while($row = mysql_fetch_array($result)){
33
// Bad word check
34
$badwords = mysql_query("SELECT * FROM badwords");
35
$rowords = mysql_fetch_array($badwords);
36
$words = explode(",", $rowords[words]);
37
$bad = "*********************";
38
$i = "0";
39
while ($words[$i]){
40
	$length = strlen($words[$i])-2;
41
	$bad = substr($words[$i], 0, 2) . substr($bad, -$length);
42
	$row[text] = ereg_replace($words[$i],$bad, $row[text]);
43
	$i++;
44
}
45
// End of bad word check
46
$time = date("d. F Y H:i",$row[time]);
47
// Change emotions
48
$smile = "<img src='images/shout/happy.gif' align='absmiddle'>";
49
$ironic = "<img src='images/shout/ironic.gif' align='absmiddle'>";
50
$nothappy = "<img src='images/shout/mad.gif' align='absmiddle'>";
51
$very_happy = "<img src='images/shout/very_happy.gif' align='absmiddle'>";
52
$tongue = "<img src='images/shout/tongue.gif' align='absmiddle'>";
53
$nothing = "<img src='images/shout/nothing.gif' align='absmiddle'>";
54
$vain = "<img src='images/shout/vain.gif' align='absmiddle'>";
55
$row[text] = ereg_replace(":-\/",$vain, $row[text]);
56
$row[text] = ereg_replace(":\|",$nothing, $row[text]);
57
$row[text] = ereg_replace(":-\|",$nothing, $row[text]);
58
$row[text] = ereg_replace(":-P",$tongue, $row[text]);
59
$row[text] = ereg_replace(":P",$tongue, $row[text]);
60
$row[text] = ereg_replace(":p",$tongue, $row[text]);
61
$row[text] = ereg_replace(":-p",$tongue, $row[text]);
62
$row[text] = ereg_replace(":)",$smile, $row[text]);
63
$row[text] = ereg_replace(":-)",$smile, $row[text]);
64
$row[text] = ereg_replace(":D",$very_happy, $row[text]);
65
$row[text] = ereg_replace(":-D",$very_happy, $row[text]);
66
$row[text] = ereg_replace(":\(",$nothappy, $row[text]);
67
$row[text] = ereg_replace(":-\(",$nothappy, $row[text]);
68
$row[text] = ereg_replace(";)",$ironic, $row[text]);
69
$row[text] = ereg_replace(";-)",$ironic, $row[text]);
70
	if ($row[ip] != "") {
71
		$logged = "Yes!";
72
	} else {
73
		$logged = "No";
74
	}
75
	echo "<table cellpadding='2' cellspacing='0' width='100%'><tr><td align='left'>";
76
	$amounts = mysql_query("SELECT * FROM shout WHERE ip = '$row[ip]'");
77
	$entries = mysql_num_rows($amounts);
78
	if ($row[link] != ""){
79
		echo "<a target='_blank' href='http://$row[link]' title='$time - Logged:$logged Shouts:$entries'>$row[name_id]: </a>";
80
	} else {
81
		echo "<b title='$time - Logged:$logged Shouts:$entries'>$row[name_id]: </b></a>";
82
	}
83
	echo "$row[text]";
84
	echo "</td></tr></table>";
85
}
86
}
87
?>
88
<table width="100%" cellpadding="2" cellspacing="0"><tr><td align="center">
89
<?
90
if ($HTTP_COOKIE_VARS[name_id_c]){
91
	$name_value = $HTTP_COOKIE_VARS[name_id_c];
92
} else {
93
	$name_value = "Your name";
94
}
95
if ($HTTP_COOKIE_VARS[link_c]){
96
	$link_value = $HTTP_COOKIE_VARS[link_c];
97
} else {
98
	$link_value ="Your link";
99
}
100
echo "<form name=\"form1\" method=\"post\" action=\"$php_self\">
101
          <input class=\"inputtext\" type=\"text\" name=\"name_id\" value=\"$name_value\" onFocus=\"this.value='';\" size=\"20\">
102
          <input class=\"inputtext\" type=\"text\" name=\"text\" value=\"Your message\" onFocus=\"this.value='';\" size=\"20\">
103
		  <input class=\"inputtext\" type=\"text\" name=\"link\" value=\"$link_value\" onFocus=\"this.value='';\" size=\"20\">
104
          <input class=\"button\" type=\"submit\" name=\"add\" value=\"Go\"> <input class=\"button\" type=\"reset\" value=\"Reset\"><br>
105
		  <a href=\"?all=true\">All posts</a>
106
       </form>";
107
?>
108
</td></tr></table>
109
<?
110
if ($add){
111
	if ($link){
112
		$link = trim($link);
113
		$link = ereg_replace("http://", "", $link);
114
		$s=substr_count($link,"http://");
115
		$d=substr_count($link,".");
116
		if ($s==0 && $d>=1){
117
			$link_ok = "ok";
118
		} else {
119
			$link = "";
120
		}
121
	}
122
	$time = time();
123
	$ip = getenv("REMOTE_ADDR");
124
	$name_id = strip_tags($name_id);
125
	$text = strip_tags($text, '<a>');
126
	if($name_id != "Your name" && $text != "Your message"){
127
		mysql_query("insert into shout (ip,name_id,link,text,time) values ('$ip', '$name_id', '$link', '$text', '$time')");
128
		echo "<script>location.href='$PHP_SELF?name_id_c=$name_id&link_c=$link';</script>";
129
	}
130
}
131
mysql_close();
132
?>
133
</body>