本文整理汇总了PHP中Utilisateur::PasswordMatches方法的典型用法代码示例。如果您正苦于以下问题:PHP Utilisateur::PasswordMatches方法的具体用法?PHP Utilisateur::PasswordMatches怎么用?PHP Utilisateur::PasswordMatches使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utilisateur
的用法示例。
在下文中一共展示了Utilisateur::PasswordMatches方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateMenu
function generateMenu()
{
$pages = simplexml_load_file("xml/pages.xml");
$page_list = $pages->page;
$languages = simplexml_load_file("xml/languagelist.xml");
$language_list = $languages->language;
echo <<<FINMENU
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">BRAND NAME</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
FINMENU;
foreach ($page_list as $page) {
if ($page->showmenu == "true") {
global $askedPage;
if ($askedPage == $page->name) {
echo "<li class=\"active\"><a href=\"/INF472WFinalProject/index.php?page={$page->name}\">{$page->menutitle}</a></li>";
} else {
echo "<li><a href=\"/INF472WFinalProject/index.php?page={$page->name}\">{$page->menutitle}</a></li>";
}
}
}
?>
<?php
require_once "utilities/userfunctions.php";
// define variables and set to empty values
$loginErr = $pwdErr = "";
$login = $pwd = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (!empty($_POST["logout"])) {
session_unset();
} else {
if (empty($_POST["pwd"])) {
$pwdErr = "Password is required";
} else {
$pwd = $_POST["pwd"];
}
if (empty($_POST["login"])) {
$loginErr = "Login is required";
} else {
$login = $_POST["login"];
$aux = Utilisateur::PasswordMatches($login, $pwd);
if ($aux == 2) {
// AUX IS CORRECT, but doesn't pop up?
$loginErr = "Login doesn't exist.";
} else {
if ($aux == 0) {
$pwdErr = "Password incorrect";
}
}
}
if ($loginErr == "" && $pwdErr == "") {
$_SESSION["loggedIn"] = $login;
//$url="?todo=$login&page=$askedPage";
//header("Location: $url");
}
}
}
if (!isset($_SESSION["loggedIn"])) {
echo <<<notIn
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true">Log In<span class="caret"></span></a>
<ul class="dropdown-menu">
<form class="form-signin" action="?page=profile" method="post">
<p><input type="text" class="form-control" placeholder="Login" name="login" id="login" required autofocus></p>
<span class="error"><?php echo .{$loginErr}.;?></span>
<p><input type="password" class="form-control" placeholder="Password" name="pwd" id="pwd" required></p>
<span class="error"><?php echo .{$pwdErr}.;?></span>
<p><input type="checkbox" name="remember" value="remember" />Remember me</p>
<p><button type="submit" class="btn btn-default" />Submit</p>
</form>
</ul>
</li>
<li><a href="/INF472WFinalProject/index.php?page=regis">Register Now! </a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
notIn;
} else {
$aux = $_SESSION['loggedIn'];
echo <<<IN
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true">Logged In<span class="caret"></span></a>
<ul class="dropdown-menu">
<form class="form-signin" action="?page=welcome" method="post">
<p>Hi {$aux} </p>
//.........这里部分代码省略.........
示例2: test_input
if (!empty($_POST["cpwd"])) {
//Confirm password not empty
$cpwdErr = "New password is required";
}
// not important if both empty: no changing password
}
if (empty($_POST["bdate"])) {
$bdateErr = "Birthdate is required";
} else {
$bdate = test_input($_POST["bdate"]);
}
if (empty($_POST["opwd"])) {
$opwdErr = "Old password required!";
} else {
//old password entered
if (!Utilisateur::PasswordMatches($login, $_POST["opwd"])) {
// but not correct
$opwdErr = "Old password doesn't match!";
} else {
//old password is correct
$opwd = $_POST["opwd"];
if (empty($_POST["pwd"]) || empty($_POST["cpwd"])) {
$pwd = $opwd;
}
}
}
if ($loginErr == "" && $nameErr == "" && $lnameErr == "" && $emailErr == "" && $opwdErr == "" && $pwdErr == "" && $cpwdErr == "" && $bdateErr == "") {
updating($login, $pwd);
echo "<script type=\"text/javascript\">";
echo "alert(\"Changes made!\");";
echo "</script>";
示例3: generateMenu
function generateMenu()
{
$pages = simplexml_load_file("xml/pages.xml");
$page_list = $pages->page;
echo <<<FINMENU
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">POLYGLOT</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
FINMENU;
foreach ($page_list as $page) {
if ($page->showmenu == "true" & $page->member != "true") {
global $askedPage;
if ($askedPage == $page->name) {
echo "<li class=\"active\"><a href=\"/INF472WFinalProject/index.php?page={$page->name}\">{$page->menutitle}</a></li>";
} else {
echo "<li><a href=\"/INF472WFinalProject/index.php?page={$page->name}\">{$page->menutitle}</a></li>";
}
}
}
// define variables and set to empty values
$loginErr = $pwdErr = "";
$login = $pwd = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (!empty($_POST["logout"])) {
session_unset();
} else {
if (empty($_POST["pwd"])) {
$pwdErr = "Password is required";
} else {
$pwd = $_POST["pwd"];
}
if (empty($_POST["login"])) {
$loginErr = "Login is required";
} else {
$login = $_POST["login"];
$aux = Utilisateur::PasswordMatches($login, $pwd);
if ($aux == 2) {
// AUX IS CORRECT, but doesn't pop up?
$loginErr = "Login doesn't exist.";
} else {
if ($aux == 0) {
$pwdErr = "Password incorrect";
}
}
//REMEMBER ME
if (isset($_POST['remember'])) {
if ($_POST['remember']) {
$year = time() + 31536000;
setcookie('remember_me', $login, $year);
} else {
if (isset($_COOKIE['remember_me'])) {
$past = time() - 100;
setcookie('remember_me', "", $past);
}
}
} else {
if (isset($_COOKIE['remember_me'])) {
$past = time() - 100;
setcookie('remember_me', "", $past);
}
}
}
if ($loginErr == "" && $pwdErr == "") {
$_SESSION["loggedIn"] = $login;
}
}
}
if (!isset($_SESSION["loggedIn"])) {
echo <<<notIn
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true">Log In<span class="caret"></span></a>
<ul class="dropdown-menu">
<form class="form-signin" action="?page=profile" method="post">
notIn;
if (isset($_COOKIE['remember_me'])) {
echo "<p><input type=\"text\" class=\"form-control\" placeholder=\"Login\" name=\"login\" id=\"login\" value = \"" . $_COOKIE['remember_me'] . "\" required autofocus></p>";
} else {
echo "<p><input type=\"text\" class=\"form-control\" placeholder=\"Login\" name=\"login\" id=\"login\" required autofocus></p>";
}
echo <<<notIn
<span class="error"><?php echo .{$loginErr}.;?></span>
<p><input type="password" class="form-control" placeholder="Password" name="pwd" id="pwd" required></p>
<span class="error"><?php echo .{$pwdErr}.;?></span>
notIn;
if (isset($_COOKIE['remember_me'])) {
echo "<p><input type=\"checkbox\" name=\"remember\" value=\"1\" checked=\"checked\"/>Remember me</p>";
} else {
echo "<p><input type=\"checkbox\" name=\"remember\" value=\"1\"/>Remember me</p>";
//.........这里部分代码省略.........