本文整理汇总了PHP中UserDB::get方法的典型用法代码示例。如果您正苦于以下问题:PHP UserDB::get方法的具体用法?PHP UserDB::get怎么用?PHP UserDB::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserDB
的用法示例。
在下文中一共展示了UserDB::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckLogin
public static function CheckLogin()
{
$Username = isset($_SESSION["Username"]) ? $_SESSION["Username"] : "";
$Password = isset($_SESSION["Password"]) ? $_SESSION["Password"] : "";
if ($Username == "") {
return false;
}
if ($Password == "") {
return false;
}
$UserRecord = UserDB::get($Username);
echo "UserDBInterface:CheckLogin() -----> UserRecord : ";
//var_dump($UserRecord);
/*echo "----CheckLogin----";
echo "Username:".$Username;
echo "Password:".$Password;
echo "<br/>----->";
echo ($UserRecord["Username"]==$Username ) && ($UserRecord["Password"]=="111");
echo "-----><br/>";*/
//var_dump($UserRecord);
// echo "----CheckLogin-----";
// echo (($UserRecord["Username"]==$Username ) && ($UserRecord["Password"]=="aaa"));
// echo "--------------------";
//return true;
if ($UserRecord["Username"] === $Username && $UserRecord["Password"] === $Password) {
echo "----CheckLogin Succcess----";
echo "Username:" . $Username . "=!=" . $UserRecord["Username"] . "<br/>";
//echo "Password:".$Password."=!=".$UserRecord["Password"]."<br/>";
echo "Password: ****** =!= ****** <br/>";
//echo "<br/>----->";
//echo ($UserRecord["Username"]==$Username ) && ($UserRecord["Password"]=="111");
echo "-----><br/>";
return true;
} else {
echo "Login failed.";
echo "Username:" . $Username . "<br/>";
//echo "Password:".$Password."<br/>";
echo "Password: ****** <br/>";
return false;
}
}
示例2: alert
.done(function( msg ) {
alert(msg);
setTimeout(location.reload(),10000);
});
}
</script>
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
include_once './model/UserDBInterface.php';
if (UserDBInterface::CheckLogin()) {
$Username = isset($_SESSION["Username"]) ? $_SESSION["Username"] : "Zekom";
$UserData = UserDB::get($Username);
// var_dump($UserData);
echo "<hr/>";
echo "Uporabnik : <b>" . $UserData["Username"] . "</b><br/>";
echo "<hr/>";
echo "Ime : <b>" . $UserData["FirstName"] . "</b><br/>";
echo "Priimek : <b>" . $UserData["LastName"] . "</b><br/>";
echo "<hr/>";
echo "<p align=\"center\"><button onclick=\"onLogoutClick();\">Odjava</button></p>";
} else {
echo "<a href> Prijava v aplikacijo </a>";
}
示例3: PDO
$username = $app->request->get('username');
$invitationCode = $app->request->get('code');
if (isset($username) && isset($invitationCode)) {
$DBH = new PDO(PDO_DSN, MYSQL_USER, MYSQL_PASS);
$data = array("code" => $invitationCode);
$sth = $DBH->prepare("SELECT code FROM invitation_codes WHERE code = :code");
$sth->execute($data);
if (!empty($sth->fetch())) {
$sth = $DBH->prepare("DELETE FROM invitation_codes WHERE code = :code");
$sth->execute($data);
} else {
echo "This is not a valid registration link!";
return;
}
$userDB = new UserDB();
if (empty($userDB->get($username))) {
echo "This is not a valid registration link!";
return;
} else {
$user = new User($username);
$user->registered = true;
$user->update();
$_SESSION['AUTHED'] = true;
$_SESSION['username'] = $username;
$_SESSION['validTorrents'] = array();
$app->redirect("/");
}
} else {
echo "This is not a valid registration link!";
}
});