本文整理汇总了PHP中validateUser函数的典型用法代码示例。如果您正苦于以下问题:PHP validateUser函数的具体用法?PHP validateUser怎么用?PHP validateUser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了validateUser函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: protectPage
function protectPage()
{
if (!isset($_SESSION['userId']) or !isset($_SESSION['userName'])) {
getOut();
} elseif (!validateUser($_SESSION['userLogin'], $_SESSION['userPassword'])) {
getOut();
}
}
示例2: performDelete
function performDelete()
{
validateUser();
withStatement("DELETE FROM DATA WHERE id=?", function ($statement) {
$id = getParameter(PARAMETER_ID, PARAMETER_REQUIRED);
$statement->bind_param("s", $id);
executeStatement($statement);
});
}
示例3: authenticate_user
function authenticate_user($username, $password)
{
//Returns whether the account is valid or not
$validated = validateUser($username, $password);
// This means the entered details have been validated and are correct
if ($validated == 1) {
$returned_values = give_key($username);
// Debug by checking whats been returned print_r($returned_values);
return $returned_values;
} else {
if ($validated == 2) {
return "Your username or password may have been incorrect!";
} else {
return 'This account does not exists';
}
}
}
示例4: isLoggedIn
function isLoggedIn($dbHandle, $dbHost, $dbUser, $dbPass, $dbName)
{
$dbHandle = dbConnect($dbHandle, $dbHost, $dbUser, $dbPass, $dbName);
if ($_SESSION['valid']) {
return true;
} else {
if (checkCookie($dbHandle, $dbHost, $dbUser, $dbPass, $dbName)) {
validateUser(true);
//Set user info in session
$_SESSION['user_id'] = $_COOKIE['user_id'];
$userInfo = getUserInfo($dbHandle, $_COOKIE['user_id']);
$_SESSION['username'] = $userInfo['username'];
$_SESSION['imageUrl'] = $userInfo['image_url'];
$_SESSION['accLevel'] = $userInfo['acc_level'];
return true;
}
}
return false;
}
示例5: unset
<?php
include 'include_config.php';
if (isset($_GET['r']) || isset($_SESSION['ERROR'])) {
$strInfo = $_SESSION['ERROR'];
unset($_SESSION['ERROR']);
}
if (isset($_GET['r'])) {
if ($_GET['r'] == 'req') {
$strWarning = 'Login required to access ' . SITE_TITLE;
}
}
if (isset($_POST['txtUser']) && isset($_POST['txtPassword'])) {
$strResponse = validateUser($_POST['txtUser'], $_POST['txtPassword']);
if ($strResponse != '1') {
$strError = 'Odd. For some reason I had a difficult time validating your login.<br>Please try again, and good luck!';
} else {
$strSuccess = 'Congrats, you\'ve been authenticated!<br>What would you like to do today?';
if (isset($_SESSION['REQUEST_URI']) && $_SESSION['REQUEST_URI'] != '') {
header("Location: http://" . $_SERVER['HTTP_HOST'] . $_SESSION['REQUEST_URI']);
} else {
header("Location: http://" . $_SERVER['HTTP_HOST']);
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php
include 'include_head.php';
示例6: login
function login($username, $password)
{
$result = validateUser($username, $password);
if ($result['UserName'] === $username) {
$_SESSION["UserName"] = $result['UserName'];
$_SESSION["UserID"] = $result['UserID'];
return true;
}
return false;
}
示例7: session_start
<?php
session_start();
if (isset($_SESSION['username'])) {
header('Location: profile.php');
}
if(strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
$username = isset($_POST['username']) ? $_POST['username'] : null;
$password = isset($_POST['password']) ? $_POST['password'] : null;
$user = getUser($username);
if ($user && validateUser($user, $password)) {
$_SESSION['username'] = $username;
setcookie('firstName', $user['firstName'], time() + 60*60);
setcookie('lastName', $user['lastName'], time() + 60*60);
header('Location: profile.php');
} else {
$error = 'Could not log user in';
}
}
?>
<? if(isset($error)) { ?>
<p><?= $error ?></p>
<? } ?>
<form action="<?= $_SERVER['PHP_SELF'] ?>" method="post">
<input type="text" name="username" />
<input type="password" name="password" />
<input type="submit" value="Submit" />
示例8: mysql_fetch_array
$userData = mysql_fetch_array($result, MYSQL_ASSOC);
$userData2 = mysql_fetch_array($result2, MYSQL_ASSOC);
$hash = hash('sha256', $userData['salt'] . hash('sha256', $password));
$hash2 = hash('sha256', $userData2['salt'] . hash('sha256', $password));
//check if passwords match
if ($hash != $userData['password'] && $hash2 != $userData2['password']) {
$passwords_match = FALSE;
} else {
if ($hash == $userData2['password']) {
$username = $userData2['username'];
}
}
if ($username_not_empty == TRUE && $username_valid == TRUE && $password_not_empty == TRUE && $passwords_match == TRUE) {
$_SESSION['username'] = $username;
$md5pass = md5($hash);
validateUser();
//sets the session data for this user
// set user level
$query = "SELECT membership_status_id\n FROM {$usertable}\n WHERE username = '{$username}';";
$result = mysql_query($query);
$result_arr = mysql_fetch_array($result);
$_SESSION['userlevel'] = $result_arr[0];
$isAdmin = $result_arr[0] == $mem_status_admin;
//set remember me cookie for 30 days
if (isset($_POST["remember"])) {
setcookie("clearview_user", $_SESSION['username'], time() + 60 * 60 * 24 * 30, "/");
setcookie("clearview_pass", "{$md5pass}", time() + 60 * 60 * 24 * 30, "/");
}
}
header('Location: ' . htmlentities($_SERVER['PHP_SELF']));
}
示例9: json_decode
$ret = json_decode($ret);
$ret->mail = false;
if ($ret->response) {
$ret->mail = Util::send_mail($data['email_id'], "Registration Confirmation", "Thank you for registering with the isUD website. Please login to visit the inclusive design solutions.");
}
} else {
$ret->response = false;
$ret->message = "Recaptcha verification failed.";
}
//$ret->m = $captchaResponse['challenge_ts']." ".$captchaResponse['success'];
print json_encode($ret);
}
if ($columns === "LOGIN") {
$username = $_POST['username'];
$password = $_POST['password'];
print validateUser($username, $password);
}
if ($columns === "EDIT_PROFILE_RETRIEVE") {
$ret["response"] = isLoggedIn();
$ret["data"] = getPublicUserData($_SESSION["user"]);
print json_encode($ret);
}
if ($columns === "EDIT_PROFILE_SAVE") {
$data = json_decode(stripslashes($_POST['data']), true);
$ret = UpdateUser($data['email_id'], $data['password'], $data['first_name'], $data['middle_name'], $data['last_name'], $data['organization_id'], $data['authtype_id'], $data['securityquestion_id'], $data['securityquestion_ans'], $data['phone'], $data['country_name'], $data['country_code']);
print $ret;
}
if ($columns === "LOGOUT") {
logoutUser();
}
if ($columns === "RESET_PASSWORD_PREP") {
示例10: Usuario
require "../models/usuarios.php";
$user = new Usuario();
if ($cantidad = $user->getCantidad()) {
sendRensponse(array("error" => false, "mensaje" => "", "data" => $cantidad));
} else {
sendRensponse(array("error" => true, "mensaje" => "¡Error al obtener cantidad de Usuarios!"));
}
}
$request = new Request();
$action = $request->action;
switch ($action) {
case "nuevoUser":
nuevoUser($request);
break;
case "validar":
validateUser($request);
break;
case "validarMail":
validateMail($request);
break;
case "validarUserName":
validateUserName($request);
break;
case "obtener":
getUser($request);
break;
case "obtenerCantidad":
getCantidad($request);
break;
default:
sendRensponse(array("error" => "true", "mensaje" => "request mal formado"));
示例11: session_start
<?php
session_start();
error_reporting(E_ALL);
require_once 'constants.php';
ini_set('display_errors', 1);
$user_in = filter_input(INPUT_POST, "user", FILTER_SANITIZE_STRING);
$pw_in = filter_input(INPUT_POST, "pw", FILTER_SANITIZE_STRING);
$user = validateUser($user_in);
$pw = validatePassword($pw_in);
validateLogin($user, $pw);
//=========================================================
// Functions used to validate login credentials.
//---------------------------------------------------------
function validateLogin($user, $pw)
{
global $url;
if (doesUserDirectoryExist($user)) {
// User Exists
$pwFile = $GLOBALS['directory'] . "users/" . $user . "/pw.txt";
if (file_get_contents($pwFile) === $pw) {
$_SESSION['logged_on'] = 1;
$_SESSION['user'] = $user;
header('Location: ' . $GLOBALS['url']);
} else {
echo "<font color=\"red\"><b>ERROR: Input did not match a registed username & password combination.</b></font><br>";
echo "(Main page will reload shortly...)\n";
echo "<script type=\"text/javascript\">\nreload_page=function() {\n\tlocation.replace(\"{$url}\");\n}\n";
echo "var intervalID = window.setInterval(reload_page, 5000);\n</script>\n";
}
} else {
示例12: openFile
<h1>My Cart</h1>
<table border="1" style="width: 46%">
<thead style="height:50px">
<th style="width:200px">Company Name</th>
<th style="width:150px">Job ID</th>
<th style="width:200px">Location</th>
<th style="width:150px">Salary</th>
</thead>
<tbody id="cartBody">
<?php
if (isset($_POST["login"])) {
$username = $_POST["username"];
$password = $_POST["password"];
$file_open = openFile("usr.txt", 'r');
if (!validateUser($file_open, $username, $password)) {
echo "<script> alert('Failed to login. Invalid username or password'); </script>";
exit;
}
$file_usr = openFile("usr_cart/usr_{$username}.txt", 'r');
$user_jobs = readFileFromData($file_usr);
drawTableWithoutAdd($user_jobs);
$file_pointer = openFile('status.txt', 'w+');
$line = trim("true") . "\n";
$line = $line . trim($username);
writeFileFromBegin($file_pointer, $line);
} else {
if (isset($_POST["register"])) {
$username = $_POST["username"];
$password = $_POST["password"];
$username = trim($username);
示例13: editFolder
function editFolder($name, $id)
{
global $connection;
$name = $connection->escape_string($name);
$request = "SELECT * FROM notes_vfs WHERE id = '{$id}'";
$result = $connection->query($request);
$line = $result->fetch_assoc();
//Permission check (frontend based on js: VERY WEAK)
$permissions = validatePermissions(validateUser());
if ($permissions == $line["container"] || ($permissions = "all")) {
$request = "UPDATE notes_vfs SET name='{$name}' WHERE id = '{$id}'";
$connection->query($request);
echo $connection->error;
echo "success";
} else {
echo "403: Not authorized";
}
}
示例14: urlencode
include_once "request-config.php";
include_once $requestService . 'displayLinkWithJavaScript.php';
//validate user prior to access on this page
include_once "{$validation}" . "user_validation.php";
include_once $utilities . "utility.php";
$pageUrl = urlencode($port . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}");
$validateUser = true;
$canModify = false;
if (isset($_GET['p1']) && validatePassThrough($_GET['p1'])) {
$validateUser = false;
$log->debug("request.php - Print operation invoked and login is being bypassed");
}
if ($validateUser) {
$log->debug("Now validate if Plugin: (" . $onRequestPlugin . ") is installed");
//validate user then check if plugin license if active to access on this page
validateUser($site_prefix, $pageUrl, $siteSection, $onRequestModify, $onRequestPlugin);
$canModify = userCanModifyRequest($okModify);
}
//User is now validated so lets start the $_SESSION[] to use the properties on this page
//depending onm the user path through the system we need to ensure that the session was started
if (!session_id()) {
session_start();
}
$log->debug("Start including constants, request connection, and other files");
include_once $requestInclude . 'constants.php';
include_once $requestInclude . 'requestConnection.php';
include_once $requestService . 'requestFieldBuilder.php';
include_once $utilities . 'utility.php';
include_once $errors . 'errorProcessing.php';
include_once $fmfiles . "order.db.php";
include_once $requestService . "loadRequestSessionData.php";
示例15: processError
$messageType = "d";
$errorTitle = "Serious Error";
$log->error("Serious Error: PK Missing at save time User " . $_SESSION['userName']);
$message = "A serious error has occurred and you should immediately contact Thought-Development Support for assistance.";
processError("Missing Primary Key", $message, "spotViewerResponse.php", "", $errorTitle);
exit;
}
if (!session_id()) {
session_start();
}
//reset the session timeout before saving the data. This will avoid data loss due to session timeout
resetSessionTimeout();
//validate the user prior to save operation do avoid anyone attempting to load data to database without using the form
//if this user was not logged in at save time the redirect them to index page.
$pageUrl = $site_prefix . "/onspot/index.php";
validateUser($site_prefix, $pageUrl, $siteSection, $onSpotView, $OnSpotPluginToValidate);
//Globals used by process notes or approval block information
$spotViewerLayout = "[WEB] cwp_spotviewer_browse";
$userNotesLayout = "[WEB] UserNotes";
$noteType = "Approval Notes";
//Process the Approval information only as a user selected a Approval Radio button
//Since the calling page is now a dual form this code accepts a click event occurred so the data should be
// persisted to FileMaker for each section
if (isset($_POST['userApprover'])) {
$log->debug("Processing approver selection");
$spotViewerFind = $fmWorkDB->newFindCommand($spotViewerLayout);
$spotViewerFind->addFindCriterion('__pk_ID', '==' . $pkId);
$spotResult = $spotViewerFind->execute();
if (FileMaker::isError($spotResult)) {
$errorTitle = "FileMaker Error";
$log->error("Search of Spot Viewer record failed on PKID: " . $pkId . " Error: " . $spotResult->getMessage() . " User: " . $_SESSION['userName']);