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


PHP user_id_from_username函数代码示例

本文整理汇总了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;
}
开发者ID:SDCore,项目名称:blue-play,代码行数:7,代码来源:users.php

示例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;
}
开发者ID:rushoratiu,项目名称:horatiusirut,代码行数:7,代码来源:users.php

示例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;
}
开发者ID:briannci,项目名称:CollegeWork,代码行数:7,代码来源:users.php

示例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;
}
开发者ID:raull240,项目名称:mini-Craigslist,代码行数:7,代码来源:users.php

示例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;
}
开发者ID:brianmerry,项目名称:indiBeenFed,代码行数:8,代码来源:users.php

示例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;
}
开发者ID:zander009,项目名称:My-first-project-in-Github,代码行数:8,代码来源:users.php

示例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;
}
开发者ID:abelhect,项目名称:merkdoenvio,代码行数:9,代码来源:user.php

示例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;
    }
}
开发者ID:emilsrits,项目名称:RB,代码行数:12,代码来源:general.php

示例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;
    }
}
开发者ID:Wakuza,项目名称:azs,代码行数:14,代码来源:users.php

示例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();
}
开发者ID:AleksandarGjorgievski,项目名称:biblioteka,代码行数:19,代码来源:users.php

示例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';
开发者ID:skinnerdev,项目名称:ballin-batman,代码行数:29,代码来源:profile.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;
}
开发者ID:stevensmetellus,项目名称:medium-clone,代码行数:13,代码来源:users.php

示例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;
}
开发者ID:NucleusStudios,项目名称:php_login_register,代码行数:10,代码来源:users.php

示例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;
}
开发者ID:Uc4O,项目名称:stirl,代码行数:6,代码来源:loginUsers.php

示例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());
    }
}
开发者ID:stevensmetellus,项目名称:medium-clone,代码行数:23,代码来源:profile_s.php


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