• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP userExists函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中userExists函数的典型用法代码示例。如果您正苦于以下问题:PHP userExists函数的具体用法?PHP userExists怎么用?PHP userExists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了userExists函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: activate

 public function activate($code, $userId)
 {
     $rs = array('status' => '', 'note' => '');
     if (!userExists($userId)) {
         $rs['status'] = 'Fail';
         $rs['note'] = 'User does not exists';
         return $rs;
     }
     $activated = DI()->notorm->User->select('activated')->where('id', $userId);
     $activated = $activated['activated'];
     if ($activated == 1) {
         $rs['status'] = 'Fail';
         $rs['note'] = 'Already Activated';
         return $rs;
     }
     $ac = DI()->notorm->User->select('activationCode')->where('id', $userId);
     $ac = $ac['activationCode'];
     if ($code == $ac) {
         $rs['status'] = 'Success';
         return $rs;
     } else {
         $rs['status'] = 'Fail';
         $rs['note'] = 'Activation does not match';
         return $rs;
     }
 }
开发者ID:jiak94,项目名称:api,代码行数:26,代码来源:User.php


示例2: checkForm

function checkForm()
{
    global $first_name, $last_name, $login, $password1, $password2, $email;
    try {
        $secret = filter_input(INPUT_POST, 'secret');
        if (empty($last_name) || empty($first_name) || empty($login) || empty($password1) || empty($password2) || empty($email) || empty($secret)) {
            throw new Exception('Нужно заполнить  все поля');
        }
        if (!validLogin($login)) {
            throw new Exception('Логин должен состоять из не мене 3-х букв латинского алфавиа цыфр и подчерка');
        }
        if (!validEmail($email)) {
            throw new Exception('Неправильный email');
        }
        if ($password1 != $password1) {
            throw new Exception('Пароли не совпадают');
        }
        if (!validUserName($first_name, $last_name)) {
            throw new Exception('Имя и фамилия могут состоять только из букв');
        }
        if (userExists($login, $email)) {
            throw new Exception('Такой логин или email уже существует.');
        }
        if ($secret != $_SESSION['secret']) {
            throw new Exception('Неверно указано число с картинки');
        }
    } catch (Exception $exc) {
        return $exc->getMessage();
    }
}
开发者ID:viljinsky,项目名称:auth2,代码行数:30,代码来源:register.php


示例3: addNewUser

function addNewUser()
{
    // globals
    global $DB;
    global $MySelf;
    global $MB_EMAIL;
    // Sanitize the input.
    $USERNAME = $MySelf->getUsername;
    $NEW_USER = strtolower(sanitize($_POST[username]));
    // supplied new username.
    if (!ctypeAlnum($NEW_USER)) {
        makeNotice("Only characters a-z, A-Z and 0-9 are allowed as username.", "error", "Invalid Username");
    }
    /* Password busines */
    if ($_POST[pass1] != $_POST[pass2]) {
        makeNotice("The passwords did not match!", "warning", "Passwords invalid", "index.php?action=newuser", "[retry]");
    }
    $PASSWORD = encryptPassword("{$_POST['pass1']}");
    $PASSWORD_ENC = $PASSWORD;
    /* lets see if the users (that is logged in) has sufficient
     * rights to create even the most basic miner. Level 3+ is
     * needed.
     */
    if (!$MySelf->canAddUser()) {
        makeNotice("You are not authorized to do that!", "error", "Forbidden");
    }
    // Lets prevent adding multiple users with the same name.
    if (userExists($NEW_USER) >= 1) {
        makeNotice("User already exists!", "error", "Duplicate User", "index.php?action=newuser", "[Cancel]");
    }
    // So we have an email address?
    if (empty($_POST[email])) {
        // We dont!
        makeNotice("You need to supply an email address!", "error", "Account not created");
    } else {
        // We do. Clean it.
        $NEW_EMAIL = sanitize($_POST[email]);
    }
    // Inser the new user into the database!
    $DB->query("insert into users (username, password, email, addedby, confirmed) " . "values (?, ?, ?, ?, ?)", array("{$NEW_USER}", "{$PASSWORD_ENC}", "{$NEW_EMAIL}", $MySelf->getUsername(), "1"));
    // Were we successfull?
    if ($DB->affectedRows() == 0) {
        makeNotice("Could not create user!", "error");
    } else {
        // Write the user an email.
        global $SITENAME;
        $mail = getTemplate("newuser", "email");
        $mail = str_replace('{{USERNAME}}', "{$NEW_USER}", $mail);
        $mail = str_replace('{{PASSWORD}}', "{$PASSWORD}", $mail);
        $mail = str_replace('{{SITE}}', "http://" . $_SERVER['HTTP_HOST'] . "/", $mail);
        $mail = str_replace('{{CORP}}', "{$SITENAME}", $mail);
        $mail = str_replace('{{CREATOR}}', "{$USERNAME}", $mail);
        $to = $NEW_EMAIL;
        $DOMAIN = $_SERVER['HTTP_HOST'];
        $subject = "Welcome to MiningBuddy";
        $headers = "From:" . $MB_EMAIL;
        mail($to, $subject, $mail, $headers);
        makeNotice("User added and confirmation email sent.", "notice", "Account created", "index.php?action=editusers");
    }
}
开发者ID:nuxi,项目名称:MiningBuddy,代码行数:60,代码来源:addNewUser.php


