本文整理汇总了PHP中DB_Functions::storeUser方法的典型用法代码示例。如果您正苦于以下问题:PHP DB_Functions::storeUser方法的具体用法?PHP DB_Functions::storeUser怎么用?PHP DB_Functions::storeUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB_Functions
的用法示例。
在下文中一共展示了DB_Functions::storeUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
$from = "svetvaz@gmail.com";
$headers = "From:" . $from;
// check if user is already existed
if ($db->isUserExisted($email)) {
// user is already existed - error response
$response["error"] = 2;
$response["error_msg"] = "User already exists.Click on 'Forgot Password to retrieve your password'";
echo json_encode($response);
} else {
if (!$db->validEmail($email)) {
$response["error"] = 3;
$response["error_msg"] = "Invalid Email Id";
echo json_encode($response);
} else {
// store user
$user = $db->storeUser($fname, $lname, $email, $uname, $password);
if ($user) {
// user stored successfully
$response["success"] = 1;
$response["user"]["fname"] = $user["firstname"];
$response["user"]["lname"] = $user["lastname"];
$response["user"]["email"] = $user["email"];
$response["user"]["uname"] = $user["username"];
$response["user"]["uid"] = $user["unique_id"];
$response["user"]["created_at"] = $user["created_at"];
// mail($email,$subject,$message,$headers);
echo json_encode($response);
} else {
// user failed to store
$response["error"] = 1;
$response["error_msg"] = "JSON Error occured in Registration";
示例2: array
<?php
// response json
$json = array();
/**
* Registering a user device
* Store reg id in users table
*/
if (isset($_POST["gcm_user_mobile_id"]) && isset($_POST["regId"])) {
// Store user details in db
include_once './db_functions.php';
include_once './GCM.php';
$db = new DB_Functions();
$gcm = new GCM();
$res = $db->storeUser($_POST["gcm_user_mobile_id"], $_POST["regId"]);
$registatoin_ids = array($gcm_regid);
$message = array("product" => "shirt");
$result = $gcm->send_notification($registatoin_ids, $message);
echo $result;
} else {
// user details missing
}
示例3:
/**
* Registering a user device
* Store reg id in users table
*/
$body = file_get_contents('php://input');
$postvars = json_decode($body, true);
if (isset($postvars["name"]) && isset($postvars["email"]) && isset($postvars["regId"])) {
$name = $postvars["name"];
$email = $postvars["email"];
$gcm_regid = $postvars["regId"];
// GCM Registration ID
// Store user details in db
include_once './db_functions.php';
include_once './GCM.php';
$db = new DB_Functions();
// $gcm = new GCM();
$res = $db->storeUser($name, $email, $gcm_regid);
if ($res) {
$response["status"] = "ok";
$response["message"] = "Register success!";
echo json_encode($response);
} else {
$response["status"] = "false";
$response["error"] = "Registration token is existed!";
echo json_encode($response);
}
} else {
$response["status"] = "false";
$response["error"] = "Param include: name, email, token";
echo json_encode($response);
}
示例4: array
// Request type is Register new user
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
$age = $_POST['age'];
$sex = $_POST['sex'];
// check if user is already existed
if ($db->isUserExisted($name)) {
// user is already existed - error response
$responseError = array("error_msg" => "User already existed");
// $response["error"] = 2;
// $response["error_msg"] = "User already existed";
sendResponse(4042, json_encode($responseError));
} else {
// store user
$user = $db->storeUser($name, $email, $password, $age, $sex);
if ($user) {
// user stored successfully
$response["success"] = 1;
$response["username"] = $user["unique_id"];
$response["email"] = $user["email"];
$response["age"] = $user["age"];
$response["sex"] = $user["sex"];
$response["created_at"] = $user["created_at"];
$response["updated_at"] = $user["updated_at"];
if (($_FILES["file"]["type"] == "image/gif" || $_FILES["file"]["type"] == "image/jpeg" || $_FILES["file"]["type"] == "image/pjpeg") && $_FILES["file"]["size"] < 2000000) {
if ($_FILES["file"]["error"] > 0) {
$response["error"] = 1;
$response["error_msg"] = "Return Code: " . $_FILES["file"]["error"];
sendResponse(2004, json_encode($response));
} else {
示例5: while
// Request type is Register new user
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
$name = $_POST['name'];
$city = $_POST['city'];
$type = $_POST['type'];
// check if user is already existed
if ($db->isUserExisted($username)) {
// user is already existed - error response
$response["error"] = 1;
$response["error_msg"] = "User already existed";
echo json_encode($response);
} else {
// store user
$result = $db->storeUser($username, $password, $email, $name, $city, $type);
if ($result != false) {
while ($row = mysql_fetch_assoc($result)) {
$user[] = $row;
}
echo json_encode($user);
} else {
// user failed to store
$response["error"] = 1;
$response["error_msg"] = "Error occured in Registartion";
echo json_encode($response);
}
}
} else {
if ($tag == 'change_info_user') {
$username = $_POST['username'];
示例6:
} else {
if ($tag == 'register') {
// Request type is Register new user
$name = $_POST['name'];
$email = $_POST['email'];
$branch = $_POST['branch'];
$year = $_POST['year'];
// check if user is already existed
if ($db->isUserExisted($email)) {
// user is already existed - error response
$response["error"] = 2;
$response["error_msg"] = "User already existed";
echo json_encode($response);
} else {
// store user
$user = $db->storeUser($name, $email, $branch, $year);
if ($user) {
// user stored successfully
$response["success"] = 1;
$response["uid"] = $user["unique_id"];
$response["user"]["name"] = $user["name"];
$response["user"]["email"] = $user["email"];
$response["user"]["branch"] = $user["branch"];
$response["user"]["year"] = $user["year"];
$response["user"]["created_at"] = $user["created_at"];
echo json_encode($response);
} else {
// user failed to store
$response["error"] = 1;
$response["error_msg"] = "Error occured in Registartion";
echo json_encode($response);
示例7:
$date_n = $_POST['date_n'];
$prix = $_POST['prix'];
$img = $_POST['img'];
$gouvernorat = $_POST['gouvernorat'];
$matricule = $_POST['matricule'];
$type = $_POST['type'];
$marque = $_POST['marque'];
// check if user is already existed with the same email
if ($db->isUserExisted($email)) {
// user already existed
$response["error"] = TRUE;
$response["error_msg"] = "User already existed with " . $email;
echo json_encode($response);
} else {
// create a new user
$user = $db->storeUser($name, $prenom, $cin, $email, $password, $img, $date_n, $gouvernorat, $prix);
$vehic = $db->storeVehic($matricule, $marque, $type, $cin);
if ($user) {
// user stored successfully
$response["error"] = FALSE;
$response["user"]["nom"] = $user["nom"];
$response["user"]["email"] = $user["email"];
echo json_encode($response);
} else {
// user failed to store
$response["error"] = TRUE;
$response["error_msg"] = "Unknown error occurred in registration!";
echo json_encode($response);
}
}
} else {
示例8: mail
$from = "harsh@stampshubdemo.site50.net";
$headers = "From:" . $from;
// check if user is already existed
if ($db->isUserExisted($email_id)) {
// user is already existed - error response
$response["error"] = 2;
$response["error_msg"] = "User already existed";
echo json_encode($response);
} else {
if (!$db->validEmail($email_id)) {
$response["error"] = 3;
$response["error_msg"] = "Invalid Email Id";
echo json_encode($response);
} else {
// store user
$user = $db->storeUser($utype, $first_name, $last_name, $email_id, $user_gender, $phone_number, $date_of_birth, $security_question, $security_answer, $user_password);
if ($user) {
// user stored successfully
$response["success"] = 1;
$response["user"]["utype"] = $user["utype"];
$response["user"]["first_name"] = $user["first_name"];
$response["user"]["last_name"] = $user["last_name"];
$response["user"]["email_id"] = $user["email_id"];
$response["user"]["user_gender"] = $user["user_gender"];
$response["user"]["phone_number"] = $user["phone_number"];
$response["user"]["date_of_birth"] = $user["date_of_birth"];
$response["user"]["uid"] = $user["unique_id"];
$response["user"]["created_at"] = $user["created_at"];
mail($email_id, $subject, $message, $headers);
echo json_encode($response);
} else {
示例9: converttomonth
$email = $_POST['email'];
$password = $_POST['password'];
$gender = $_POST['gender'];
$date = $_POST['date'];
$month = converttomonth($_POST['month']);
$year = $_POST['year'];
$phone = $_POST['phone'];
// check if user is already existed
if ($db->isUserExisted($email)) {
// user is already existed - error response
$response["error"] = 2;
$response["error_msg"] = "User already exits";
echo json_encode($response);
} else {
// store user
$user = $db->storeUser($name, $email, $password, $gender, $date, $month, $year, $phone);
if ($user) {
$_SESSION['user'] = $user["unique_id"];
// user stored successfully
$response["success"] = 1;
$response["uid"] = $user["unique_id"];
$response["user"]["name"] = $user["name"];
$response["user"]["email"] = $user["email"];
$response["user"]["created_at"] = $user["created_at"];
$response["user"]["dob"] = $user["dob"];
$response["user"]["phone"] = $user["phone"];
setcookie("user", $user["unique_id"], time() + 3600);
setcookie("isprofileok", 'false', time() + 3600);
header("Refresh:0.1;");
//echo json_encode($response);
//mail('rahularyan005@gmail.com','Works!','An email has been generated from your localhost, congratulations!');
示例10:
$email = $_POST['Email'];
$password = $_POST['Password'];
$first_name = $_POST['FirstName'];
$last_name = $_POST['LastName'];
$age = $_POST['Age'];
$country = $_POST['Country'];
$postal_code = $_POST['ZipCode'];
// check if user is already existed
if ($db->DoesUserExist($username)) {
// user is already existed - error response
$response["error"] = 2;
$response["error_msg"] = "You already exist in out system!";
echo json_encode($response);
} else {
// store user
$user = $db->storeUser($username, $email, $password, $first_name, $last_name, $age, $country, $postal_code);
if ($user) {
// user stored successfully
$response["success"] = 1;
$response["uid"] = $user["Uuid"];
$response["user"]["username"] = $user["Username"];
$response["user"]["email"] = $user["Email"];
$response["user"]["join_date"] = $user["JoinDate"];
$response["user"]["last_active_date"] = $user["LastActiveDate"];
$response["user"]["first_name"] = $user["FirstName"];
$response["user"]["last_name"] = $user["LastName"];
$response["user"]["age"] = $user["Age"];
$response["user"]["country"] = $user["Country"];
$response["user"]["postal_code"] = $user["ZipCode"];
echo json_encode($response);
} else {
示例11: array
<?php
// response json
$json = array();
/**
* Registering a user device
* Store reg id in users table
*/
if (isset($_POST["regId"])) {
$gcm_regid = $_POST["regId"];
include_once './db_functions.php';
include_once './gcm_sendmsg.php';
$db = new DB_Functions();
$gcm = new GCM_SendMsg();
$res = $db->storeUser($gcm_regid);
$registatoin_ids = array($gcm_regid);
$message = array("message" => $message, "timestamp" => "20-Jan-2016");
$result = $gcm->send_notification($registatoin_ids, $message);
echo $result;
} else {
// required user details are not received
}
示例12:
// $uid =$bld.$rand;
// check if user is already existed with the same email
if ($db->isUserExisted($username)) {
// user already existed
$response["error"] = TRUE;
$response["error_msg"] = "User already existed with " . $username;
echo json_encode($response);
} else {
if ($db->isNumberExisted($phone)) {
// user already existed
$response["error"] = TRUE;
$response["error_msg"] = "Phone Number already existed with " . $phone;
echo json_encode($response);
} else {
// create a new user
$user = $db->storeUser($name, $lname, $username, $password, $dob, $blood, $gender, $phone, $email, $district, $street);
// $sts = $db->verify($status);
if ($user) {
// user stored successfully
$response["error"] = FALSE;
$response["uid"] = $user["user_id"];
$response["user"]["name"] = $user["first_name"];
$response["user"]["username"] = $user["user_name"];
$response["user"]["created_at"] = $user["joined_date"];
// $response["user"]["updated_at"] = $user["updated_at"];
echo json_encode($response);
} else {
// user failed to store
$response["error"] = TRUE;
$response["error_msg"] = "Unknown error occurred in registration!";
echo json_encode($response);
示例13: 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;
}
示例14: array
$response = array("error" => FALSE);
if (isset($_POST['first_name']) && isset($_POST['last_name']) && isset($_POST['email']) && isset($_POST['password']) && isset($_POST['contact_no'])) {
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];
$password = $_POST['password'];
$contact_no = $_POST['contact_no'];
$facebook_link = $_POST['facebook_link'];
$twitter_link = $_POST['twitter_link'];
//check if user is already there
if ($db->isUserExisted($email)) {
$response["error"] = TRUE;
$response["error_msg"] = "User already exists with email " . $email;
echo json_encode($response);
} else {
$user = $db->storeUser($first_name, $last_name, $email, $password, $contact_no, $facebook_link, $twitter_link);
echo "\n" . $user["name"];
if ($user) {
$response["error"] = FALSE;
$response["uid"] = $user["unique_id"];
$response["user"]["First_name"] = $user["first_name"];
$response["user"]["Last_name"] = $user["last_name"];
$response["user"]["Contact"] = $user["contact_no"];
$response["user"]["email"] = $user["email"];
$response["user"]["Fadebook_link"] = $user["facebook_link"];
$response["user"]["Twitter_link"] = $user["twitter_link"];
$response["user"]["created_at"] = $user["created_at"];
$response["user"]["updated_at"] = $user["updated_at"];
echo json_encode($response);
} else {
$response["error"] = TRUE;
示例15: die
file_put_contents("updates_log.log", $result, FILE_APPEND | LOCK_EX);
die('0');
}
if (isset($_POST["name"]) && isset($_POST["email"]) && isset($_POST["regId"])) {
$name = $_POST["name"];
$email = $_POST["email"];
$gcm_regid = $_POST["regId"];
// GCM Registration ID
$lang = isset($_POST["lang"]) ? $_POST["lang"] : "unkown";
$region = isset($_POST["region"]) ? $_POST["region"] : "unkown";
// Store user details in db
include_once './db_functions.php';
include_once './GCM.php';
$db = new DB_Functions();
$gcm = new GCM();
$res = $db->storeUser($name, $email, $gcm_regid, $region, $lang);
$registatoin_ids = array($gcm_regid);
include './sharedkeys.php';
$xml = new SimpleXMLElement('<data/>');
$xml->addChild('title', "Welcome");
$xml->addChild('description', "Thank you for installing the app you will now receive a notifications that carries the most amazing news , places and other stuff.");
$image = $xml->addChild('images');
$link = $image->addChild('link');
$link->addChild('image', PROJECT_URL . "1.JPG");
$link->addChild('thum', PROJECT_URL . "thum_1.JPG");
$link = $image->addChild('link');
$link->addChild('image', PROJECT_URL . "2.JPG");
$link->addChild('thum', PROJECT_URL . "thum_2.JPG");
$link = $image->addChild('link');
$link->addChild('image', PROJECT_URL . "3.JPG");
$link->addChild('thum', PROJECT_URL . "thum_3.JPG");