本文整理汇总了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