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

PHP encrypt_password函数代码示例

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

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



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

示例1: login_authenticate

 function login_authenticate()
 {
     $username = $this->input->post('username');
     $password = $this->input->post('password');
     $uri_segment = $this->input->post('uri_segment');
     log_message('error', __METHOD__);
     $result = $this->login_model->login_authenticate($username, encrypt_password($password), $uri_segment);
     if (count($result) > 0 && $result['id'] != '') {
         $this->session->set_userdata('user_id', $result['id']);
         $this->session->set_userdata('user_email', $result['email']);
         $this->session->set_userdata('username', $result['username']);
         $this->session->set_userdata('role_id', $result['role_id']);
         $this->session->set_userdata('link', base_url() . $uri_segment . '/');
         $status = 'y';
         $login_session = array('session_id' => $this->session->userdata('session_id'), 'login_ip' => $this->input->ip_address(), 'login_time' => current_timestamp_database(), 'login_client' => $this->input->user_agent(), 'user_id' => $result['id']);
         $this->login_model->session_details($login_session);
         $remember_me = $this->input->post('remember_me') ? TRUE : FALSE;
         if ($remember_me) {
             // set sess_expire_on_close to 0 or FALSE when remember me is checked.
             log_message('error', __METHOD__ . 'remember me called status' . $remember_me);
             $this->session->sess_expire_on_close = 'false';
         }
     } else {
         $status = 'n';
     }
     echo json_encode(array('status' => $status, 'uri_segment' => $uri_segment));
 }
开发者ID:nandumayani,项目名称:jewelstreet2,代码行数:27,代码来源:login.php


示例2: login

function login($username, $password)
{
    global $pdo;
    if (isset($_SESSION['userid']) && $username == $_SESSION['userid']) {
        return TRUE;
    }
    if ($pdo == null) {
        open_database();
    }
    $stmt = $pdo->prepare("SELECT * FROM users WHERE login=?");
    if (!$stmt->execute(array($username))) {
        die('Invalid query : [' . error_database() . ']' . $pdo->errorInfo());
    }
    $row = $stmt->fetch(PDO::FETCH_ASSOC);
    $stmt->closeCursor();
    if (!isset($row['salt'])) {
        return FALSE;
    }
    $digest = encrypt_password($password, $row['salt']);
    if ($digest == $row['crypted_password']) {
        $_SESSION['userid'] = $row['id'];
        $_SESSION['username'] = $row['name'];
        $_SESSION['useraccess'] = $row['access_level'];
        $_SESSION['userpageaccess'] = $row['page_access_level'];
        return TRUE;
    } else {
        return FALSE;
    }
}
开发者ID:haiyangzhang798,项目名称:pecan,代码行数:29,代码来源:common.php


