Beispiel #1
0
function SaeMySQLSelectAssociativeCell($SQL)
{
    return SaeMySQLSelectCell($SQL);
}
Beispiel #2
0
<?php 
//示例(PC获取消息)
include '../SAE/SaeMySQL.php';
include '../SAE/SaeMemcache.php';
include '../My.php';
header('Content-Type:text/html;charset=utf-8');
if (MySetParameterInteger("user_id") === false) {
    MyException("缺少user_id参数");
}
$login_stamp = time() - 60 * 5;
if (SaeMySQLConnect() === false) {
    MyError("数据库连接失败");
}
$SQL = "SELECT `id` FROM `user_info`\nWHERE `user_info`.`id` = {$user_id} AND `user_info`.`last_login_stamp` > {$login_stamp}\n";
if (SaeMySQLSelectCell($SQL) === false) {
    MySuccess('0', '用户不在线,继续休眠状态');
}
SaeMySQLDisconnect();
MySuccess('1', '用户在线中,进入激活状态');
Beispiel #3
0
<?php 
//示例(用户登录)
include '../SAE/SaeMySQL.php';
include '../My.php';
header('Content-Type:text/html;charset=utf-8');
if (MySetParameter("username") === false) {
    MyException("缺少username参数");
}
if (MySetParameter("password") === false) {
    MyException("缺少password参数");
}
$login_stamp = time();
$login_time = "'" . date("Y-m-d H:i:s", $login_stamp) . "'";
if (SaeMySQLConnect() === false) {
    MyError("数据库连接失败");
}
$username = SaeMySQLCheck($username);
$password = SaeMySQLCheck($password);
$SQL = "UPDATE `user_info`\nSET `user_info`.`last_login_time` = {$login_time}, `user_info`.`last_login_stamp` = {$login_stamp}\nWHERE `user_info`.`name` = {$username} AND `user_info`.`password` = {$password}\n";
if (SaeMySQLTryUpdate($SQL) === false) {
    MyError("数据库更新失败");
}
$SQL = "SELECT `id` FROM `user_info`\nWHERE `user_info`.`name` = {$username} AND `password` = {$password}\n";
$Result = SaeMySQLSelectCell($SQL);
if ($Result === false) {
    MySuccess("0", "账号或密码错误");
}
SaeMySQLDisconnect();
MySuccess($Result, "登录成功");