Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
<?
2
ob_start();
3
?>
4
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5
<html>
6
<head>
7
<title>phpSHOUT from Designanet.co.uk</title>
8
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
9
<script language="JavaScript">
10
function addsmiley(symbol) {
11
  document.postshout.msg.value += symbol;
12
  document.postshout.msg.focus();
13
}
14
 
15
<!-- Begin
16
function popUp(URL) {
17
day = new Date();
18
id = day.getTime();
19
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=300,height=500');");
20
}
21
 
22
</script>
23
<link href="phpshoutstyle.css" rel="stylesheet" type="text/css">
24
</head>
25
 
26
<body class="phpshout_body">
27
<form name="postshout" method="post" action="<? echo $_SERVER['PHP_SELF']; ?>">
28
  <table align="center" class="phpshout_table">
29
    <tr>
30
      <td class="phpshout_form"><?
31
	include "config.php";
32
	include "functions.php";
33
 
34
	if (isset($_POST["Submit"])) {
35
 
36
		// Remove any tabs
37
		$_POST["name"] = str_replace("\t"," ",$_POST["name"]);
38
		$_POST["email"] = str_replace("\t"," ",$_POST["email"]);
39
		$_POST["msg"] = str_replace("\t"," ",$_POST["msg"]);
40
 
41
		// Make name and string lower case for bad language filter
42
		$_POST["name"] = strtolower(stripslashes(trim(htmlspecialchars($_POST["name"]))));
43
		$_POST["msg"] = strtolower(stripslashes(trim(htmlspecialchars($_POST["msg"]))));
44
 
45
		if (!file_exists("messages.txt")) {
46
 
47
			echo "<p class=\"error\">Messages.txt doesn't exsist. Please create a file call messages.txt on your server</p>";
48
 
49
		} else if ($_POST["name"] == "name" || $_POST["msg"] == "message" || $_POST["name"] == NULL || $_POST["msg"] == NULL) {
50
 
51
			echo "<p class=\"error\">Name & message are required fields. Please enter your name and message.</p>";
52
 
53
		} else {
54
 
55
			$filename = "messages.txt";
56
			$handle = fopen($filename,"r");
57
			$read = file_get_contents($filename);
58
 
59
			if ($read != "" || $read != NULL) {
60
 
61
					$array = explode("\n", $read);
62
 
63
					if ($array[0] != NULL || $array[0] != "") {
64
 
65
					list($name, $email, $msg, $time, $ip) = explode("\t", $array[0]);
66
 
67
					$ip = trim($ip);
68
 
69
					// Convert timestamp to unix timestamp and get current unix timestamp
70
					$strtime = strtotime($time);
71
					$flood_gate_time = $strtime+$floodtime;
72
					$curtime = time();
73
					$valid = true;
74
					}
75
 
76
					if ($ip == $_SERVER['REMOTE_ADDR'] && $flood_gate_time > $curtime) {
77
						echo "<p class=\"error\">You must wait ".$floodtime." seconds before posting again</p>";
78
					} else {
79
 
80
					writetofile($_POST["name"],$_POST["email"],$_POST["msg"]);
81
 
82
					}
83
 
84
			} else {
85
				writetofile($_POST["name"],$_POST["email"],$_POST["msg"]);
86
			}
87
 
88
		} // end if file exists
89
 
90
	} // end submit
91
 
92
?></td>
93
    </tr>
94
    <tr>
95
      <td class="phpshout_form"><input class="textfields" name="name" type="text" id="name" value="<? echo fillnamevalues("name","name") ?>"></td>
96
    </tr>
97
    <tr>
98
      <td class="phpshout_form"><input class="textfields" name="email" type="text" id="email" value="<? echo filltextvalues("email","email") ?>"></td>
99
    </tr>
100
    <tr>
101
      <td class="phpshout_form"><input class="textfields" name="msg" type="text" id="msg" value="<? echo filltextvalues("msg","message") ?>" maxlength="<? echo $maxchars; ?>"></td>
102
    </tr>
103
    <tr>
104
      <td class="phpshout_form"><input class="buttons" type="submit" name="Submit" value="Send">
105
      <input class="buttons" name="Reset" type="reset" id="Reset" value="Reset"></td>
106
    </tr>
107
    <tr>