示例4: _base_verifInfo

/**
 * Function called before changing user attributes
 * @param $FH FormHandler of the page
 * @param $mode add or edit mode
 */
function _base_verifInfo($FH, $mode)
{
    global $error;
    $base_errors = "";
    $uid = $FH->getPostValue("uid");
    $pass = $FH->getPostValue("pass");
    $confpass = $FH->getPostValue("confpass");
    $homedir = $FH->getPostValue("homeDirectory");
    $primary = $FH->getPostValue("primary");
    $firstname = $FH->getPostValue("givenName");
    $lastname = $FH->getPostValue("sn");
    if (!preg_match("/^[a-zA-Z0-9][A-Za-z0-9_.-]*\$/", $uid)) {
        $base_errors .= _("User's name invalid !") . "<br/>";
        setFormError("uid");
    }
    if ($mode == "add" && $uid && userExists($uid)) {
        $base_errors .= sprintf(_("The user %s already exists."), $uid) . "<br/>";
        setFormError("uid");
    }
    if ($mode == "add" && $pass == '') {
        $base_errors .= _("Password is empty.") . "<br/>";
        setFormError("pass");
    }
    if ($mode == "add" && $lastname == '') {
        $base_errors .= _("Last name is empty.") . "<br/>";
        setFormError("sn");
    }
    if ($mode == "add" && $firstname == '') {
        $base_errors .= _("First name is empty.") . "<br/>";
        setFormError("givenName");
    }
    if ($pass != $confpass) {
        $base_errors .= _("The confirmation password does not match the new password.") . " <br/>";
        setFormError("pass");
        setFormError("confpass");
    }
    /* Check that the primary group name exists */
    if (!strlen($primary)) {
        $base_errors .= _("The primary group field can't be empty.") . "<br />";
        setFormError("primary");
    } else {
        if (!existGroup($primary)) {
            $base_errors .= sprintf(_("The group %s does not exist, and so can't be set as primary group."), $primary) . "<br />";
            setFormError("primary");
        }
    }
    /* Check that the homeDir does not exists */
    if ($mode == "add") {
        if ($FH->getPostValue("createHomeDir") == "on" && $FH->getPostValue("ownHomeDir") != "on" && $uid) {
            getHomeDir($uid, $FH->getValue("homeDirectory"));
        }
    } else {
        /* If we want to move the userdir check the destination */
        if ($FH->isUpdated("homeDirectory")) {
            getHomeDir($uid, $FH->getValue("homeDirectory"));
        }
    }
    $error .= $base_errors;
    return $base_errors ? 1 : 0;
}
开发者ID:psyray,项目名称:mmc,代码行数:65,代码来源:publicFunc.php


