/** * Handle a registration request for the application. * * @param CreateUserRequest|\Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function postRegister(CreateUserRequest $request) { $username = $request->username; $mail = $request->mail; $pass = Hash::make($request->pass); //Create user without profile image, can be added in later under settings storeUser(new User(['username' => $username, 'mail' => $mail, 'pass' => $pass, 'score' => 0])); flash()->success("Welcome, tell us something about yourself or edit your account in the 'Users' section."); $user = loadUser($username); \Auth::loginUsingId($user[0]->id); return redirect("/"); }
$nameUser = "******"; $json = file_get_contents('php://input'); // GCM Registration ID got from device $obj = json_decode($json, true); if (array_key_exists('email', $obj) && array_key_exists("token", $obj)) { $nameEmail = $obj['email']; $nameTokenID = $obj['token']; $isValid = true; } else { http_response_code(400); $message = "Bad Request"; echo $message; die; } /** * Registering a user device in database * Store reg id in users table */ $res = false; if ($isValid) { // Store user details in db $res = storeUser($nameUser, $nameEmail, $nameTokenID); } if ($res != false) { http_response_code(201); } else { http_response_code(409); $message = "Conflict"; echo $message; die; }
<?php require_once 'loader.php'; // return json response $json = array(); $nameUser = $_POST["name"]; $nameEmail = $_POST["email"]; // GCM Registration ID got from device $gcmRegID = $_POST["regId"]; /** * Registering a user device in database * Store reg id in users table */ if (isset($nameUser) && isset($nameEmail) && isset($gcmRegID)) { // Store user details in db $res = storeUser($nameUser, $nameEmail, $gcmRegID); $registatoin_ids = array($gcmRegID); $message = array("product" => "shirt"); $result = send_push_notification($registatoin_ids, $message); echo $result; } else { // user details not found }
<?php require_once 'loader.php'; // return json response $json = array(); $nameUser = stripUnwantedHtmlEscape($_POST["name"]); $emailUser = stripUnwantedHtmlEscape($_POST["email"]); $gcmRegID = stripUnwantedHtmlEscape($_POST["regId"]); // GCM Registration ID got from device $imei = stripUnwantedHtmlEscape($_POST["imei"]); // Send this message to device $message = $nameUser . "^" . $imei . "^" . "Registered on server."; /** * Registering a user device in database * Store reg id in users table */ if (isset($nameUser) && isset($emailUser) && isset($gcmRegID) && $nameUser != "" && $imei != "" && $gcmRegID != "" && $emailUser != "") { if (!isUserExisted($emailUser, $gcmRegID)) { // Store user details in db $res = storeUser($nameUser, $emailUser, $gcmRegID, $imei); $registatoin_ids = array($gcmRegID); $messageSend = array("message" => $message); $result = send_push_notification($registatoin_ids, $messageSend); } //echo $result; } else { // user details not found echo "Wrong values."; }
require_once 'loader.php'; $Email = urldecode($_POST['Email']); $Password = urldecode($_POST['Password']); $Name = urldecode($_POST['Name']); $Age = urldecode($_POST['Age']); $Contact = urldecode($_POST['Contact']); $City = urldecode($_POST['City']); $State = urldecode($_POST['State']); $sex = urldecode($_POST['sex']); $GcmId = urldecode($_POST['GcmId']); $profile_pic = urldecode($_POST['profile_pic']); $facebook = false; if (isset($_POST['Type'])) { $facebook = true; } $res = isUserExisted($Email); if ($res) { if ($facebook) { updateUser($Email, $Password, $Name, $Age, $Contact, $City, $State, $sex, $GcmId, $profile_pic); getUserDetail($Email); } else { echo "user_exits"; } } else { if ($facebook) { $res = storeFacebookUser($Email, $Password, $Name, $Age, $Contact, $City, $State, $sex, $GcmId, $profile_pic); } else { $res = storeUser($Email, $Password, $Name, $Age, $Contact, $City, $State, $sex, $GcmId, $profile_pic); } getUserDetail($Email); }
<?php include '../include/config.php'; include '../include/db.php'; include '../include/gcm.php'; dbconnect(); include '../include/checkprelogin.php'; if (isset($_POST["name"]) && isset($_POST["password"]) && isset($_POST["regId"])) { $name = $_POST["name"]; $password = $_POST["password"]; $gcm_regid = $_POST["regId"]; // GCM Registration ID $token = storeUser($name, $gcm_regid, $user_id); echo "success:" . $token; //$registation_ids = array($gcm_regid); //$message = array("message" => "Successful Registration"); //$result = send_notification($registation_ids, $message); } else { echo "missing fields"; } dbclose();
// Mail to the new user // return user details //return $query->fetchAll(); echo 'it\'s good'; echo '<br>'; } else { echo 'error'; echo '<br>'; //return $false; } } $name = "bachirdiop"; $email = "*****@*****.**"; $password = "******"; $email2 = 'diopisemou@gmail'; echo storeUser($name, $email, $password); echo getUserByEmailAndPassword('*****@*****.**', 'bachirdiop3'); if (isUserExisted($email2)) { echo 'il existe'; } else { echo 'il existe pas '; } /* $uuid = uniqid('fss_u', true); $salt = sha1(rand()); $salt = substr($salt, 0, 10); $encrypted = base64_encode(sha1($password . $salt, true) . $salt); $hash = array("salt" => $salt, "encrypted" => $encrypted); $encrypted_password = $hash["encrypted"]; // encrypted password
{ $stmt = $con->prepare("INSERT INTO registration(gcm_regid, created_at) VALUES(:field, NOW())"); $stmt->execute(array(':field' => $gcm_regid)); $id = $con->lastInsertId(); $result = $con->query("SELECT * FROM registration WHERE id = {$id}"); if ($result->rowCount() > 0) { return true; } else { return false; } } function getSame($con, $gcm_regid) { $result = $con->query("SELECT * FROM registration WHERE gcm_regid=\"" . $gcm_regid . "\""); if ($result->rowCount() > 0) { return true; } else { return false; } } if (isset($_POST["regID"])) { $gcm_regid = $_POST["regID"]; if (!getSame($con, $gcm_regid)) { storeUser($con, $gcm_regid); echo "1"; } else { echo "0"; } } else { echo "0"; }
// Request type is Register new user $name = $_POST['name']; $email = $_POST['email']; $password = $_POST['password']; $plate = $_POST['plate']; $bank = $_POST['bank']; $tel = $_POST['tel']; // check if user is already existed if (isUserExisted($email, $db)) { // user is already existed - error response $response["error"] = TRUE; $response["error_msg"] = "User already existed"; echo json_encode($response); } else { // store user $user = storeUser($name, $email, $password, $plate, $bank, $tel, $db); if ($user === FALSE) { // user failed to store $response["error"] = TRUE; $response["error_msg"] = "Error occured in Registartion"; echo json_encode($response); } else { // user stored successfully $response["error"] = FALSE; $response["uid"] = $user["unique_id"]; $response["user"]["name"] = $user["name"]; $response["user"]["email"] = $user["email"]; $response["user"]["plate"] = $user["plate"]; $response["user"]["bank"] = $user["bank"]; $response["user"]["tel"] = $user["tel"]; $response["user"]["created_at"] = $user["created_at"];
<?php require_once 'loader.php'; // GCM Registration ID got from device $gcmRegID = $_POST["registrationId"]; /** * Registering a user device in database * Store reg id in users table */ if (isset($gcmRegID)) { // Store user details in db $res = storeUser($gcmRegID); } else { // user details not found }