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"])); }
**/ 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!";
if (!isset($uid)) { $uid = "7777"; } if (!isset($user)) { $user = "******"; } /** * ผู้ใช้ลงทะเบียนอุปกรณ์เข้ากับฐานข้อมูล * โดยเก็บค่า 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; }