當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DB_Functions::getUser方法代碼示例

本文整理匯總了PHP中DB_Functions::getUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP DB_Functions::getUser方法的具體用法?PHP DB_Functions::getUser怎麽用?PHP DB_Functions::getUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DB_Functions的用法示例。


在下文中一共展示了DB_Functions::getUser方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: array

require_once 'include/DB_Functions.php';
$db = new DB_Functions();
// json response array
$response = array("error" => FALSE);
if (isset($_POST['uid']) && isset($_POST['rank_low']) && isset($_POST['rank_high']) && isset($_POST['tuition_low']) && isset($_POST['tuition_high']) && isset($_POST['state'])) {
    // receiving the post params
    $uid = $_POST['uid'];
    $rank_low = $_POST['rank_low'];
    $rank_high = $_POST['rank_high'];
    $tuition_low = $_POST['tuition_low'];
    $tuition_high = $_POST['tuition_high'];
    $state = $_POST['state'];
    // get the user by email and password
    $university = $db->getUniversities($uid, $rank_low, $rank_high, $tuition_low, $tuition_high, $state);
    //$university=$db->getUni();
    $user = $db->getUser($uid);
    if ($university != NULL) {
        // use is found
        $amb = array();
        $mod = array();
        $safe = array();
        $user_score = $user["undergradGpa"] / 4.0 * 20 + $user["greQuant"] / 170 * 20 + $user["greVerbal"] / 170 * 20 + $user["greAWA"] / 6 * 10 + $user["engScore"] / 120 * 10 + $user["workExp"] / 10 * 20;
        while ($row = $university->fetch_assoc()) {
            $uni_score = $row["minGPA"] / 4.0 * 20 + $row["minGreQuant"] / 170 * 20 + $row["minGreVerbal"] / 170 * 20 + $row["minAWA"] / 6 * 10 + $row["minToefl"] / 120 * 10 + $row["minWorkExp"] / 10 * 20;
            $name = $db->getUniName($row["univId"]);
            if ($user_score < $uni_score - 5) {
                array_push($amb, $name);
            }
            if ($user_score < $uni_score + 10 and $user_score >= $uni_score - 5) {
                array_push($mod, $db->getUniName($row["univId"]));
            }
開發者ID:GradUTeam,項目名稱:Grad-School-Recommendation,代碼行數:31,代碼來源:recommend.php

示例2: array

 **/
if (isset($_POST['tag']) && $_POST['tag'] != '') {
    //Get the tag
    $tag = $_POST['tag'];
    //Include Databse handler
    require_once 'include/DB_FunctionsSam.php';
    $db = new DB_Functions();
    //Response Array
    $response = array("tag" => $tag, "success" => 0, "error" => 0);
    //Check for tag type
    if ($tag == 'login') {
        //Request type is check login
        $username = $_POST['username'];
        $password = $_POST['password'];
        //check for user_error
        $user = $db->getUser($username, $password);
        //print_r($user);
        if ($user != false) {
            //user found
            //echo json with success = 1
            $response["success"] = 1;
            $response["user"]["username"] = $user["username"];
            //$response["user"]["password"] = $user["encrypted_passwd"];
            $response["user"]["created"] = $user["created"];
            //print_r($response);
            echo json_encode($response);
        } else {
            //user not found
            //echo json with error = 1.
            $response["error"] = 1;
            $response["error_msg"] = "Incorrect username or password!";
開發者ID:CSCE499,項目名稱:PHPServer,代碼行數:31,代碼來源:indexSam.php

示例3: GCM

if (!isset($uid)) {
    $uid = "7777";
}
if (!isset($user)) {
    $user = "nipon";
}
/**
 * ผู้ใช้ลงทะเบียนอุปกรณ์เข้ากับฐานข้อมูล
 * โดยเก็บค่า reg id ลงในตาราง
 */
if (isset($my)) {
    $gcm_regid = $my;
    // GCM ID ที่ลงทะเบียน
    // เชื่อมต่อฐานข้อมูลและเก็บรายละเอียดผู้ใช้ลงฐานข้อมูล
    include_once './db_functions.php';
    include_once './gcm.php';
    $db = new DB_Functions();
    $gcm = new GCM();
    if ($db->getUser($gcm_regid)) {
        $res = $db->storeUser($gcm_regid, $uid, $user);
        $registatoin_ids = array($gcm_regid);
        $message = "ยินดีต้อนรับสู่ Smart OBEC";
        $result = $gcm->send_notification($registatoin_ids, $message);
        //echo "gcm regid".$gcm_regid;
        echo $result;
    } else {
        echo "ผู้ใช้ลงทะเบียนแล้ว";
    }
} else {
    echo "ไม่มีค่า my " . $my;
}
開發者ID:aclub88,項目名稱:amss,代碼行數:31,代碼來源:register.php


注:本文中的DB_Functions::getUser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。