本文整理匯總了PHP中DB_Functions::isUserExisting方法的典型用法代碼示例。如果您正苦於以下問題:PHP DB_Functions::isUserExisting方法的具體用法?PHP DB_Functions::isUserExisting怎麽用?PHP DB_Functions::isUserExisting使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DB_Functions
的用法示例。
在下文中一共展示了DB_Functions::isUserExisting方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
$response["user"]["lobare"] = $user["lobare"];
$response["user"]["block"] = $user["block"];
$response["user"]["admin"] = $user["admin"];
} else {
$response["error"] = 1;
$response["error_msg"] = "Lösenord inkorrekt";
}
} else {
$response["error"] = 1;
$response["error_msg"] = "Kunde inte hitta \"" . $email . "\"";
}
echo json_encode($response);
} else {
if ($tag == "register") {
// Register user
$userExists = $db->isUserExisting($email);
if (!$userExists) {
$hash = password_hash($password, PASSWORD_DEFAULT);
$bool = $db->registerUser($user_id, $email, $hash);
if ($bool) {
$response["success"] = 1;
} else {
$response["error"] = 1;
$response["error_msg"] = "Fel, kunde inte registera användare";
}
} else {
$response["error"] = 1;
$response["error_msg"] = "Fel, emailadressen finns redan";
}
echo json_encode($response);
} else {
示例2:
echo json_encode($response);
} else {
// user not found
// echo json with error = 1
$response["error"] = TRUE;
$response["error_msg"] = "Incorrect username or password!";
echo json_encode($response);
}
} else {
if ($tag == 'register') {
// Request type: add new user to the database
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
// check if user is already exists
if ($db->isUserExisting($name)) {
// user already exists - error response
$response["error"] = TRUE;
$response["error_msg"] = "Username is already taken";
echo json_encode($response);
} else {
if ($db->isEmailExisting($email)) {
// email already exists - error response
$response["error"] = TRUE;
$response["error_msg"] = "E-Mail address already exists";
echo json_encode($response);
} else {
// store user
$user = $db->storeUser($name, $email, $password);
if ($user) {
// user stored successfully