本文整理汇总了PHP中get_password函数的典型用法代码示例。如果您正苦于以下问题:PHP get_password函数的具体用法?PHP get_password怎么用?PHP get_password使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_password函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkLogin
/**
* checkLogin
* 登陆入口首页验证方法
* @access public
* @return html
* @author copoet
* 用户状态status设置:1表示开启,2表示禁用,状态默认为1
*
*/
public function checkLogin()
{
$name = trim(I('post.username'));
$pass = trim(I('post.password'));
if (empty($name) || empty($pass)) {
$this->error('用户名密码不能为空!', './index');
}
$info['name'] = $name;
$info['password'] = get_password($name, $pass);
$m = D('Manager');
$User = $m->get_manager($info);
if ($info['password'] == $User['password']) {
if ($User['status'] == 10) {
$data['last_time'] = time();
$data['up_ip'] = get_client_ip();
$m->updateManager($data, $User['id']);
session('LOGIN_STATUS', 'TRUE');
session('LOGIN_NAME', $User['name']);
session('LOGIN_ID', $User['id']);
$this->success('登陆成功!', './index');
} else {
$this->error('用户已被禁用,请联系管理员!', './index');
}
} else {
$this->error('用户名或密码错误!', './index');
}
}
示例2: auth_error
function auth_error($exception = null)
{
global $connection, $adminer, $has_token;
$session_name = session_name();
$error = "";
if (!$_COOKIE[$session_name] && $_GET[$session_name] && ini_bool("session.use_only_cookies")) {
$error = lang('Session support must be enabled.');
} elseif (isset($_GET["username"])) {
if (($_COOKIE[$session_name] || $_GET[$session_name]) && !$has_token) {
$error = lang('Session expired, please login again.');
} else {
$password = get_password();
if ($password !== null) {
$error = h($exception ? $exception->getMessage() : (is_string($connection) ? $connection : lang('Invalid credentials.')));
if ($password === false) {
$error .= '<br>' . lang('Master password expired. <a href="http://www.adminer.org/en/extension/" target="_blank">Implement</a> %s method to make it permanent.', '<code>permanentLogin()</code>');
}
set_password(DRIVER, SERVER, $_GET["username"], null);
}
unset_permanent();
}
}
$params = session_get_cookie_params();
cookie("adminer_key", $_COOKIE["adminer_key"] ? $_COOKIE["adminer_key"] : rand_string(), $params["lifetime"]);
page_header(lang('Login'), $error, null);
echo "<form action='' method='post'>\n";
$adminer->loginForm();
echo "<div>";
hidden_fields($_POST, array("auth"));
// expired session
echo "</div>\n";
echo "</form>\n";
page_footer("auth");
}
示例3: login
public function login()
{
if (IS_POST) {
$_username = $this->input->post("username");
$_password = $this->input->post("password");
$this->load->model("sys_user_model");
//print_r($_username);exit();
$_admin = $this->sys_user_model->getEntity(array("username" => $_username));
if (!empty($_admin)) {
if (get_password($_password, $_admin['id']) == $_admin['password']) {
if ($_admin['flag_valid'] == 1) {
if ($_admin['flag_valid'] == 1) {
$this->session->set_userdata(array("admin" => $_admin));
header("Location: /" . ADMIN_THEME . "/main");
return;
} else {
$this->put("result", "账号已停用");
}
} else {
$this->put("result", "账号已经停用");
}
} else {
$this->put("result", "账号或密码错误");
}
} else {
$this->put("result", "账号或密码错误");
}
}
$this->render('login.html');
}
示例4: get_password
function get_password()
{
$site_password = common::readSingleline('Enter system user password, and hit return: ');
$site_password2 = common::readSingleline('Retype system user password, and hit return: ');
if ($site_password == $site_password2) {
return $site_password;
} else {
get_password();
}
}
示例5: edit
public function edit()
{
$_id = $this->input->get('id');
if (IS_POST) {
$_check = $this->sys_user_model->getCount(array('username' => $this->input->post('username'), 'id <>' => $_id));
if ($_check == 0) {
$_password = $this->input->post('password');
$_data = $this->parseData(array('username', 'truename', 'email', 'flag_valid', 'sys_group_id'));
$_data['id'] = $_id;
if (notBlank($_password)) {
$_data['password'] = get_password($_password, $_id);
}
$this->handleResult($this->sys_user_model->updateEntityByID($_data, $_id));
} else {
$this->handleResult(false, '账户号名已存在,不能重复!');
}
}
$this->put("group_list", $this->sys_user_group_model->getSysGroupArray());
$this->put('entity', $this->sys_user_model->getEntityByID($_id));
$this->render('sys_user_edit.html');
}
示例6: request
$tmpquery = "WHERE mem.login = '{$un}'";
$existsUser = new request();
$existsUser->openMembers($tmpquery);
$comptExistsUser = count($existsUser->mem_id);
if ($comptExistsUser != "0") {
$error = $strings["user_already_exists"];
} else {
// test if 2 passwords match
if ($pw != $pwa || $pw == "") {
$error = $strings["new_password_error"];
} else {
// replace quotes by html code in name and address
$fn = convertData($fn);
$tit = convertData($tit);
$c = convertData($c);
$pw = get_password($pw);
$tmpquery1 = "INSERT INTO " . $tableCollab["members"] . "(organization,login,name,title,email_work,phone_work,phone_home,mobile,fax,comments,password,profil,created,timezone) VALUES('{$clod}','{$un}','{$fn}','{$tit}','{$em}','{$wp}','{$hp}','{$mp}','{$fax}','{$c}','{$pw}','3','{$dateheure}','0')";
connectSql("{$tmpquery1}");
$tmpquery = $tableCollab["members"];
last_id($tmpquery);
$num = $lastId[0];
unset($lastId);
$tmpquery3 = "INSERT INTO " . $tableCollab["notifications"] . "(member,taskAssignment,removeProjectTeam,addProjectTeam,newTopic,newPost,statusTaskChange,priorityTaskChange,duedateTaskChange,clientAddTask) VALUES ('{$num}','0','0','0','0','0','0','0','0','0')";
connectSql("{$tmpquery3}");
// if mantis bug tracker enabled
if ($enableMantis == "true") {
// Call mantis function for new user creation!!!
$f_access_level = $client_user_level;
// Reporter
require_once "../mantis/create_new_user.php";
}
示例7: request
require_once '../includes/library.php';
$pageSection = 'login';
// test send query
if ($action == 'send') {
$tmpquery = "WHERE mem.login = '{$loginForm}'";
$userDetail = new request();
$userDetail->openMembers($tmpquery);
$comptUserDetail = count($userDetail->mem_id);
// test if user exists
if ($comptUserDetail == "0") {
$error = $strings["no_login"];
} else {
if ($userDetail->mem_email_work[0] != "") {
// test if email of user exists
password_generator();
$pw = get_password($pass_g);
$tmpquery = 'UPDATE ' . $tableCollab['members'] . " SET password='{$pw}' WHERE login = '{$loginForm}'";
connectSql($tmpquery);
$body = $strings['user_name'] . ' : ' . $userDetail->mem_login[0] . "\n\n" . $strings['password'] . " : {$pass_g}";
$mail = new notification();
$mail->getUserinfo('1', 'from');
$subject = 'NetOffice ' . $strings['password'];
$mail->Subject = $subject;
$mail->Priority = '1';
$mail->Body = $body;
$mail->AddAddress($userDetail->mem_email_work[0], $userDetail->mem_name[0]);
$mail->Send();
$mail->ClearAddresses();
// redirect to login page with message
header('Location: ../general/login.php?msg=emailpwd');
exit;
示例8: get_user
/**
* Requests the user information, including username and email.
*/
function get_user()
{
$username = get_input('Username (e.g. first.last)?', '/[A-Za-z0-9]*\\.[A-Za-z0-9]*/');
$email = get_input('Email address (e.g. ' . $username . '@domain.com)?', '/[A-Za-z0-9]*\\.[A-Za-z0-9]*@.*\\..*/');
$role = get_role();
$password = get_password();
$user = new User($username, $email, $role, $password);
if (DEBUG) {
print_line('User specified: ' . $user->username . ' (' . $user->email . ', ' . $user->role . ', ' . $user->get_formatted_password() . ')', DEBUG);
}
return $user;
}
示例9: get_token
<?php
require_once 'functions.php';
require_once 'connect.php';
require_once 'lib/safemysql.class.php';
if ($_GET['state'] == 'vk_reg') {
$token = get_token($_GET['code'], $g_url);
if (!empty($token)) {
$mysql_check = $db_connect->getRow("SELECT user_id FROM sf_user WHERE user_id='" . $user_id . "'");
if (count($mysql_check) > 0) {
$l_msg = 'Вы уже зарегистрированны!';
} else {
$user_name = get_name($user_id);
$user_login = $user_id;
$user_pass = get_password(12);
$db_input = $db_connect->query("INSERT INTO sf_user (user_id, name, user_group, email, login, pass) VALUES ('{$user_id}','{$user_name}','1','vk@vk.com','{$user_login}','{$user_pass}')");
if ($db_input == 1) {
$l_msg = 'Вы успешно зарегистрированны';
} else {
$l_msg = 'В процессе регистрации возникла ошибка, попробуйте ещё раз!';
}
}
}
}
if ($_GET['state'] == 'login_reg') {
$user_login = $_POST['login'];
$user_pass = $_POST['pass'];
$user_mail = $_POST['mail'];
$md5_pass = md5($user_pass);
if (!empty($user_login) and !empty($user_pass) and !empty($user_mail)) {
$mysql_check = $db_connect->getRow("SELECT login FROM sf_user WHERE login='" . $user_login . "'");
示例10: verify_hash
$stmt->execute();
$stmt->bind_result($password);
$stmt->fetch();
$stmt->close();
return $password;
}
}
function verify_hash($password, $hash, $salt)
{
$md5 = md5($salt . $password);
return $md5 == $hash;
}
$protocol = $_SERVER["HTTP_AUTH_PROTOCOL"];
if ($_SERVER["HTTP_AUTH_METHOD"] == "apop") {
$username = $_SERVER["HTTP_AUTH_USER"];
$userpass = get_password($username);
if ($userpass) {
$hash = $_SERVER["HTTP_AUTH_PASS"];
$salt = $_SERVER["HTTP_AUTH_SALT"];
if (verify_hash($userpass, $hash, $salt)) {
get_mailserver($DBMAIL, $protocol);
header("Auth-Pass: {$userpass}");
} else {
fail();
}
} else {
fail();
}
} else {
get_mailserver($DBMAIL, $protocol);
}
示例11: connectSql
}
}
$tmpquery = "UPDATE " . $tableCollab["members"] . " SET password='{$cnpw}' WHERE id = '" . $_SESSION['idSession'] . "'";
connectSql("{$tmpquery}");
// if CVS repository enabled
if ($enable_cvs == "true") {
$query = "WHERE tea.member = '" . $_SESSION['idSession'] . "'";
$cvsMembers = new request();
$cvsMembers->openTeams($query);
// change the password in every repository
for ($i = 0; $i < count($cvsMembers->tea_id); $i++) {
cvs_change_password($cvsMembers->tea_mem_login[$i], $cnpw, $cvsMembers->tea_pro_id[$i]);
}
}
// encrypt the new password using the defined loginMethod
$npw = get_password($npw);
$_SESSION['passwordSession'] = $npw;
header('Location: changepassword.php?msg=update');
exit;
}
}
}
$tmpquery = "WHERE mem.id = '" . $_SESSION['idSession'] . "'";
$userDetail = new request();
$userDetail->openMembers($tmpquery);
$comptUserDetail = count($userDetail->mem_id);
if ($comptUserDetail == "0") {
header('Location: userlist.php?msg=blankUser');
exit;
}
$titlePage = $strings["change_password"];
示例12: credentials
function credentials()
{
return array('localhost', $_GET["username"], get_password());
}
示例13: change_password
function change_password($id, $oldPassword, $newPassword)
{
if ($GLOBALS['$connected'] == False) {
connect_to_db();
}
$hash = get_password($id);
//Unhashing the password to see if it matches what was entered.
if (password_verify($oldPassword, $hash)) {
$newHash = password_hash($newPassword, PASSWORD_DEFAULT);
$sql1 = mysql_query("UPDATE users SET password='{$newHash}' WHERE id='{$id}'");
echo '<script>';
echo 'alert("Password Update Successfull");';
echo '</script>';
} else {
echo '<script>';
echo 'alert("Old Password is invalid");';
echo '</script>';
}
}
示例14: get_connection
function get_connection()
{
static $pdo;
if (empty($pdo)) {
echo get_dsn();
echo "\n";
echo get_username();
echo "\n";
echo get_password();
echo "\n";
$pdo = new PDO(get_dsn(), get_username(), get_password());
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
return $pdo;
}
示例15: while
while ($res = @mysql_fetch_row($tmp)) {
$submit_problems[$res[0]] = $res[1];
}
return $submit_problems;
}
$key = $_GET['key'];
if ($key == $api_key) {
$task = $_GET['task'];
if ($task == 'account') {
$user_id = $_GET['user_id'];
if (check_user_id($user_id) == 0) {
//no user
echo json_encode(array('error' => 'no_such_user'));
exit;
}
$password = get_password($user_id);
$json = array('password' => $password);
echo json_encode($json);
} else {
if ($task == 'submit_problems') {
$user_id = $_GET['user_id'];
if (check_user_id($user_id) == 0) {
//no user
echo json_encode(array('error' => 'no_such_user'));
exit;
}
$submit_problems = get_submit_problems($user_id);
echo json_encode(array('submit_problems' => $submit_problems));
} else {
echo json_encode(array('error' => 'no_such_task'));
}