$file_url="guestbook"; require_once("admin/connections/config.inc.php"); //連線路徑 require_once("admin/connections/connect.php"); //連線路徑 require_once("admin/".$file_url."/common.php"); require_once("admin/function/common.php");//函數 require_once("admin/function/bbcode.php"); require_once("guestbook_ipfunction.php"); require_once("captcha/captcha.class.php"); ?> //echo $_SESSION["authnum"]; $method=$_POST["method"]; $id=safeget($_REQUEST["id"]); $cid=safeget($_REQUEST["cid"]); $pid=safeget($_REQUEST["pid"]); $Page=safeget($_REQUEST["Page"]); $keyword=safeget($_REQUEST["keyword"]); $acode=safesql($_POST["acode".$_SESSION["af"]]); if ($method=="update"){ $img = new Securimage(); $valid = $img->check($acode); if($valid==false || $acode=="") { $_SESSION["post"]=$_POST; $errmsg="驗證碼輸入錯誤"; }else{ //新的輸入方式 $_SESSION["post"]=""; session_destroy(); $attachment_pic=$_POST["attachment_pic"]; if($attachment_pic!=""){ $attachment_pic_array=explode(",",$attachment_pic); } $filed_temp="isshow";$field_caption[]=$filed_temp;$field_data[]=1; $filed_temp="cid";$field_caption[]=$filed_temp;$field_data[]=safesql($_POST[$filed_temp]); $filed_temp="caption";$field_caption[]=$filed_temp;$field_data[]=safesql($_POST[$filed_temp]); $filed_temp="email";$field_caption[]=$filed_temp;$field_data[]=safesql($_POST[$filed_temp]); $filed_temp="blog";$field_caption[]=$filed_temp;$field_data[]=safesql($_POST[$filed_temp]); $filed_temp="album";$field_caption[]=$filed_temp;$field_data[]=safesql($_POST[$filed_temp]); $filed_temp="content";$field_caption[]=$filed_temp;$field_data[]=safesql($_POST[$filed_temp]); $field_caption[]="postdate";$field_data[]=date("Y-m-d H:i:S"); $field_caption[]="repostdate";$field_data[]=date("Y-m-d H:i:S"); $field_caption[]="createdate";$field_data[]=date("Y-m-d H:i:S"); $field_caption[]="updatedate";$field_data[]=date("Y-m-d H:i:S"); $filed_temp="postname";$field_caption[]=$filed_temp;$field_data[]=safesql($_POST[$filed_temp]); $field_caption[]="ip";$field_data[]=retrieveIP(); //$field_caption[]="ip2";$field_data[]=$_SERVER['REMOTE_ADDR']; foreach ($field_caption as $key => $value) { $field_caption[$key] = "`".$value."`"; } foreach ($field_data as $key => $value) { if($value!="NOW()"){$value="'".$value."'";} $field_data[$key] = "".$value.""; $field_edit[$key]=$field_caption[$key]."=".$field_data[$key]; } $str_add_1=implode(",",$field_caption); $str_add_2=implode(",",$field_data); $sql="INSERT INTO `$tablename`($str_add_1)"; $sql.="values($str_add_2)"; mysql_query($sql); // echo $sql ; header("location:guestbook.php"); } } ?>