示例3: save

 /**
  * Save the new password
  *
  * @access public
  */
 public function save()
 {
     //load model
     $this->load->model('account_model');
     //get the post data
     $current_password = trim($this->input->post('password_current'));
     $new_password = trim($this->input->post('password_new'));
     $confirmation_password = trim($this->input->post('password_confirmation'));
     //validate the current password and the new password
     if (empty($current_password) || strlen($current_password) < config('ACCOUNT_PASSWORD')) {
         $this->message_stack->add('account_password', sprintf(lang('field_customer_password_current_error'), config('ACCOUNT_PASSWORD')));
     } elseif (empty($new_password) || strlen($new_password) < config('ACCOUNT_PASSWORD')) {
         $this->message_stack->add('account_password', sprintf(lang('field_customer_password_new_error'), config('ACCOUNT_PASSWORD')));
     } elseif (empty($confirmation_password) || $new_password != $confirmation_password) {
         $this->message_stack->add('account_password', lang('field_customer_password_new_mismatch_with_confirmation_error'));
     }
     //if the validation is successful, update the password
     if ($this->message_stack->size('account_password') === 0) {
         if ($this->account_model->check_account($this->customer->get_email_address(), $current_password)) {
             $data['customers_password'] = encrypt_password($new_password);
             if ($this->account_model->save($data, $this->customer->get_id())) {
                 $this->message_stack->add_session('account', lang('success_password_updated'), 'success');
                 redirect(site_url('account'));
             } else {
                 $this->message_stack->add('account_password', lang('error_database'));
             }
         }
     }
     //Setup view
     $this->template->build('account/account_password');
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:36,代码来源:password.php


示例4: new_user

function new_user($firstName, $lastName, $email, $password, $userType)
{
    $salt = generate_salt();
    $encPassword = encrypt_password($password, $salt);
    $user = create_user_object($firstName, $lastName, $email, $encPassword, $salt, $userType);
    save_user_object($user);
    return $user;
}
开发者ID:JXHZY,项目名称:webDeveloper,代码行数:8,代码来源:data_service.php


示例5: create_user_account

function create_user_account($username, $password)
{
    $conn = get_conn();
    $username = mysql_fix_string($conn, $username);
    $password = mysql_fix_string($conn, $password);
    $password = encrypt_password($password);
    $query = "insert into ajx_org_users values('{$username}', '{$password}', null)";
    get_result($conn, $query);
    $conn->close();
}
开发者ID:alexanderpugh,项目名称:Ajax-Organiser,代码行数:10,代码来源:sql-functions.php


示例6: save

 public function save($id = false)
 {
     if ($this->perm->can_create == 'y') {
         if ($_POST) {
             $data = new User($id);
             //	ตรวจสอบชื่อ username ซ้ำ
             if (@$_POST["username"]) {
                 $chk = new User();
                 if ($id) {
                     $chk->where("id !=", $id);
                 }
                 $chk->where("username", strip_tags(trim($_POST["username"])))->get();
                 if ($chk->id) {
                     redirect("admin/settings/users");
                 }
             }
             //	ตรวจสอบชื่อ email ซ้ำ
             if (@$_POST["email"]) {
                 $chk = new User();
                 if ($id) {
                     $chk->where("id !=", $id);
                 }
                 $chk->where("email", strip_tags(trim($_POST["email"])))->get();
                 if ($chk->id) {
                     //	redirect("admin/settings/users");
                 }
             }
             //	Username
             //	$data->username = strip_tags(trim($_POST["username"]));
             if (!empty($_POST["password"])) {
                 $data->password = encrypt_password(strip_tags(trim($_POST["password"])));
             }
             $data->titulation = strip_tags($_POST["titulation"]);
             $data->firstname = strip_tags($_POST["firstname"]);
             $data->lastname = strip_tags($_POST["lastname"]);
             $data->email = strip_tags($_POST["email"]);
             $data->tel = strip_tags($_POST["tel"]);
             $data->org_id = $_POST['org_id'];
             $data->position = strip_tags($_POST['position']);
             $data->user_type_id = $_POST['user_type_id'];
             $data->username = strip_tags($_POST['username']);
             $data->status = !empty($_POST['status']) ? '1' : '0';
             if ($_POST['id'] == '') {
                 $data->created_by = $this->current_user->id;
             } else {
                 $data->updated_by = $this->current_user->id;
             }
             $data->save();
             $action = $_POST['id'] > 0 ? 'UPDATE' : 'CREATE';
             save_logs($this->menu_id, $action, @$data->id, $action . ' ' . $data->firstname . ' ' . $data->lastname . ' User Detail');
         }
     }
     redirect("admin/settings/users");
 }
开发者ID:ultraauchz,项目名称:conference,代码行数:54,代码来源:users.php


示例7: verify_account

function verify_account($dirty_username, $dirty_password, $dirty_activation_code)
{
    $username = escape($dirty_username);
    $password = escape($dirty_password);
    $code = escape($dirty_activation_code);
    $validateUsrMsg = validate_username($username);
    if ($validateUsrMsg != "valid-username") {
        return;
    }
    $validatePwdMsg = validate_password($password);
    if ($validatePwdMsg != "valid-password") {
        return;
    }
    $account_id = account_id_from_code($code);
    $sql1 = "SELECT * FROM account_signup WHERE code='{$code}'";
    $result = query($sql1);
    if (mysqli_num_rows($result) == 1) {
        $row = mysqli_fetch_assoc($result);
        $date_requested = $row["date_requested"];
        $expires = $date_requested + 86400;
        if (time() > $expires) {
            echo "validation-expired";
            return;
        }
        $encrypted_password = encrypt_password($password);
        $sql2 = "UPDATE account_head SET status='logged-out' WHERE account={$account_id};";
        query($sql2);
        if (user_has_status($account_id, 'logged-out') == false) {
            echo 'verify-error';
            return;
        }
        $sql3 = "INSERT INTO account_credentials (account, username, password)";
        $sql3 .= " VALUES ({$account_id}, '{$username}', '{$encrypted_password}');";
        query($sql3);
        if (user_has_credentials($account_id, $username, $encrypted_password) == false) {
            echo 'verify-error';
            return;
        }
        $sql4 = "DELETE FROM account_signup WHERE account={$account_id};";
        query($sql4);
        if (user_has_signup_pending($account_id)) {
            echo 'verify-error';
            return;
        }
        echo "verify-success";
        return;
    }
    echo 'verify-error';
}
开发者ID:andrewdownie,项目名称:projectportfolio.io,代码行数:49,代码来源:verify_account.php


示例8: login

 function login($username, $password)
 {
     $CI =& get_instance();
     $foo = new User();
     //echo $password;
     //echo encrypt_password($password);
     $foo->where("username", $username)->where("password", encrypt_password($password))->where("status", 1)->get(1);
     if ($foo->id) {
         $CI->session->set_userdata("id", $foo->id);
         $CI->session->set_userdata("user_type_id", $foo->user_type_id);
         return TRUE;
     } else {
         return FALSE;
     }
 }
开发者ID:ultraauchz,项目名称:asean_cultural_mapping,代码行数:15,代码来源:authen_helper.php


示例9: auto_create_user

 function auto_create_user($login)
 {
     if ($login && defined('AUTH_AUTO_CREATE') && AUTH_AUTO_CREATE) {
         $user_id = $this->find_user_by_login($login);
         if (!$user_id) {
             $login = db_escape_string($login);
             $salt = substr(bin2hex(get_random_bytes(125)), 0, 250);
             $pwd_hash = encrypt_password($password, $salt, true);
             $query = "INSERT INTO ttrss_users\n\t\t\t\t\t\t(login,access_level,last_login,created,pwd_hash,salt)\n\t\t\t\t\t\tVALUES ('{$login}', 0, null, NOW(), '{$pwd_hash}','{$salt}')";
             db_query($this->link, $query);
             return $this->find_user_by_login($login);
         } else {
             return $user_id;
         }
     }
     return $this->find_user_by_login($login);
 }
开发者ID:bohoo,项目名称:tiny_tiny_rss-openshift-quickstart-1,代码行数:17,代码来源:base.php


示例10: changepassword

 function changepassword()
 {
     $old_pw = $_POST["old_password"];
     $new_pw = $_POST["new_password"];
     $con_pw = $_POST["confirm_password"];
     if ($old_pw == "") {
         print "ERROR: " . __("Old password cannot be blank.");
         return;
     }
     if ($new_pw == "") {
         print "ERROR: " . __("New password cannot be blank.");
         return;
     }
     if ($new_pw != $con_pw) {
         print "ERROR: " . __("Entered passwords do not match.");
         return;
     }
     $result = db_query($this->link, "SELECT salt FROM ttrss_users WHERE\n\t\t\tid = " . $_SESSION['uid']);
     $salt = db_fetch_result($result, 0, "salt");
     if (!$salt) {
         $old_pw_hash1 = encrypt_password($old_pw);
         $old_pw_hash2 = encrypt_password($old_pw, $_SESSION["name"]);
         $query = "SELECT id FROM ttrss_users WHERE\n\t\t\t\tid = " . $_SESSION['uid'] . " AND (pwd_hash = '{$old_pw_hash1}' OR\n\t\t\t\tpwd_hash = '{$old_pw_hash2}')";
     } else {
         $old_pw_hash = encrypt_password($old_pw, $salt, true);
         $query = "SELECT id FROM ttrss_users WHERE\n\t\t\t\tid = " . $_SESSION['uid'] . " AND pwd_hash = '{$old_pw_hash}'";
     }
     $result = db_query($this->link, $query);
     if (db_num_rows($result) == 1) {
         $new_salt = substr(bin2hex(get_random_bytes(125)), 0, 250);
         $new_pw_hash = encrypt_password($new_pw, $new_salt, true);
         db_query($this->link, "UPDATE ttrss_users SET\n\t\t\t\tpwd_hash = '{$new_pw_hash}', salt = '{$new_salt}'\n\t\t\t\t\tWHERE id = " . $_SESSION['uid']);
         $_SESSION["pwd_hash"] = $new_pw_hash;
         print __("Password has been changed.");
     } else {
         print "ERROR: " . __('Old password is incorrect.');
     }
 }
开发者ID:4iji,项目名称:Tiny-Tiny-RSS,代码行数:38,代码来源:pref_prefs.php


示例11: __construct

 function __construct()
 {
     //encryption
     require_once "encryption.php";
     if (isset($_GET['logout']) && $_GET['logout']) {
         $_SESSION['logged'] = FALSE;
         session_destroy();
     }
     $data['invalidEmailPass'] = "<br />";
     //Authentication logic
     if (isset($_POST['login'])) {
         //store form email and pass
         $email = $_POST['email'];
         $enc_password = encrypt_password($_POST['password']);
         $usersObj = new Users_model();
         if ($usersObj->login($email, $enc_password)) {
             $_SESSION['logged'] = TRUE;
             $_SESSION['email'] = $email;
             // $_SESSION['name'] = 'Alin';
             header('Location: http://188.166.119.187/workspace/ilear/MVC/part4/index.php?page=admin');
         } else {
             $data['invalidEmailPass'] = "Invalid email and/or password!";
         }
     }
     // $data['condition'] = (isset($_SESSION['logged']) && $_SESSION['logged'] ===  TRUE);
     // $data['logged'] = "You are logged in!";
     // // $data['unlogged'] = "";
     $data['logged'] = isset($_SESSION['logged']) && $_SESSION['logged'] === TRUE ? "You are logged in!" : "";
     // $data['logged'] = "You are logged in!";
     $data['title'] = "LoginPage";
     // $data['mailSent'] = "Note that only phone number is optional!";
     $this->render('views/top.php', $data);
     $this->render('views/menu.php', $data);
     $this->render('views/login.php', $data);
     $this->render('views/bottom.php', $data);
 }
开发者ID:rai1,项目名称:my-work,代码行数:36,代码来源:login.php


示例12: while

Phone No,
Comments
*/
$cur = config::get_config_item("currency");
$row = 1;
if (($handle = fopen("../../David_People.csv", "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        foreach ($data as $key => $val) {
            #  $data[$key] = utf8_encode($data[$key]);
        }
        $person = new person();
        $person->currency = $cur;
        $person->set_value("username", $data[0]);
        $person->set_value("firstName", $data[1]);
        $person->set_value("surname", $data[2]);
        $person->set_value("password", encrypt_password($data[3]));
        $person->set_value("emailAddress", $data[4]);
        $person->set_value("phoneNo1", $data[5]);
        $person->set_value("comments", $data[6]);
        $person->set_value("perms", "employee");
        $person->set_value("personActive", 1);
        $person->set_value("personModifiedUser", $current_user->get_id());
        $person->save();
        $x++;
        echo "<br>here: " . $person->get_id() . $data[0];
        if ($x > 4) {
            //die();
        }
    }
    fclose($handle);
}
开发者ID:cjbayliss,项目名称:alloc,代码行数:31,代码来源:csv_people.php


示例13: resetUserPassword

 static function resetUserPassword($uid, $show_password)
 {
     $result = db_query("SELECT login,email\n\t\t\t\tFROM ttrss_users WHERE id = '{$uid}'");
     $login = db_fetch_result($result, 0, "login");
     $email = db_fetch_result($result, 0, "email");
     $salt = db_fetch_result($result, 0, "salt");
     $new_salt = substr(bin2hex(get_random_bytes(125)), 0, 250);
     $tmp_user_pwd = make_password(8);
     $pwd_hash = encrypt_password($tmp_user_pwd, $new_salt, true);
     db_query("UPDATE ttrss_users SET pwd_hash = '{$pwd_hash}', salt = '{$new_salt}', otp_enabled = false\n\t\t\t\tWHERE id = '{$uid}'");
     if ($show_password) {
         print T_sprintf("Changed password of user <b>%s</b> to <b>%s</b>", $login, $tmp_user_pwd);
     } else {
         print_notice(T_sprintf("Sending new password of user <b>%s</b> to <b>%s</b>", $login, $email));
     }
     require_once 'classes/ttrssmailer.php';
     if ($email) {
         require_once "lib/MiniTemplator.class.php";
         $tpl = new MiniTemplator();
         $tpl->readTemplateFromFile("templates/resetpass_template.txt");
         $tpl->setVariable('LOGIN', $login);
         $tpl->setVariable('NEWPASS', $tmp_user_pwd);
         $tpl->addBlock('message');
         $message = "";
         $tpl->generateOutputToString($message);
         $mail = new ttrssMailer();
         $rc = $mail->quickMail($email, $login, __("[tt-rss] Password change notification"), $message, false);
         if (!$rc) {
             print_error($mail->ErrorInfo);
         }
     }
 }
开发者ID:zamentur,项目名称:ttrss_ynh,代码行数:32,代码来源:users.php


示例14: trim

 $test = trim(db_escape_string($_REQUEST["turing_test"]));
 if (!$login || !$email || !$test) {
     print_error(__("Your registration information is incomplete."));
     print "<p><form method=\"GET\" action=\"index.php\">\n\t\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t\t</form>";
     return;
 }
 if ($test == "four" || $test == "4") {
     $result = db_query("SELECT id FROM ttrss_users WHERE\n\t\t\t\tlogin = '{$login}'");
     $is_registered = db_num_rows($result) > 0;
     if ($is_registered) {
         print_error(__('Sorry, this username is already taken.'));
         print "<p><form method=\"GET\" action=\"index.php\">\n\t\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t\t</form>";
     } else {
         $password = make_password();
         $salt = substr(bin2hex(get_random_bytes(125)), 0, 250);
         $pwd_hash = encrypt_password($password, $salt, true);
         db_query("INSERT INTO ttrss_users\n\t\t\t\t\t(login,pwd_hash,access_level,last_login, email, created, salt)\n\t\t\t\t\tVALUES ('{$login}', '{$pwd_hash}', 0, null, '{$email}', NOW(), '{$salt}')");
         $result = db_query("SELECT id FROM ttrss_users WHERE\n\t\t\t\t\tlogin = '{$login}' AND pwd_hash = '{$pwd_hash}'");
         if (db_num_rows($result) != 1) {
             print_error(__('Registration failed.'));
             print "<p><form method=\"GET\" action=\"index.php\">\n\t\t\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t\t\t</form>";
         } else {
             $new_uid = db_fetch_result($result, 0, "id");
             initialize_user($new_uid);
             $reg_text = "Hi!\n" . "\n" . "You are receiving this message, because you (or somebody else) have opened\n" . "an account at Tiny Tiny RSS.\n" . "\n" . "Your login information is as follows:\n" . "\n" . "Login: {$login}\n" . "Password: {$password}\n" . "\n" . "Don't forget to login at least once to your new account, otherwise\n" . "it will be deleted in 24 hours.\n" . "\n" . "If that wasn't you, just ignore this message. Thanks.";
             $mail = new ttrssMailer();
             $mail->IsHTML(false);
             $rc = $mail->quickMail($email, "", "Registration information for Tiny Tiny RSS", $reg_text, false);
             if (!$rc) {
                 print_error($mail->ErrorInfo);
             }
开发者ID:adrianpietka,项目名称:bfrss,代码行数:31,代码来源:register.php


示例15: db_prepare_input

         $password2 = db_prepare_input($_POST['Password2']);
         $resetcode_sent = true;
         if (empty($session_email) || empty($session_account_number)) {
             tep_redirect(get_href_link(PAGE_RESET_PASSWORD, '', 'SSL'));
         }
         $sql = "SELECT user_id, firstname, lastname,security_question,account_number FROM " . _TABLE_USERS . " WHERE (email='" . $session_email . "') and (account_number='" . $session_account_number . "')";
         $account = db_fetch_array(db_query($sql));
         $user_id = $account['user_id'];
         $ok = false;
         if ($validator->validateEqual('Password', $password, $password2, _ERROR_PASSWORD)) {
         }
         if ($validator->validateMinLength('Password Length', $password, 6, _ERROR_PASSWORD_MIN_LENGTH)) {
         }
         if (count($validator->errors) == 0) {
             $ok = true;
             $q = db_query("UPDATE  users SET  password =  '" . encrypt_password($password) . "' WHERE user_id = {$user_id}");
             $_html_main_content = $smarty->fetch('home/reset_password_success.html');
         } else {
             //	postAssign($smarty);
             $smarty->assign('validerrors', $validator->errors);
             //--------Add by donghp 27/03/2012- ----------------------------------
             $sql = "SELECT user_id, firstname, lastname,security_question,account_number FROM " . _TABLE_USERS . " WHERE (email='" . $email . "')";
             $account = db_fetch_array(db_query($sql));
             $smarty->assign('email', $email);
             $smarty->assign('account_number', $account['account_number']);
             // $smarty->assign('message_err',$message_err);
             $_html_main_content = $smarty->fetch('home/reset_password03.html');
         }
         $resetcode_sent = true;
     }
 }
开发者ID:rongandat,项目名称:e-global-cya,代码行数:31,代码来源:reset_password.php


示例16: my_fix

<?php

$NameFirst = my_fix($_POST['inputNameFirst']);
$NameLast = my_fix($_POST['inputNameLast']);
$Email = my_fix($_POST['inputEmail2']);
$Blowfish = encrypt_password(random_str(16));
$Connection = get_connection();
try {
    $Connection->beginTransaction();
    $q0 = gq_insert('framy_Personal', 'NameFirst,NameLast,Email', ':a,:b,:c');
    $s0 = $Connection->prepare($q0);
    $s0->bindValue(':a', $NameFirst, PDO::PARAM_STR);
    $s0->bindValue(':b', $NameLast, PDO::PARAM_STR);
    $s0->bindValue(':c', $Email, PDO::PARAM_STR);
    $s0->execute();
    $s0->closeCursor();
    $PersonalId = $Connection->lastInsertId('framy_Personal_PersonalId_seq');
    $q1 = gq_insert('framy_Blowfish', 'PersonalId,Blowfish', ':a,:b');
    $s1 = $Connection->prepare($q1);
    $s1->bindValue(':a', $PersonalId, PDO::PARAM_INT);
    $s1->bindValue(':b', $Blowfish, PDO::PARAM_STR);
    $s1->execute();
    $s1->closeCursor();
    $Connection->commit();
} catch (Exception $e) {
    $Connection->rollBack();
    superendsession();
    exception_error($e);
    die;
}
$_SESSION['PersonalId'] = $PersonalId;
开发者ID:amoschou,项目名称:acet,代码行数:31,代码来源:submit-createaccount.php


示例17: base64_decode

     $page_load_time = (int) base64_decode($_GET['hash']);
     if (time() - $page_load_time > 120) {
         $request_expired = true;
         $action = 'loginform';
         return;
     }
     // 	if((time()-$page_load_time)<6)
     // 	{
     // 		$request_toofast=true;
     // 		$action='loginform';
     // 		return;
     // 	}
 }
 if (isset($_POST['lkey']) && isset($_POST['lurl'])) {
     $registration_no = strtoupper($_POST['handle']);
     $password = encrypt_password($_POST['password']);
     //check for existence of user account
     $query = "SELECT * FROM " . $_pre . "users WHERE registration_no='{$registration_no}' AND password='{$password}'";
     $db->setQuery($query);
     if ($db->foundRows == 0) {
         //Trigger reg no & pass did not match error message
         $reg_pass_no = true;
         $action = 'loginform';
         //load login form again
         return;
     }
     //Get data from user row
     $user_row_data = $db->fetch_assoc();
     //verify if user account disabled
     if ($user_row_data['activated'] == -1) {
         //Trigger account not activated error
开发者ID:sureronald,项目名称:codezone,代码行数:31,代码来源:login.php


示例18: save_password

 /**
  * Save password
  * 
  * @param $customers_id
  * @param $password
  */
 public function save_password($customers_id, $password)
 {
     return $this->db->update('customers', array('customers_password' => encrypt_password($password), 'date_account_last_modified' => 'now()'), array('customers_id' => (int) $customers_id));
 }
开发者ID:jemmy655,项目名称:TomatoCart-v2,代码行数:10,代码来源:account_model.php


示例19: create_order

 /**
  * Create order
  *
  * @access public
  * @return boolean
  */
 public function create_order($order_status = NULL)
 {
     $pre_order_id = $this->ci->session->userdata('pre_order_id');
     if ($pre_order_id !== NULL) {
         $prep = explode('-', $pre_order_id);
         if ($prep[0] == $this->ci->shopping_cart->get_cart_id()) {
             return $prep[1];
             // order_id
         } else {
             if ($this->ci->order_model->get_order_status_id($prep[1]) === ORDERS_STATUS_PREPARING) {
                 $this->ci->order_model->remove($prep[1]);
             }
         }
     }
     //create account
     if (!$this->ci->customer->is_logged_on()) {
         //get billing address
         $billing_address = $this->ci->shopping_cart->get_billing_address();
         $data['customers_gender'] = $billing_address['gender'];
         $data['customers_firstname'] = $billing_address['firstname'];
         $data['customers_lastname'] = $billing_address['lastname'];
         $data['customers_newsletter'] = 0;
         $data['customers_dob'] = NULL;
         $data['customers_email_address'] = $billing_address['email_address'];
         $data['customers_password'] = encrypt_password($billing_address['password']);
         $data['customers_status'] = 1;
         //load model
         $this->ci->load->model('account_model');
         $this->ci->load->model('address_book_model');
         if ($this->ci->account_model->insert($data)) {
             //set data to session
             $this->ci->customer->set_data($data['customers_email_address']);
             $this->ci->address_book_model->save($billing_address, $this->ci->customer->get_id(), NULL, TRUE);
             //insert shipping address
             if (isset($address['ship_to_this_address']) && $address['ship_to_this_address'] == 'on') {
                 $shipping_address = $this->ci->shopping_cart->get_shipping_address();
                 $this->ci->address_book_model->save($shipping_address, $this->ci->customer->get_id());
             }
         }
     } else {
         //get billing address
         $billing_address = $this->ci->shopping_cart->get_billing_address();
         //if create billing address
         if (isset($billing_address['create_billing_address']) && $billing_address['create_billing_address'] == 'on') {
             $data['entry_gender'] = $billing_address['gender'];
             $data['entry_firstname'] = $billing_address['firstname'];
             $data['entry_lastname'] = $billing_address['lastname'];
             $data['entry_company'] = $billing_address['company'];
             $data['entry_street_address'] = $billing_address['street_address'];
             $data['entry_suburb'] = $billing_address['suburb'];
             $data['entry_postcode'] = $billing_address['postcode'];
             $data['entry_city'] = $billing_address['city'];
             $data['entry_country_id'] = $billing_address['country_id'];
             $data['entry_zone_id'] = $billing_address['zone_id'];
             $data['entry_telephone'] = $billing_address['telephone_number'];
             $data['entry_fax'] = $billing_address['fax'];
             $primary = $this->ci->customer->has_default_address() ? FALSE : TRUE;
             //load model
             $this->ci->load->model('address_book_model');
             //save billing address
             $this->ci->address_book_model->save($data, $this->ci->customer->get_id(), NULL, $primary);
         }
         $shipping_address = $this->ci->shopping_cart->get_shipping_address();
         //create shipping address
         if (isset($shipping_address['create_shipping_address']) && $shipping_address['create_shipping_address'] == '1') {
             $data['entry_gender'] = $shipping_address['gender'];
             $data['entry_firstname'] = $shipping_address['firstname'];
             $data['entry_lastname'] = $shipping_address['lastname'];
             $data['entry_company'] = $shipping_address['company'];
             $data['entry_street_address'] = $shipping_address['street_address'];
             $data['entry_suburb'] = $shipping_address['suburb'];
             $data['entry_postcode'] = $shipping_address['postcode'];
             $data['entry_city'] = $shipping_address['city'];
             $data['entry_country_id'] = $shipping_address['country_id'];
             $data['entry_zone_id'] = $shipping_address['zone_id'];
             $data['entry_telephone'] = $shipping_address['telephone_number'];
             $data['entry_fax'] = $shipping_address['fax'];
             //load model
             $this->ci->load->model('address_book_model');
             //save billing address
             $this->ci->address_book_model->save($data, $this->ci->customer->get_id());
         }
     }
     $this->ci->load->model('order_model');
     $orders_id = $this->ci->order_model->insert_order($order_status);
     $pre_order_id = $this->ci->shopping_cart->get_cart_id() . '-' . $orders_id;
     $this->ci->session->set_userdata('pre_order_id', $pre_order_id);
     return $orders_id;
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:95,代码来源:order.php


示例20: die

    if (DB::isError($q)) {
        die("db error: " . $q->getMessage());
    }
    while ($row = $q->fetchRow()) {
        if ($row["use_salt"] == "") {
            $salt = random_string(30);
            $sql_inner = "UPDATE user SET use_salt = '{$salt}' WHERE use_id = " . $row["use_id"] . " LIMIT 1";
            $q_inner = $db->query($sql_inner);
            if (DB::isError($q)) {
                die("db error: " . $q->getMessage());
            }
        } else {
            $salt = $row["use_salt"];
        }
    }
    $db_data["use_password"] = encrypt_password($password, $salt);
    // make sure this password has not been used before by this user
    $sql = "SELECT * FROM changelog WHERE\n\tcha_table = 'user' AND\n\tcha_row = {$use_id} AND\n\tcha_field = 'use_password' AND\n\t(cha_old = '" . $db_data["use_password"] . "' OR cha_new = '" . $db_data["use_password"] . "')\n\t";
    $q = $db->query($sql);
    if (DB::isError($q)) {
        die("db error: " . $q->getMessage());
    }
    $numRows = $q->numRows();
    if ($numRows != 0) {
        $errors[] = "This password has been used before, it is not possible to use the same password twice for this user";
        echo error_message($errors);
        exit;
    }
    $cli_id = db_query($db_data, "UPDATE", "user", "use_id", $use_id);
    header("Location:" . $_SERVER['PHP_SELF']);
}
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:31,代码来源:reset_pw.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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