本文整理汇总了PHP中user_id_from_username函数的典型用法代码示例。如果您正苦于以下问题:PHP user_id_from_username函数的具体用法?PHP user_id_from_username怎么用?PHP user_id_from_username使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_id_from_username函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
function login($username, $password)
{
$user_id = user_id_from_username($username);
$username = sanitize($username);
$password = hash('sha512', $password);
return mysql_result(mysql_query("SELECT COUNT(`user_id`) FROM `bplay_users` WHERE `username`='{$username}' AND `password`='{$password}'"), 0) == 1 ? $user_id : false;
}
示例2: login
function login($username, $password)
{
$user_id = user_id_from_username($username);
$username = sanitize($username);
$password = md5($password);
return mysql_result(mysql_query("SELECT COUNT(user_id) FROM users WHERE username = '{$username}' AND password = '{$password}'"), 0) == 1 ? $user_id : false;
}
示例3: login
function login($username, $password)
{
$user_id = user_id_from_username($username);
$username = sanitize($username);
$password = md5($password);
return mysql_result(mysql_query("SELECT COUNT(`user_id`) FROM `login_admin` WHERE `username` = '{$username}' AND `password` = '{$password}'"), 0) == 1 ? $user_id : false;
}
示例4: login
function login($username, $password)
{
$user_id = user_id_from_username($username);
$username = sanitize($username);
$password = md5($password);
return mysql_result(mysql_query("SELECT COUNT(`UID`) FROM `users` WHERE `Email`='{$username}' AND `Password`='{$password}'"), 0) ? $user_id : false;
}
示例5: login
function login($name, $password)
{
$user_id = user_id_from_username($name);
$name = sanitize($name);
//$password = md5($password);
$query = mysql_query("SELECT COUNT(`ID`) FROM `humans` WHERE `name` = '{$name}' AND `password` = '{$password}'");
return mysql_result($query, 0) == 1 ? $user_id : false;
}
示例6: login
function login($username, $password)
{
$user_id = user_id_from_username($username);
$username = sanitize($username);
$pass = sanitize($password);
$query = mysql_query("SELECT COUNT(`user_id`) FROM `tbl_user` WHERE `username` = '{$username}' AND `password` = '{$pass}'");
return mysql_result($query, 0) == 1 ? $user_id : false;
}
示例7: login
function login($username, $password)
{
require 'core/database/connect.php';
//file that connects to database
$user_id = user_id_from_username($username);
$username = sanitize($username);
// $password = md5($password); ideally we want to encrypt the password when the user registers
return mysqli_result(mysqli_query($connect, "SELECT COUNT(`ID`) FROM `users` WHERE `UserName` = '{$username}' AND `Password` = '{$password}'"), 0) == 1 ? $user_id : false;
}
示例8: login
function login($username, $password, $conn)
{
$user_id = user_id_from_username($username, $conn);
$password = md5($password);
$query = $conn->prepare("SELECT COUNT(user_id) FROM users WHERE username = :username AND password = :password");
$query->execute(array(':username' => $username, ':password' => $password));
if ($query->fetchColumn() > 0) {
return $user_id;
} else {
return false;
}
}
示例9: login
function login($username, $password)
{
global $link;
$user_id = user_id_from_username($username);
$username = sanitize($username);
$password = sha1($password);
$query = mysqli_query($link, "SELECT azs_employee_id FROM employee WHERE username = '{$username}' AND password = '{$password}'");
if (mysqli_num_rows($query) > 0) {
echo "Login Successful";
return $user_id;
} else {
return false;
}
}
示例10: login
function login($username, $password)
{
global $db;
$user_id = user_id_from_username($username);
$username = sanitize($username);
$query3 = "SELECT * FROM `users` WHERE `username` = '{$username}'";
$result = $db->query($query3);
if ($result->num_rows > 0) {
$user = $result->fetch_assoc();
if (password_verify($password, $user['password'])) {
$_SESSION['user'] = $user;
return true;
}
return false;
} else {
return false;
}
$db->close();
}
示例11: protect_page
<?php
include 'core/init.php';
include 'includes/overall/overall_header.php';
protect_page();
if (!empty($_GET['username'])) {
$username = $_GET['username'];
if (user_exists($username)) {
$user_id = user_id_from_username($username);
$profile_data = get_user_data($user_id, 'first_name', 'last_name', 'email', 'profile');
//echo '<img src="', $user_data['profile'], '" alt="', $user_data['first_name'], '\'s Profile Image">';
?>
<h1><?php
echo $profile_data['first_name'];
?>
's Profile</h1>
<br>
<p>Howdy! What would you like to do?</p>
<?php
} else {
?>
<p>Sorry, that user does not exist.</p>
<?php
}
} else {
header('Location: index.php');
exit;
}
include 'includes/overall/overall_footer.php';
示例12: login
function login($username, $password)
{
global $db;
$user_id = user_id_from_username($username);
$password = md5($password);
$query = $db->prepare("SELECT COUNT(`user_id`) as `count`\n\t\t\t\t\t\tFROM `users` \n\t\t\t\t\t\tWHERE `username`= :username AND `password`= :password");
$query->bindParam(':username', $username);
$query->bindParam(':password', $password);
$query->execute();
$result = $query->fetch(PDO::FETCH_ASSOC);
$count = $result['count'];
return $count == 1 ? $user_id : false;
}
示例13: login
function login($username, $password)
{
$user_id = user_id_from_username($username);
$username = sanitize($username);
$password = md5($password);
$sql = "SELECT user_id FROM users WHERE username='{$username}' AND password='{$password}'";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
return $row ? $user_id : false;
}
示例14: login
function login($username, $password)
{
$user_id = user_id_from_username($username);
$password = md5($password);
return mysql_result(mysql_query("SELECT COUNT 'id' FROM 'users' WHERE 'email' = '{$username}' AND 'password' = '{$password}'"), 0) == 1 ? $user_id : false;
}
示例15: protect_page
<?php
include_once '../core/init.php';
protect_page();
$username = trim($_POST['name_user']);
$name_data = trim($_POST['name_data']);
$bio_data = trim($_POST['bio_data']);
if ($session_user_id == user_id_from_username($username)) {
$words = explode(" ", $name_data);
$fname = $words[0];
$lname = $words[1];
try {
global $db;
$query = $db->prepare("UPDATE `users` \r\n\t\t\t\t\t\t\tSET `first_name` = :fname, `last_name` = :lname, `bio` = :bio_data \r\n\t\t\t\t\t\t\tWHERE `username` = :username");
$query->bindValue(':fname', $fname);
$query->bindValue(':lname', $lname);
$query->bindValue(':bio_data', $bio_data);
$query->bindValue(':username', $username);
$query->execute();
} catch (customException $e) {
error_log($e->errorMessage());
}
}