本文整理汇总了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"]));
}
示例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!";
示例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;
}