示例5: isFieldsEmpty

function isFieldsEmpty($loginDetails, $errorMsg)
{
    if (isEmpty($loginDetails)) {
        userExists($loginDetails, $errorMsg);
    } else {
        $errorMsg = "Username and/or password fields cannot be left blank";
        errorMessage($errorMsg);
    }
}
开发者ID:azaeng04,项目名称:ip3shoppingcartazatra,代码行数:9,代码来源:validate-user.php


示例6: userAdd

function userAdd($userData)
{
    $user = $userData['user'];
    $password = $userData['password'];
    $password = md5($password);
    if (userExists($user)) {
        return false;
    }
    $query = "INSERT INTO `user` (`user`,`password`) VALUES ('{$user}','{$password}')";
    $result = userQuery($query);
    return $result != null;
}
开发者ID:apacska,项目名称:learn,代码行数:12,代码来源:user.php


示例7: login

function login()
{
    if (isset($_POST['username'])) {
        $db = new mysqli('localhost', 'root', 'root', 'gurucodertutorial_login');
        $username = $db->real_escape_string($_POST['username']);
        $password = $db->real_escape_string($_POST['password']);
        if (userExists($username)) {
            if (verifyPassword($username, $password)) {
                header('Location: /GuruCoder-Tutorials/login.php?message=Successfully logged in');
            } else {
                header('Location: /GuruCoder-Tutorials/login.php?message=Incorrect password');
            }
        } else {
            header('Location: /GuruCoder-Tutorials/login.php?message=No user exists');
        }
    }
}
开发者ID:BK-Star,项目名称:GuruCoder-Tutorials,代码行数:17,代码来源:login.php


示例8: doLogin

function doLogin()
{
    if (!isset($_POST['username']) || !isset($_POST['password'])) {
        return 'Du hast ein Feld vergessen zu senden!';
    }
    $username = $_POST['username'];
    $password = $_POST['password'];
    if (!userExists($username)) {
        return 'Dieser Benuzter existiert nicht!';
    }
    $userid = isUserPasswordCorrect($username, $password);
    if ($userid === false) {
        return 'Dein Passwort stimmt nicht!';
    } else {
        login($username, $userid);
        $info = getUserInfo($userid);
        $_SESSION['userinfo'] = $info;
        return true;
    }
}
开发者ID:hackyourlife,项目名称:evoc,代码行数:20,代码来源:login.php


示例9: insertUser

 public static function insertUser($name, $surname, $email, $password, $address, $city)
 {
     if (!userExists($email)) {
         $name = mysql_real_escape_string($name);
         $surname = mysql_real_escape_string($surname);
         $email = mysql_real_escape_string($email);
         $password = mysql_real_escape_string($password);
         $address = mysql_real_escape_string($address);
         $city = mysql_real_escape_string($city);
         $query = "INSERT INTO users(first_name, last_name, email, password, address, city) VALUES \\\n                    (" . $name . "," . $surname . "," . $email . "," . $password . "," . $address . "," . $city . ")";
         $result = Database::getInstance()->doInsert($query);
         if ($result) {
             header("location:../public/contest.html");
         } else {
             header("location:../public/register.html");
         }
     } else {
         header("location:../public/register.html");
     }
 }
开发者ID:rflopes,项目名称:TestApp,代码行数:20,代码来源:users.php


示例10: isValidUsername

function isValidUsername($username)
{
    if (userExists($username) or strlen($username) < 3) {
        return false;
    } else {
        $valid_chars = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
        $string = strtolower($username);
        $nsize = strlen($string);
        $x = 0;
        $found = false;
        while ($x < $nsize) {
            if (in_array($string[$x], $valid_chars)) {
            } else {
                $found = true;
            }
            $x++;
        }
        if ($found) {
            return false;
        } else {
            return true;
        }
    }
}
开发者ID:hscale,项目名称:SiteZilla,代码行数:24,代码来源:validation.php


