Location: PHPKode > scripts > Net Shoubox > net-shoubox/net_tag.php
<?php
//////
//
// Net Shout
//
// www.php-net.net/
//
/////
require_once "net_config.php";
if(isset($_POST['shout'])){
$q1 = "select * from net_ban_nick where nick = '$_POST[name]'";
$r1 = mysql_query($q1) or die(mysql_error());
if(mysql_num_rows($r1) == '1'){
$error_text.= "<br />The name not are allowed!<br />";
}
elseif(empty($_POST['name']) || $_POST['name']=="Your Name"){
$error_text.= "<br />Type Your name!<br />";
}
elseif (empty($_POST['message']) || $_POST['message']=="Your Message"){
$error_text.= "<br />Type A Message!<br />";
} else {
$_POST['message'] = substr($_POST['message'], 0, 210);
$_POST['name'] = trim($_POST['name']);
$_POST['message'] = trim($_POST['message']);
$_POST['name'] = addslashes($_POST['name']);
$_POST['message'] = addslashes($_POST['message']);
setcookie("net_tag_name",$_POST['name'],time()+108000);
$insertquery = mysql_query("INSERT INTO net_shout (shoutName,shoutMessage,shoutDate,ip)											VALUES ('$_POST[name]','$_POST[message]',now(),'$_SERVER[REMOTE_ADDR]')");
}}
if ($_COOKIE['net_tag_name']){
$net_name=$_COOKIE['net_tag_name'];
} else {
$net_name="Your Name";
}
?>
<script type="text/javascript">
//<![CDATA[
function MPsmiley(smiley){
document.shoutform.message.value += ""+smiley+"";
document.shoutform.message.focus();
}
var WinNum=0;
function Extras(Url,x,y){
var String;
String = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=0,";
String += ",width=";
String += x;
String += ",height=";
String += y;
WinPic=window.open(Url,WinNum++,String);
}
//]]>
</script>
<form method="post" name="shoutform">
<table cellpadding="2" cellspacing="1" class="back" summary="">
<tr> 
<td class="g" align="center">
<div align="center" style="width: 160px; height: 200px; overflow: auto;">
<?php
function phrase($message){
$message = str_replace(":)","<img src='http://php-net.net/images/smiles/icon_smile.gif' alt='' />",$message);
$message = str_replace(":D","<img src='http://php-net.net/images/smiles/icon_biggrin.gif' alt='' />",$message);
$message = str_replace("8D","<img src='http://php-net.net/images/smiles/icon_cool.gif' alt='' />",$message);
$message = str_replace(":(!","<img src='http://php-net.net/images/smiles/icon_mad.gif' alt='' />",$message);
$message = str_replace(":(","<img src='http://php-net.net/images/smiles/icon_sad.gif' alt='' />",$message);
$message = str_replace(":P","<img src='http://php-net.net/images/smiles/icon_razz.gif' alt='' />",$message);
$message = str_replace(";)","<img src='http://php-net.net/images/smiles/icon_wink.gif' alt='' />",$message);
$message=str_replace("[b]", "<b>", "$message");
$message=str_replace("[/b]", "</b>", "$message");
$message=str_replace("[i]", "<i>", "$message");
$message=str_replace("[/i]", "</i>", "$message");
$message=str_replace("[u]", "<u>", "$message");
$message=str_replace("[/u]", "</u>", "$message");
$message=str_replace("[move]", "<marquee>", "$message");
$message=str_replace("[/move]", "</marquee>", "$message");
$message=str_replace("javascript:", "javascript :", "$message");
$message=str_replace("vbscript:", "vbscript :", "$message");
$message=str_replace("about:", "about :", "$message");
$message=eregi_replace("(^|[>[:space:]\n])([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])([<[:space:]\n]|$)","\\1<a href=\"\\2://\\3\\4\" target=\"_blank\">\\2://\\3\\4</a>\\5", $message);
$message=eregi_replace( "(([a-z0-9_]|\-|\.)+@([^[:space:]]*)([[:alnum:]-]))", "<a href=\"mailto:\\1\">\\1</a>", $message);
return($message);
}
function filter($message){
global $phsb;
$filters=mysql_query("SELECT * FROM net_filter");
while($filter=mysql_fetch_array($filters)) {
htmlspecialchars(stripslashes(extract($filter)));
$message=eregi_replace($find,$replacewith,$message);
}
return($message);
}
$purgeseconds = $remove_unused_days * 86400;
$olddate = strftime("%Y-%m-%d %H:%M:%S", time() - $purgeseconds);
$sql = "delete from net_shout where shoutDate < '$olddate'";
$result = mysql_query($sql) or die("Failed: $sql");
$showquery = mysql_query("SELECT * FROM net_shout ORDER BY shoutID DESC LIMIT 0,$display");
if(mysql_num_rows($showquery) == '0'){
$message = "<br />No new posts now... :(<br />Add one now :)<br />";
$message = str_replace(":)","<img src='http://php-net.net/images/smiles/icon_smile.gif' border='0'>",$message);
$message = str_replace(":(","<img src='http://php-net.net/images/smiles/icon_mad.gif' border='0'>",$message);
echo $message ;
}
//echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\"><span class=\"shoutwindow\">";
while($row = mysql_fetch_array($showquery)){
extract($message);
$message=implode(" ",$message);{
$message = wordwrap( $row['shoutMessage'], 17, " ", 1);
$row['shoutName'] = wordwrap( $row['shoutName'], 10, " ", 1);
$message=phrase($message);
$message=filter($message);
$row['shoutName']=filter($row['shoutName']);
echo "
<div class=\"contents\"><b><a href=\"#\" title=\"@ $row[shoutDate],$row[shoutTime], IP Logged\">".$row['shoutName']."</a></b><br />
".$message."</div>
";
}}
//echo "</span></table>";
mysql_close($db);
?></div></td>
</tr>
<tr> 
<td class="g">Name: <input name="name" type="text" id="name" maxlength="20" value="<?php echo $net_name;?>" onblur="if (this.value=='') this.value='Your Name'" onfocus="if (this.value=='Your Name') this.value=''" /><?php echo $error_text;?><br />
Say something:<br />
<textarea name="message" id="message" rows="5" cols="17" maxlength="150"></textarea><br />
<input name="shout" type="submit" id="shout" value="Shout!"></td>
</tr>
<tr> 
<td class="g">
<a href="javascript:MPsmiley(':)')" title=':)'><img src='http://php-net.net/images/smiles/icon_smile.gif' alt=''></a> 
<a href="javascript:MPsmiley(':D')" title=':D'><img src='http://php-net.net/images/smiles/icon_biggrin.gif' alt='' /></a> 
<a href="javascript:MPsmiley('8D')" title='8D'><img src='http://php-net.net/images/smiles/icon_cool.gif' alt='' /></a> 
<a href="javascript:MPsmiley(':(!')" title=':(!'><img src='http://php-net.net/images/smiles/icon_mad.gif' alt='' /></a> 
<a href="javascript:MPsmiley(':(')" title=':('><img src='http://php-net.net/images/smiles/icon_sad.gif' alt='' /></a> 
<a href="javascript:MPsmiley(':P')" title=':P'><img src='http://php-net.net/images/smiles/icon_razz.gif' alt='' /></a> 
<a href="javascript:MPsmiley(';)')" title=';)'><img src='http://php-net.net/images/smiles/icon_wink.gif' alt='' /></a><br />
<a href="javascript:void(0);" onclick="Extras('showarchive.php',200,335)">archive</a></td>
</tr>
</table>
</form><?
// end generateshout()
mysql_close($db);
?>
Return current item: Net Shoubox