$error = "请输入祈祷意向!"; gotoend(); } if (!isset($_SESSION['pray_time'])) { $_SESSION['pray_time'] = 0; } $cur_time = date(time()); $last_time = $_SESSION['pray_time']; if (abs($cur_time - $last_time) < 3600) { //10分钟只能提交一次祈祷意向 $error = '请不要频繁提交祈祷意向,' . (3600 - abs($cur_time - $last_time)) . '秒后再试,主佑!'; gotoend(); } else { $_SESSION['pray_time'] = $cur_time; } if (isset($_GET['name'])) { $name = checkSqlArg(trim($_GET['name'])); } if (strpos($name, "张译公") !== false || strpos($text, "张译公") !== false) { die(""); } //先从数据库中获取 $result = mysql_query("insert into pray (name,text,createtime) values ('" . $name . "','" . $text . "',utc_timestamp());"); if (mysql_affected_rows() < 1) { $error = "添加祈祷意向失败,请稍后重试..."; gotoend(); } //send to wbto //add2weibolist('#彼此代祷# '.$name.':'.$text); $ret['error'] = $error; die($_GET['callback'] . '(' . json_encode($ret) . ')');
<?php require_once "../include/dbconn.php"; require_once "../include/define.php"; session_start(); header("Content-type: text/html; charset=utf-8"); //登录 if (!isset($_POST['submit'])) { exit('非法访问!'); } $username = checkSqlArg($_POST['username']); $password = checkSqlArg($_POST['password']); //检测用户名及密码是否正确 $result = mysql_query("select * from users where username='******' and password='******' limit 1;"); if ($result = mysql_fetch_array($result)) { //登录成功 $_SESSION['username'] = $username; $_SESSION['userid'] = $result['id']; $_SESSION['name'] = $result['name']; $_SESSION['isadmin'] = $result['isadmin']; exit('登录成功!'); } exit('登录失败!');
$last_time = $_SESSION['pray_time']; if (abs($cur_time - $last_time) < 3600) { //10分钟只能提交一次祈祷意向 $error = '请不要频繁提交祈祷意向,' . (3600 - abs($cur_time - $last_time)) . '秒后再试,主佑!'; gotoend(); } else { $_SESSION['pray_time'] = $cur_time; } if (!isset($_POST['cap'])) { die('验证码错误!'); } else { $cap = trim($_POST['cap']); if ($cap != $_SESSION["helloweba_math"]) { die('验证码错误!'); } } if (isset($_POST['name'])) { $name = checkSqlArg(trim($_POST['name'])); $_SESSION['name'] = $name; } if (strpos($name, "张译公") !== false || strpos($text, "张译公") !== false) { die(""); } //先从数据库中获取 $result = mysql_query("insert into pray (name,text,createtime) values ('" . $name . "','" . $text . "',utc_timestamp());"); if (mysql_affected_rows() < 1) { $error = "添加祈祷意向失败,请稍后重试..."; gotoend(); } //send to wbto //add2weibolist('#彼此代祷# '.$name.':'.$text);