示例11: header

<?php

header('Content-type: application/json');
chdir("..");
chdir("database");
require_once "users.php";
if (isset($_GET["email"]) and isset($_GET["password"]) and userExists((string) $_GET["email"]) and getUserStatus((string) $_GET["email"]) == "active") {
    $email = (string) $_GET["email"];
    $password = (string) $_GET["password"];
    if (checkUserLogin($email, $password)) {
        echo json_encode(array("result" => "ok"));
    } else {
        echo json_encode(array("result" => "invalidLogin"));
    }
} else {
    echo json_encode(array("result" => "missingParams"));
}
开发者ID:hsdrose,项目名称:feup-sdis-budibox,代码行数:17,代码来源:login.php


示例12: header

header('Content-type: application/json');
chdir("../..");
chdir("database");
require_once "users.php";
chdir("..");
require_once "configuration.php";
/**
 * DESCRIPTION: Sets the user space
 * PARAMETERS: /api/users/setUserSpace.php <apikey> <user> <space> 
 */
if (isset($_GET['apikey']) and isset($_GET['user']) and isset($_GET['space'])) {
    $auth = (string) $_GET['apikey'];
    $user = (string) $_GET['user'];
    $space = intval($_GET['space']);
    if ($auth != $apikey) {
        echo json_encode(array("result" => "permissionDenied"));
    } else {
        if (!userExists($user)) {
            echo json_encode(array("result" => "invalidUser"));
        } else {
            $valid = updateUserSpaceUsed($user, $space);
            if ($valid) {
                echo json_encode(array("result" => "ok"));
            } else {
                echo json_encode(array("result" => "notEnoughSpace"));
            }
        }
    }
} else {
    return json_encode(array("result" => "missingParams"));
}
开发者ID:hsdrose,项目名称:feup-sdis-budibox,代码行数:31,代码来源:setUserSpace.php


示例13: htmlspecialchars

<?php