108
      <td class="phpshout_form"><a href="javascript:addsmiley(' :) ');"><img class="smilies" src="<? echo $imagepath; ?>/icon_smile.gif" width="15" height="15"></a>&nbsp;<a href="javascript:addsmiley(' :lol: ');"><img class="smilies" src="<? echo $imagepath; ?>/icon_lol.gif" width="15" height="15"></a>&nbsp;<a href="javascript:addsmiley(' :D ');"><img src="<? echo $imagepath; ?>/icon_cheesygrin.gif" width="15" height="15" border="0" class="smilies"></a> <a href="javascript:addsmiley(' :P ');"><img src="<? echo $imagepath; ?>/icon_razz.gif" width="15" height="15" border="0" class="smilies"></a>&nbsp;<a href="javascript:addsmiley(' ;) ');"><img class="smilies" src="<? echo $imagepath; ?>/icon_wink.gif" width="15" height="15"></a>&nbsp;<a href="javascript:addsmiley(' :redface: ');"><img class="smilies" src="<? echo $imagepath; ?>/icon_redface.gif" width="15" height="15"></a>&nbsp;<a href="javascript:addsmiley(' :o ');"><img class="smilies" src="<? echo $imagepath; ?>/icon_surprised.gif" width="15" height="15"></a><a href="javascript:addsmiley(' :shock: ');"> </a></td>
109
    </tr>
110
    <tr>
111
      <td class="phpshout_form"><a href="javascript:addsmiley(' :shock: ');"><img src="<? echo $imagepath; ?>/icon_eek.gif" width="15" height="15" border="0" class="smilies"></a>&nbsp;<a href="javascript:addsmiley(' :( ');"><img class="smilies" src="<? echo $imagepath; ?>/icon_sad.gif" width="15" height="15"></a>&nbsp;<a href="javascript:addsmiley(' :cry: ');"><img class="smilies" src="<? echo $imagepath; ?>/icon_cry.gif" width="15" height="15"></a>&nbsp;<a href="javascript:addsmiley(' :roll: ');"><img class="smilies" src="<? echo $imagepath; ?>/icon_rolleyes.gif" width="15" height="15"></a>&nbsp;<a href="javascript:addsmiley(' :x ');"><img class="smilies" src="<? echo $imagepath; ?>/icon_mad.gif" width="15" height="15"></a>&nbsp;<a href="javascript:addsmiley(' :twisted: ');"><img class="smilies" src="<? echo $imagepath; ?>/icon_twisted.gif" width="15" height="15"></a>&nbsp;<a href="javascript:addsmiley(' :evil: ');"><img class="smilies" src="<? echo $imagepath; ?>/icon_evil.gif" width="15" height="15"></a></td>
112
    </tr>
113
    <tr>
114
      <td class="phpshout_form"><a class="phpshout_link" href="javascript:popUp('oldmsg.php')">Archive</a></td>
115
    </tr>
116
    <tr>
117
      <td class="phpshout_posts">&nbsp;</td></td>
118
    </tr>
119
	  	<? 
120
 
121
	$filename = "messages.txt";
122
 
123
	if (file_exists($filename)) {
124
 
125
	$handle = fopen($filename, "r");
126
	$read = file_get_contents($filename);
127
	$array = explode("\n", $read);
128
 
129
	for($i=0; $i<$numofposts; $i++) {
130
 
131
		if ($array[$i] != NULL || $array[$i] != "") {
132
 
133
			list($name, $email, $msg, $date) = explode("\t", $array[$i]);
134
 
135
			$date = str_replace(" ","/",$date);
136
			list($year,$month,$day,$time) = explode("/", $date);
137
 
138
			// Show date, Yes or No.
139
			if ($showdate == "1") {
140
				$title = "title=\"Posted ".$day."/".$month."/".$year." ".$time."\"";
141
			} else {
142
				$title = "";
143
			}	
144
 
145
			if ($display_email == "1") {
146
 
147
				echo "<tr><td ".$title." class=\"phpshout_posts\"><strong><a class=\"phpshout_link\" href=\"mailto:$email\">".wordwrap($name,18,"<br>\n",1)."</a> : </strong>";
148
				$msg = smiles($msg);
149
				echo ereg_replace("([^ \/]{22})","\\1<wbr>",$msg)."</td></tr>";
150
 
151
			} else if ($display_email == "0") {
152
 
153
				echo "<tr><td ".$title." class=\"phpshout_posts\"><strong>".wordwrap($name,18,"<br>\n",1)." : </strong>";
154
				$msg = smiles($msg);
155
				echo ereg_replace("([^ \/]{22})","\\1<wbr>",$msg)."</td></tr>";
156
 
157
			} else {
158
 
159
				echo "Invalid display e-mail value. Please check your config.php file";
160
 
161
			}
162
 
163
		} else {
164
 
165
		break;
166
 
167
		}
168
	}
169
 
170
	fclose($handle);
171
 
172
	}
173
 
174
?>
175
  </table>
176
</form>
177
</body>
178
</html>
179
<?
180
ob_end_flush();
181
?>