コード例 #1
0
<?php

ob_start();
define('IN_TG', true);
require dirname(__FILE__) . '/../configs/configs.php';
require $GLOBALS["rootPath"] . 'includes/function.php';
//判断用户是否已经登录
if (!empty($_COOKIE['username'])) {
    header("location:" . $GLOBALS["domain"] . "/index.php");
}
//没有的登录就判断POST过来的用户名密码是否能通过验证
$username = isset($_POST['username']) ? $_POST['username'] : '';
$password = isset($_POST['password']) ? $_POST['password'] : '';
//$ret = _query_one_assoc('SELECT id,name,staffid,roleType FROM letsgo_staff WHERE `staffid` = '.$username);
$ret = _query_one_assoc("SELECT id,name,staffid,roleType FROM letsgo_staff WHERE `staffid` = " . $username . " AND password = '******'");
if ($ret) {
    _set_cookies("username", $ret["name"]);
    _set_cookies("staffid", $ret["staffid"]);
    _set_cookies("roleType", $ret["roleType"]);
    header("location:../index.php");
} else {
    header("Location:login.php");
}
exit;
コード例 #2
0
ファイル: function.php プロジェクト: a707937337/letsgo_work
/**
 * 获取某一条公告的详细信息
 * @param string $id
 */
function _get_one_notices($id)
{
    return _query_one_assoc("SELECT * FROM letsgo_notice WHERE id = {$id}");
}
コード例 #3
0
<?php

define('IN_TG', true);
define('ACCESS', true);
include dirname(__FILE__) . '/../configs/configs.php';
require_once $GLOBALS["rootPath"] . '/includes/function.php';
$date = date('Y-m-d H:i:s', time());
$sql = "SELECT max(staffId) as maxid FROM letsgo_staff";
$ret = _query_one_assoc($sql);
$newstaffid = $ret["maxid"] + 1;
$sql = "INSERT INTO letsgo_staff (staffId,roleType,email,password,name,gender,telephone,birth,nativePlace,qq,college,campus,academy,major,registerTime,level) VALUES ('" . $newstaffid . "', 'level0' ,'" . $_POST["email"] . "','" . md5($_POST["password"]) . "','" . $_POST["name"] . "','" . $_POST["gender"] . "','" . $_POST["tel"] . "','" . $_POST["birth"] . "','" . $_POST["nativePlace"] . "','" . $_POST["qq"] . "','" . $_POST["college"] . "','" . $_POST["campus"] . "','" . $_POST["academy"] . "','" . $_POST["major"] . "','" . $date . "','0.4')";
$ret = _mysql_exec($sql);
if (1 == $ret) {
    echo json_encode(array("result" => "0", "data" => array("name" => $_POST["name"], "staffid" => $newstaffid)));
} else {
    echo json_encode(array("result" => "1000", "msg" => "Insert Error"));
}