require "init.php";
require_once 'CamsDatabase.php';
require_once 'users.php';
if (!empty($_POST)) {
    $username = htmlspecialchars($_POST['userid']);
    $password = htmlspecialchars($_POST['password']);
    if (empty($username) || empty($password)) {
        $_SESSION["login_error"] = 'User Name and Password cannot be blank';
    } else {
        if (!userExists($username)) {
            $_SESSION["login_error"] = 'User Does not exist.';
        } else {
            $user = userLogin($username, $password);
            if (!$user) {
                $_SESSION["login_error"] = 'incorrect password';
            } else {
                $_SESSION['FirstName'] = $user['FirstName'];
                $_SESSION['LastName'] = $user['LastName'];
                $_SESSION['userid'] = $user['userid'];
                $_SESSION['Email'] = $user['Email'];
                $_SESSION['Empno'] = $user['Empno'];
                $_SESSION['Phone'] = $user['Phone'];
                $_SESSION['Role'] = $user['Role'];
                $_SESSION['Agy'] = $user['Agy'];
                $_SESSION['Dpt'] = $user['Dpt'];
            }
        }
    }
    header('Location: ../index.php');
开发者ID:urisk,项目名称:cssServiceRequests,代码行数:31,代码来源:login.php


示例14: require_login

function require_login($wanted = "")
{
    $username = null;
    $password = null;
    if (isset($_SERVER["PHP_AUTH_USER"])) {
        $username = $_SERVER["PHP_AUTH_USER"];
        $password = $_SERVER["PHP_AUTH_PW"];
    }
    if (is_null($username)) {
        headauth("Voce precisa fazer login para continuar!");
    } else {
        if (!userExists($username)) {
            headauth("Esse usuario nao existe!");
        }
        if ($username !== $wanted && $wanted != "") {
            headauth("Esse login nao e o correto!");
        }
        if (!isright($username, $password)) {
            headauth("Senha incorreta!");
        }
    }
}
开发者ID:Bruno02468,项目名称:resumos-mendel,代码行数:22,代码来源:banco.php


示例15: clean

 if ($mode == "SEND") {
     $pid = clean($_POST['pid']);
     $uid = clean($_POST['uid']);
     $ident = clean($_POST['ident']);
     $to = clean($_POST['to']);
     $from = clean($_POST['from']);
     $message = clean($_POST['message']);
     $pluginname = "xMail";
     if (isset($_POST['pluginOwner'])) {
         $pluginname = clean($_POST['pluginOwner']);
     }
     $attachments = "";
     // Check API key
     check_key($ip, $mode, $key, $from);
     if (valid($pid) && valid($uid) && valid($ident) && valid($to) && valid($from) && valid($message) && valid($pluginname)) {
         if (userExists($to)) {
             if ($ident == "S") {
                 if (!isSpam($to, $from, $message)) {
                     if (!$debug) {
                         mysql_query("INSERT INTO `mail` (`to`, `from`, `message`, `unread`, `complex`, `sent`, `sent_from`, `pluginname`) VALUES ('{$to}', '{$from}', '{$message}', '1', '0', '{$now}', '{$ip}', '{$pluginname}')") or die(mysql_error());
                     }
                     onSend($to, $from, $message);
                     echo json_encode(array("message" => "Message sent!", "status" => "OK"));
                 } else {
                     echo json_encode(array("message" => "Spam", "status" => "ERROR"));
                 }
             } else {
                 if ($ident == "C") {
                     $message = str_replace("&amp;", "&", $message);
                     $message = str_replace("&sect;", "?", $message);
                     $parts = explode(";", $message);
开发者ID:nvnnali,项目名称:xMail-PHP-Server,代码行数:31,代码来源:index.php


示例16: validBase

 function validBase()
 {
     $this->valid = $this->checkattribute("login");
     if (!$this->valid) {
         return;
     }
     $this->user_exists = userExists($this->user["login"]);
     if (!$this->user_exists) {
         $this->importable = true;
         foreach (ImportUsers::getImportRequiredAttributes() as $attribute) {
             if (!$this->checkattribute($attribute)) {
                 $this->importable = false;
             }
         }
     } else {
         $this->deletable = true;
         // check for user
         if ($this->user_exists && count($this->user) > 1) {
             $this->modifiable = true;
         }
     }
 }
开发者ID:sebastiendu,项目名称:mmc,代码行数:22,代码来源:importUsers.php


示例17: getUserInfo

<?php

// Load the installation directory
include './installation-configs/ins-directory.php';
// Load the API
include $_SERVER['DOCUMENT_ROOT'] . $INS_DIR . 'load.php';
if (isset($_GET['username'])) {
    $v_username = $_GET['username'];
    if (isset($_GET['id'])) {
        $v_id = $_GET['id'];
        if (userExists($v_username)) {
            $v_email_status = getUserInfo($v_username, 'email-status');
            if ($v_email_status == 'not-verified') {
                $v_email_code = getUserInfo($v_username, 'email-code');
                if ($v_id == $v_email_code) {
                    setUserInfo($v_username, 'email-status', 'verified');
                    echo 'Account Verified';
                } else {
                    die('Invalid Verification Link');
                }
            } else {
                if ($v_email_status == 'verified') {
                    die('This account is already verified.');
                } else {
                    die('There was a problem with this link.');
                }
            }
        } else {
            die('Invalid Verification Link');
        }
    } else {
开发者ID:austincollins,项目名称:myPersonalWebsite,代码行数:31,代码来源:verify-email.php


示例18: session_start

<?php

session_start();
header("HTTP/1.0 401 Unautorized");
require_once "secure.inc.php";
if ($_SERVER['REQUEST_METHOD'] == "POST") {
    $user = trim(strip_tags($_POST['user']));
    $pw = trim(strip_tags($_POST['pw']));
    $ref = trim(strip_tags($_GET['ref']));
    if (!$ref) {
        $ref = '/admin';
    }
    if ($user and $pw) {
        if ($result = userExists($user)) {
            list($login, $password, $salt, $iteration) = explode(':', $result);
            if (getHash($pw, $salt, $iteration) == $password) {
                $_SESSION['admin'] = true;
                header("Location: {$ref}");
                exit;
            } else {
                $title = 'Неправильный пароль';
            }
        } else {
            $title = 'Неправильное имя пользователя';
        }
    } else {
        $title = 'Заполните все поля формы';
    }
}
$title = 'Авторизация';
$user = '';
开发者ID:sgsani,项目名称:guest.com,代码行数:31,代码来源:login.php


示例19: userExists

	            <br>
				<h1>Impossible octopus fitness</h1>
				<br>
				<p>
				Welcome to JDeePee, the Twitter for runners, fitness and octopus lovers.
				</p>	
				<br>
				<div>
					<?php 
if ($_POST["login"]) {
    if (userExists($_POST["login"], $_POST['password'], $users) == false) {
        echo "<p>Hello, there!</p>";
        echo "<br>";
        echo "<p id='error'>Invalid credentials</p>";
    } else {
        $user = userExists($_POST["login"], $_POST['password'], $users);
        $out = sprintf("<p>Hello, %s</p>", $user);
        echo $out;
        echo "<br>";
        $rot13 = str_rot13($_POST["login"]);
        $out_rot = sprintf("<p>Your rot13’d login is: %s</p>", $rot13);
        echo $out_rot;
        echo "<br>";
        $length = strlen($_POST["login"]);
        $length_out = sprintf("<p>The length of your login is: %s</p>", $length);
        echo $length_out;
    }
} else {
    echo "<p>Hello, there!</p>";
}
?>
开发者ID:jdeepee,项目名称:holbertonschool-twitter_clone,代码行数:31,代码来源:index.php


示例20: mysql_real_escape_string

        $fb_login .= "email='" . mysql_real_escape_string(strip_tags(trim($data['email']))) . "' ,birth_date='" . mysql_real_escape_string(strip_tags(trim($data['birthday']))) . "',";
        $fb_login .= "gender='" . mysql_real_escape_string(strip_tags(trim($data['gender']))) . "' ,city='" . mysql_real_escape_string(strip_tags(trim($location[0]))) . "',";
        echo $fb_login .= "last_login=now() ";
        die;
        $mysql = mysql_query($fb_login) or die(mysql_error());
        if ($mysql) {
            $id = mysql_insert_id();
            $_SESSION['message']['user_login'] = "succesfuly Login";
            $_SESSION['LoginUserId'] = $id;
            echo "success";
        } else {
            echo "error";
        }
    } else {
        $condition = " email = '" . $data['email'] . "'";
        $user_login = userExists($condition);
        $_SESSION['message']['user_login'] = "succesfuly Login";
        $_SESSION['LoginUserId'] = $user_login['id'];
        lastVisit($user_login['id']);
        echo "success";
    }
}
/*change password*/
if (isset($_POST['change_pass']) && $_POST['change_pass'] == "change_password") {
    $current_pass = mysql_real_escape_string(trim($_POST['current_pass']));
    $new_pass = mysql_real_escape_string(trim($_POST['new_pass']));
    $user_id = mysql_real_escape_string(trim($_POST['user_id']));
    $condition = " id='" . $user_id . "'   and password = '" . $current_pass . "' ";
    //and is_admin='no'
    /* check if email id is alreadye exists or not */
    $user = getUserDetail($condition);
开发者ID:simonricky,项目名称:donow,代码行数:31,代码来源:handler.php



注:本文中的userExists函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP userHasPrivilege函数代码示例发布时间:2022-05-23
下一篇:
PHP userDetails函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap