当前位置: 首页>>代码示例>>PHP>>正文


PHP check_password函数代码示例

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


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

示例1: login

function login($email, $password)
{
    if (check_password($email, $password)) {
        return create_session(user_id($email));
    } else {
        return false;
    }
}
开发者ID:qiemem,项目名称:GovDialogue,代码行数:8,代码来源:sessionmanagement.php

示例2: authenticate

function authenticate($username, $password)
{
    $auth = check_password($username, $password);
    if ($auth) {
        $_SESSION['authenticated'] = true;
        debug("logged in {$username} ok!");
        return true;
    }
    return false;
}
开发者ID:ahiliation,项目名称:beautifulwork,代码行数:10,代码来源:dvd-util.php

示例3: login4

 function login4($sUser, $sPwdClear)
 {
     $iId = 0;
     $aProfileInfo = getProfileInfo(getID($sUser));
     if ($aProfileInfo && ((32 == strlen($sPwdClear) || 40 == strlen($sPwdClear)) && BxDolXMLRPCUtil::checkLogin($sUser, $sPwdClear))) {
         $iId = $aProfileInfo['ID'];
     } elseif ($aProfileInfo && getParam('enable_dolphin_footer') != 'on' && check_password($aProfileInfo['ID'], $sPwdClear, BX_DOL_ROLE_MEMBER, false)) {
         $iId = $aProfileInfo['ID'];
     }
     return new xmlrpcresp(new xmlrpcval(array('member_id' => new xmlrpcval($iId, "int"), 'member_pwd_hash' => new xmlrpcval($iId ? $aProfileInfo['Password'] : ""), 'member_username' => new xmlrpcval($iId ? getUsername($iId) : ""), 'protocol_ver' => new xmlrpcval(BX_XMLRPC_PROTOCOL_VER, "int")), "struct"));
 }
开发者ID:toxalot,项目名称:dolphin.pro,代码行数:11,代码来源:BxDolXMLRPCUser.php

