require("include/mcontact.inc");
require("include/headdark.inc");
if($_POST["process"]=="onyeax")gb_insert();
else dp_gbook_sign();
require("include/footdark.inc");
//=================================================================
function dp_gbook_sign(){?>
}
//=================================================================
function gb_insert(){
$comment=clearStr($_POST["cmmt"]);
$postname=clearStr($_POST["name"]);
if(strpos(strtolower($_SERVER["HTTP_REFERER"]),"ionchen.com/home/gbook.php")===false){ $vERR="Error processing comment"; }
elseif($_SERVER["REMOTE_ADDR"]==""){ $vERR="Error processing comment"; }
elseif($postname==""){ $vERR="Hey! What's your name."; }
elseif($comment==""){ $vERR="What you want to write to me? Please write a comment."; }
elseif($_SERVER["URL"]==""){$vERR=""; }
else{
$email=$_POST["email"];
$homepage=clearStr($_POST["homepage"]);
$url=$_POST["url"];
$refer=clearStr($_POST["refer"]);
$location=clearStr($_POST["location"]);
$ispri=$_POST["ispri"];
$pri=0;
if($ispri=="on"){ $pri=1; $ispri="Yes"; }
else{ $ispri="No";}
if($url=="http://")$url="";
$comment=str_replace(chr(10),"
",$comment);
$ip=$_SERVER["REMOTE_ADDR"];
$path=$_SERVER["URL"];
$agent=$_SERVER["HTTP_USER_AGENT"];
$sql="insert into gbentry (comment,name,email,homepage,url,refer,location,ip,path,agent,private,dt,gbtype,gbnum) ".
" values ('".$comment."','".$postname."','".$email."','".$homepage."','".$url."','".$refer."','".$location."','".$ip."','".$path."','".$agent."',".$pri.",now(),1,1)";
include("../inc/db.php");
$db = mysql_connect($dbserver,$dbuser,$dbpw);
mysql_select_db($dbname,$db);
mysql_query($sql,$db);
mysql_close($db);
}
if($vERR!="")
print('Missing information
'.$vERR.'');
else
print('Thank you for signing my guestbook
[ read guestbook ]');
}
//=================================================================
function clearStr($s){
return strip_tags(str_replace("'","''",trim($s)));
}
?>