保存数据很慢(php)
下面是代码 急!! 有什么建议的 给说说 //保存留言 else if($action=='save') { if(!empty($_COOKIE['GUEST_BOOK_POS'])) $GUEST_BOOK_POS = $_COOKIE['GUEST_BOOK_POS']; else $GUEST_BOOK_POS = 'guestbook.php'; //if(empty($validate)) $validate=='';
下面是代码 急!! 有什么建议的 给说说
//保存留言
else if($action=='save')
{
if(!empty($_COOKIE['GUEST_BOOK_POS'])) $GUEST_BOOK_POS = $_COOKIE['GUEST_BOOK_POS'];
else $GUEST_BOOK_POS = 'guestbook.php';
//if(empty($validate)) $validate=='';
///else $validate = strtolower($validate);
//$svali = GetCkVdValue();
//if($validate=='' || $validate!=$svali)
//{
// ShowMsg("验证码不正确!","-1");
// exit();
//}
$ip = GetIP();
$dtime = time();
$uname = trimMsg($uname);
$email = trimMsg($email);
$homepage = trimMsg($homepage);
//$homepage = eregi_replace('http://','',$homepage);
$qq = trimMsg($qq);
$msg = trimMsg(cn_substrR($msg, 1024), 1);
$tid = empty($tid) ? 0 : intval($tid);
$reid = empty($reid) ? 0 : intval($reid);
if($msg=='' || $uname==''||$homepage=='') {
showMsg('你的姓名和留言内容和联系电话不能为空!','-1');
exit();
}
$title = HtmlReplace( cn_substrR($title,60), 1 );
if($title=='') $title = '无标题';
if($reid != 0)
{
$row = $dsql->GetOne("Select msg From `dede_guestbook` where id='$reid' ");
$msg = "
}
$needCheck=0;
if(empty($tid)) $tid = 0;
$query = "INSERT INTO `dede_guestbook`(uname,email,homepage,qq,face,msg,ip,dtime,ischeck)
VALUES ('$uname','$email','$homepage','$qq','$img','$msg','$ip','$dtime','$needCheck'); ";
$dsql->ExecuteNoneQuery($query);
$gid = $dsql->GetLastID();
$url="http://sms.api.bz/fetion.php?username=13983986064&password=lq123456cq&sendto=13983986064&message=有新留言了";
$result = file_get_contents($url);
//15025437266
if($needCheck==1){
ShowMsg('成功发表留言!','guestbook.php',0,3000);
}
else {
ShowMsg('成功发送一则留言,但需审核后才能显示!','guestbook.php',0,3000);
}
exit();
}