示例#1
0
    //生成一个激活id
    $clean['active'] = sha1(uniqid(rand(), true));
    $clean['uniqid'] = _check_uniqid($_POST['uniqid'], $_SESSION['uniqid']);
    $clean['username'] = _check_username($_POST['username'], 2, 20);
    $clean['password'] = _check_password($_POST['password'], $_POST['notpassword'], 6);
    $clean['sex'] = _mysql_string($_POST['sex']);
    $clean['facesrc'] = _mysql_string($_POST['facesrc']);
    $clean['passt'] = _check_pwd_question($_POST['passt'], 2, 8);
    $clean['passd'] = _check_pwd_answer($_POST['passt'], $_POST['passd'], 2, 8);
    $clean['email'] = _check_email($_POST['email'], 6, 40);
    $clean['qq'] = _check_qq($_POST['qq']);
    $clean['url'] = _check_url($_POST['url']);
    //防止重复注册
    _is_repeat("SELECT * FROM tg_user WHERE tg_username = '******'username']}'", "用户名重复,请重新注册!");
    _query("INSERT INTO tg_user (\r\n                                                tg_uniqid,\r\n                                                tg_username,\r\n                                                tg_password,\r\n                                                tg_question,\r\n                                                tg_answer,\r\n                                                tg_email,\r\n                                                tg_qq,\r\n                                                tg_url,\r\n                                                tg_active,\r\n                                                tg_sex,\r\n                                                tg_face,\r\n                                                tg_reg_time,\r\n                                                tg_last_time,\r\n                                                tg_last_ip\r\n                                    ) values (\r\n                                                '{$clean['uniqid']}',\r\n                                                '{$clean['username']}',\r\n                                                '{$clean['password']}',\r\n                                                '{$clean['passt']}',\r\n                                                '{$clean['passd']}',\r\n                                                '{$clean['email']}',\r\n                                                '{$clean['qq']}',\r\n                                                '{$clean['url']}',\r\n                                                '{$clean['active']}',\r\n                                                '{$clean['sex']}',\r\n                                                '{$clean['facesrc']}',\r\n                                                NOW(),\r\n                                                NOW(),\r\n                                                '{$_SERVER['REMOTE_ADDR']}'\r\n                                                )");
    if (_affect_rows() != 1) {
        _closeDB();
        _session_destroy();
        _location("注册失败,请重新注册!", 'register.php');
    } else {
        _closeDB();
        _session_destroy();
        _location("恭喜您,注册成功,点击跳转到激活页面!", 'active.php?active=' . $clean['active']);
    }
} else {
    //生成uniqid
    $_SESSION['uniqid'] = $uniqid = sha1(uniqid(rand(), true));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
示例#2
0
require dirname(__FILE__) . '/includes/common.inc.php';
if (!isset($_COOKIE['username'])) {
    _alert_back("请先登录!");
}
if (!isset($_GET['id'])) {
    _alert_back("id异常!");
}
if (isset($_GET['action']) && isset($_GET['id'])) {
    //删除等敏感操作,先验证uniqid
    $_uniqid_sql = "SELECT tg_uniqid FROM tg_user WHERE tg_username='******'username']}'";
    $_row = _fetch_array($_uniqid_sql);
    _check_cookie_uniqid($_COOKIE['uniqid'], $_row['tg_uniqid']);
    //查询当前信息是否存在
    if (!!_fetch_array("SELECT tg_fromuser,tg_content,tg_date FROM tg_message WHERE tg_id='{$_GET['id']}'")) {
        _query("DELETE FROM tg_message WHERE tg_id='{$_GET['id']}'");
        if (_affect_rows() == 1) {
            _closeDB();
            _location('短信删除成功', 'member_message.php');
        } else {
            _closeDB();
            _alert_back('短信删除失败');
        }
    } else {
        _alert_back("此短信不存在!");
    }
    //删除
}
//根据id获取短信内容
$_sql = "SELECT \r\n\t\t\t\ttg_id, \r\n\t\t\t\ttg_fromuser,\r\n\t\t\t\ttg_content,\r\n\t\t\t\ttg_date,\r\n\t\t\t\ttg_state \r\n\t\t\tFROM \r\n\t\t\t\ttg_message\r\n\t\t\tWHERE \r\n\t\t\t\ttg_id='{$_GET['id']}'";
if (!!($_row = _fetch_array($_sql))) {
    $_html = array();
示例#3
0
// 引入公共文件
require dirname(__FILE__) . '/includes/common.inc.php';
if (!isset($_COOKIE['username'])) {
    _alert_back("请先登录!");
}
if (isset($_GET['action']) && $_GET['action'] == 'delete' && isset($_POST['ids'])) {
    //验证用户唯一id
    $_uniqid_sql = "SELECT tg_uniqid FROM tg_user WHERE tg_username='******'username']}'";
    $_row = _fetch_array($_uniqid_sql);
    _check_cookie_uniqid($_COOKIE['uniqid'], $_row['tg_uniqid']);
    //批量删除
    $_clean = array();
    $_clean['ids'] = _mysql_string(implode(',', $_POST['ids']));
    $_sql = "DELETE FROM tg_message WHERE tg_id in ({$_clean['ids']})";
    _query($_sql);
    if (_affect_rows()) {
        _closeDB();
        _location('删除成功', 'member_message.php');
    } else {
        _closeDB();
        _alert_back('删除失败');
    }
}
_page("SELECT tg_id FROM tg_message WHERE tg_touser='******'username']}'", 3);
global $_start_index, $_page_size;
$_sql = "SELECT\r\n                tg_id,\r\n                tg_fromuser,\r\n                tg_content,\r\n                tg_date,\r\n                tg_state\r\n                FROM \r\n                tg_message\r\n          WHERE\r\n                tg_touser = '******'username']}'\r\n         ORDER BY\r\n                tg_date DESC LIMIT " . $_start_index . "," . $_page_size;
//取出所有当前用户接收的消息 并且以发送时间降序排序
$_result = _query($_sql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">