示例4: updateMultiVpsCreate

 function updateMultiVpsCreate($param)
 {
     global $gbl, $sgbl, $login, $ghtml;
     if (!check_password($param['vps_admin_password_f'], $this->password)) {
         throw new lxException("wrong_password", 'vps_admin_password_f');
     }
     $res = rl_exec_get(null, 'localhost', 'createMultipLeVps', array($param));
     $url = $ghtml->getFullUrl('a=list&c=vps');
     $gbl->__this_redirect = $url . "&frm_smessage=vps_creation_in_background";
     return $param;
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:11,代码来源:clientlib.php

示例5: correct_password

function correct_password($account_id, $dirty_password)
{
    $password = escape($dirty_password);
    $sql = "SELECT (password) FROM account_credentials WHERE account={$account_id}";
    $result = query($sql);
    if (mysqli_num_rows($result) == 1) {
        $row = mysqli_fetch_assoc($result);
        $stored_password = $row["password"];
        return check_password($password, $stored_password);
    }
    return false;
}
开发者ID:andrewdownie,项目名称:projectportfolio.io,代码行数:12,代码来源:db_functions.php

示例6: attempt_login

function attempt_login($username, $password)
{
    $regd_user = find_user_by_username($username);
    if ($regd_user) {
        if (check_password($password, $regd_user['hashed_password'])) {
            return $regd_user;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
开发者ID:Vilash,项目名称:busgo,代码行数:13,代码来源:functions.php

示例7: login

 /**
  *
  * Método para logear al usuario.
  *
  */
 public function login($authMethod)
 {
     if ($authMethod == "LOCAL") {
         //Obtengo el número de intentos de sesión de la ip.
         $attcount = $this->getattempt($_SERVER['REMOTE_ADDR']);
         if ($attcount >= self::MAX_ATTEMPTS) {
             throw new ExceedSessionAttempts("Has sobrepasado el número de intentos de sessión permitidos - espere 30 minutos");
         } else {
             //Validamos datos.
             //Saneamos y Filtramos los datos.
             $nick = filter_input(INPUT_POST, 'nick', FILTER_SANITIZE_STRING, FILTER_NULL_ON_FAILURE);
             $password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING, FILTER_NULL_ON_FAILURE);
             if ($nick && $password) {
                 //Comprobamos si existe ese usuario con esa contraseña.
                 $sql = $this->pdo->prepare('SELECT * FROM USUARIOS WHERE nick = :nick AND authMethod = "LOCAL"');
                 $sql->execute(array('nick' => $nick));
                 $usuario = $sql->fetch(PDO::FETCH_ASSOC);
                 if (!check_password($password, $usuario["password"])) {
                     //Fallo al intentar iniciar sesión.
                     //Añadimos intento de sesión.
                     $this->addattempt($_SERVER['REMOTE_ADDR']);
                     //Registramos acción.
                     logger_action("intento sesión fallido", $_SERVER["REMOTE_ADDR"]);
                     throw new LoginFailed("Usuario o contraseña no válidos");
                 } else {
                     //usuario logeado correctamente.
                     logger_action("sesión iniciada", $_SERVER["REMOTE_ADDR"]);
                     //Generamos token de sesión
                     return $this->generateSessionToken($usuario["id"]);
                 }
             } else {
                 throw new InvalidData("Nick y password no pueden estar vacíos");
             }
         }
     } else {
         //Saneamos y validamos email.
         $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL, FILTER_VALIDATE_EMAIL);
         $stmt = $this->pdo->prepare('SELECT * FROM USUARIOS WHERE email = :email AND authMethod = :authMethod');
         $stmt->execute(array('email' => $email, 'authMethod' => $authMethod));
         $usuario = $stmt->fetch(PDO::FETCH_ASSOC);
         if ($stmt->rowCount() == 0) {
             throw new LoginFailed("Usuario o contraseña no válidos");
         } else {
             //usuario logeado correctamente.
             logger_action("sesión iniciada", $_SERVER["REMOTE_ADDR"]);
             //Generamos token de sesión
             return $this->generateSessionToken($usuario["id"]);
         }
     }
 }
开发者ID:sergio11,项目名称:teVeo,代码行数:55,代码来源:Auth.php

示例8: login_new

function login_new($auth_user, $auth_pass)
{
    if (check_password($auth_user, $auth_pass)) {
        $user = login_check();
        setcookie("aid", $auth_user, 60 * 60 * 10);
        //クッキー名、保存内容、時間を指定
        redirect("/dev/top.php");
        //print "ログイン成功";
        //redirect("02-01.php3?" . SID);
    } else {
        $error_msg = array();
        $error_msg[] = "パスワードが違います。";
        return $error_msg;
    }
}
开发者ID:kaoru-t,项目名称:sample,代码行数:15,代码来源:common.php

示例9: login

function login($attempt, $remember = 'no')
{
    require 'config.php';
    require_once 'mod_settings.php';
    $set = false;
    if (check_password(md5($attempt))) {
        session_regenerate_id();
        if ($remember == 'yes') {
            $set = setcookie('e3login', md5($attempt), time() + 60 * 60 * 24 * 7);
        } else {
            $set = setcookie('e3login', md5($attempt));
        }
    }
    $_SESSION['logerrors'] = get_setting('log_errors');
    return $set;
}
开发者ID:adriculous,项目名称:enthusiast,代码行数:16,代码来源:logincheck.inc.php

示例10: check_input

function check_input($password_new, $password_conf)
{
    $error = "";
    if ($password_new == "") {
        $error = "<font color=\"red\">Please enter a new password...</font>";
        return $error;
    }
    if ($password_new != $password_conf) {
        $error = "<font color=\"red\">The passwords don't match!</font>";
        return $error;
    }
    if (!check_password($password_new) && $_COOKIE["security_level"] == "2") {
        $error = "<font color=\"red\">The new password is not valid!<br />Password policy: minimum 6 characters containing at least one uppercase letter, lowercase letter and number.";
        return $error;
    }
    return $error;
}
开发者ID:Enda21,项目名称:FinalYearProject,代码行数:17,代码来源:cs_validation.php

示例11: check_admin_user

function check_admin_user()
{
    include 'config.php';
    if (!isset($_SESSION['user']) || !isset($_SESSION['password'])) {
        return false;
    } else {
        $password = $_SESSION['password'];
        $user = $_SESSION['user'];
        $res = false;
        $db = new IMDB();
        $fields = array();
        $fields["username"] = "'" . $db->escapeString($user) . "'";
        $fields["permissions"] = "1";
        $res = $db->get_items_from_table("user", $fields);
        $db->close();
        if (count($res) > 0) {
            $res = check_password($password, $res[0]["password"]);
        }
        return $res;
    }
}
开发者ID:grycap,项目名称:im-web,代码行数:21,代码来源:user.php

示例12: checkNewUser

 public function checkNewUser($username, $name, $surname, $email, $password)
 {
     switch (FALSE) {
         case check_valid_input($username, 6):
             throw new InvalidInputException("false Username Input = input needs to be minimum 6 long, only numbers, letters, capital letters and # @ . - or _");
         case check_valid_input($name, 1):
         case check_no_numbers($name):
             throw new InvalidInputException("false name Input = input needs to be minimum 1 long, only letters, capital letters and # @ . - or _");
         case check_valid_input($surname, 1):
         case check_no_numbers($surname):
             throw new InvalidInputException("false surname Input = input needs to be minimum 1 long, only letters, capital letters and # @ . - or _");
         case check_valid_input($email, 6):
         case check_at($email):
             throw new InvalidInputException("false email Input = input needs to be minimum 6 long, only numbers, letters, capital letters and # @ . - or _");
         case check_password($password):
             throw new InvalidInputException("false password Input = input needs to be minimum 6 long, only numbers, letters, capital letters and # @ . - or _");
     }
     $hashedpwd = passwordEncrypt($username, $password);
     $userDAO = new UserDAO();
     $userDAO->createUser($username, $name, $surname, $email, $hashedpwd);
 }
开发者ID:liesenborghspuntkristof,项目名称:php_oefeningen,代码行数:21,代码来源:UserService.php

示例13: save_profile

function save_profile()
{
    global $db, $user, $current_user, $globals, $site_key;
    $errors = 0;
    // benjami: control added (2005-12-22)
    $pass_changed = false;
    $messages = '';
    $form_hash = md5($site_key . $user->id . mnminclude);
    if (!isset($_POST['save_profile']) || !isset($_POST['process']) || $_POST['user_id'] != $current_user->user_id) {
        return;
    }
    if (empty($_POST['form_hash']) || $_POST['form_hash'] != $form_hash) {
        $messages .= '<p class="form-error">' . _('Falta la clave de control') . '</p>';
        $errors++;
    }
    if (!empty($_POST['username']) && trim($_POST['username']) != $user->username) {
        if (strlen(trim($_POST['username'])) < 3) {
            $messages .= '<p class="form-error">' . _('nombre demasiado corto') . '</p>';
            $errors++;
        }
        if (!check_username($_POST['username'])) {
            $messages .= '<p class="form-error">' . _('nombre de usuario erróneo, caracteres no admitidos') . '</p>';
            $errors++;
        } elseif (user_exists(trim($_POST['username']))) {
            $messages .= '<p class="form-error">' . _('el usuario ya existe') . '</p>';
            $errors++;
        } else {
            $user->username = trim($_POST['username']);
        }
    }
    if ($user->email != trim($_POST['email']) && !check_email(trim($_POST['email']))) {
        $messages .= '<p class="form-error">' . _('el correo electrónico no es correcto') . '</p>';
        $errors++;
    } elseif (trim($_POST['email']) != $current_user->user_email && email_exists(trim($_POST['email']))) {
        $messages .= '<p class="form-error">' . _('ya existe otro usuario con esa dirección de correo') . '</p>';
        $errors++;
    }
    $user->url = htmlspecialchars(clean_input_url($_POST['url']));
    $user->names = clean_text($_POST['names']);
    if (!empty($_POST['password']) || !empty($_POST['password2'])) {
        if (!check_password($_POST["password"])) {
            $messages .= '<p class="form-error">' . _('Clave demasiado corta, debe ser de 6 o más caracteres e incluir mayúsculas, minúsculas y números') . '</p>';
            $errors = 1;
        } else {
            if (trim($_POST['password']) !== trim($_POST['password2'])) {
                $messages .= '<p class="form-error">' . _('las claves no son iguales, no se ha modificado') . '</p>';
                $errors = 1;
            } else {
                $user->pass = md5(trim($_POST['password']));
                $messages .= '<p  class="form-error">' . _('La clave se ha cambiado') . '</p>';
                $pass_changed = true;
            }
        }
    }
    $user->comment_pref = intval($_POST['comment_pref']) + (intval($_POST['show_friends']) & 1) * 2 + (intval($_POST['show_2cols']) & 1) * 4;
    // Manage avatars upload
    if (!empty($_FILES['image']['tmp_name'])) {
        if (avatars_check_upload_size('image')) {
            $avatar_mtime = avatars_manage_upload($user->id, 'image');
            if (!$avatar_mtime) {
                $messages .= '<p class="form-error">' . _('error guardando la imagen') . '</p>';
                $errors = 1;
                $user->avatar = 0;
            } else {
                $user->avatar = $avatar_mtime;
            }
        } else {
            $messages .= '<p class="form-error">' . _('el tamaño de la imagen excede el límite') . '</p>';
            $errors = 1;
            $user->avatar = 0;
        }
    }
    if (!$errors) {
        if (empty($user->ip)) {
            $user->ip = $globals['user_ip'];
        }
        $user->store();
        $user->read();
        if ($current_user->user_login != $user->username || $current_user->user_email != $user->email || $pass_changed) {
            $current_user->Authenticate($user->username, $user->pass);
        }
        $messages .= '<p class="form-error">' . _('datos actualizados') . '</p>';
    }
    return $messages;
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:85,代码来源:profile.php

示例14: saveconfig_ini

         echo "Character 'Knight Sample' already in database.<br/>";
         $config['site']['install'] = 5;
         saveconfig_ini($config['site']);
         echo 'All samples added to database. Now you can go to <a href="install.php?page=step&step=5&server_conf=yes">STEP 5 - Set Admin Account</a><br/>';
     }
 }
 if ($step == '5') {
     echo '<h1>STEP ' . $step . '</h1>Set Admin Account<br>';
     $config['server'] = parse_ini_file($config['site']['server_path'] . 'config.lua');
     if (empty($_REQUEST['saveaccpassword'])) {
         echo 'Admin account number is: <b>1</b><br/>Set new password to this account.<br>';
         echo 'New password: <form action="install.php" method=POST><input type="text" name="newpass" size="35">(Don\'t give it password to anyone!)';
         echo '<input type="hidden" name="saveaccpassword" value="yes"><input type="hidden" name="page" value="step"><input type="hidden" name="step" value="5"><input type="submit" value="SET"></form><br>If account with number 1 doesn\'t exist installator will create it and set your password.';
     } else {
         $newpass = $_POST['newpass'];
         if (!check_password($newpass)) {
             echo 'Password contains illegal characters. Please use only a-Z and 0-9. <a href="install.php?page=step&step=5&server_conf=yes">GO BACK</a> and write other password.';
         } else {
             $newpass_to_db = password_ency($newpass);
             $account = new OTS_Account();
             $account->load(1);
             if ($account->isLoaded()) {
                 $account->setPassword($newpass_to_db);
                 $account->save();
                 $account->setCustomField("page_access", 6);
             } else {
                 $number = $account->create(1, 1, 1);
                 $account->setPassword($newpass_to_db);
                 $account->unblock();
                 $account->save();
                 $account->setCustomField("page_access", 6);
开发者ID:s3kk,项目名称:Gesior,代码行数:31,代码来源:install.php

示例15: alert

<?php

include_once './_common.php';
if (!$member['mb_id']) {
    alert('회원만 접근하실 수 있습니다.');
}
if ($is_admin == 'super') {
    alert('최고 관리자는 탈퇴할 수 없습니다');
}
if (!($_POST['mb_password'] && check_password($_POST['mb_password'], $member['mb_password']))) {
    alert('비밀번호가 틀립니다.');
}
// 회원탈퇴일을 저장
$date = date("Ymd");
$sql = " update {$g5['member_table']} set mb_leave_date = '{$date}' where mb_id = '{$member['mb_id']}' ";
sql_query($sql);
// 3.09 수정 (로그아웃)
unset($_SESSION['ss_mb_id']);
if (!$url) {
    $url = G5_URL;
}
alert('' . $member['mb_name'] . '님께서는 ' . date("Y년 m월 d일") . '에 회원에서 탈퇴 하셨습니다.', $url);
开发者ID:najinsu,项目名称:nsle,代码行数:22,代码来源:member_leave.php


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