本文整理汇总了PHP中validateUser函数的典型用法代码示例。如果您正苦于以下问题:PHP validateUser函数的具体用法?PHP validateUser怎么用?PHP validateUser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了validateUser函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: protectPage
function protectPage()
{
if (!isset($_SESSION['userId']) or !isset($_SESSION['userName'])) {
getOut();
} elseif (!validateUser($_SESSION['userLogin'], $_SESSION['userPassword'])) {
getOut();
}
}
开发者ID:caiodavinis,项目名称:dvinesweb,代码行数:8,代码来源:class.Security.php
示例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);
});
}
开发者ID:jan-berge-ommedal,项目名称:Thin-PHP-Backend,代码行数:9,代码来源:api.php
示例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';
}
}
}
开发者ID:kubar123,项目名称:diploma,代码行数:17,代码来源:login_functions.php
示例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;
}
开发者ID:stuartflgray,项目名称:HouseMD,代码行数:19,代码来源:login_functions.php
示例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';
开发者ID:javelinorg,项目名称:Postgres_XL_Dashboard,代码行数:31,代码来源:login.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;
}
开发者ID:stamlercas,项目名称:csa,代码行数:10,代码来源:model.php
示例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" />
开发者ID:hoiwanjohnlouis,项目名称:eclipsePrototyping,代码行数:31,代码来源:login.php
示例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']));
}
开发者ID:runnaway90,项目名称:Clearview,代码行数:31,代码来源:login_box.php
示例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") {
开发者ID:anudeep3998,项目名称:uds,代码行数:31,代码来源:getStandards.php
示例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"));
开发者ID:nikobm90,项目名称:TurnosAutos,代码行数:31,代码来源:api.php
示例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 {
开发者ID:acgerstein,项目名称:ymap,代码行数:31,代码来源:login_server.php
示例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);
开发者ID:Richardo92,项目名称:CS2300-Intemediate-Design-and-Programming-for-the-Web,代码行数:31,代码来源:index.php
示例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";
}
}
开发者ID:borisper1,项目名称:vesi-cms,代码行数:18,代码来源:notes-engine.php
示例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";
开发者ID:billtucker,项目名称:onweb,代码行数:31,代码来源:request.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']);
开发者ID:billtucker,项目名称:onweb,代码行数:31,代码来源:spotViewerResponse.php
示例16: getOption
$slogan = getOption($db, 'slogan');
$scripts = getJs($allScripts, ['liveChange' => 1, 'maps' => 1, 'search' => 1], true);
$categories = getAllCategories($db);
// controller
require_once APP_PATH . 'control/searchController.php';
// view zusammenbauen
$sidebar = APP_PATH . 'view/template/searchSidebar.php';
require_once APP_PATH . 'view/template/header.php';
require_once APP_PATH . 'view/site/search.php';
require_once APP_PATH . 'view/template/footer.php';
break;
case 'validation':
$token = $_GET['do'];
if (strlen($token) === 128) {
require_once APP_PATH . 'model/validateUser.php';
if (validateUser($db, $token)) {
$_SESSION['validation'] = 'Sie haben Ihre E-Mail Adresse erfolgreich bestätigt.';
$_SESSION['valstatus'] = 1;
$_SESSION['user_status'] = 'confirmed';
} else {
$_SESSION['validation'] = 'Sie haben versucht Ihre E-Mail Adresse zu bestätigen. Leider ist die Überprüfung fehlgeschlagen. Wenn Sie eigenes Verschulden ausschließen können, melden Sie sich bitte per E-Mail bei uns.';
$_SESSION['valstatus'] = 0;
}
header('Location: /haendlerkonto');
} else {
header('Location: /fehler');
}
break;
case 'fehler':
require_once APP_PATH . 'model/getJs.php';
require_once APP_PATH . 'model/getAllCategories.php';
开发者ID:bassels,项目名称:moebel-mafia,代码行数:31,代码来源:indexController.php
示例17: error_reporting
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
session_start();
require_once "../includes/config.php";
require_once "../includes/connect.php";
require_once "helpers.php";
$username = $_POST['username'];
$password = $_POST['password'];
//connect to the database here
$st = $db->prepare("SELECT password, salt FROM users WHERE username = :username");
$st->execute(array('username' => $username));
if ($st->rowCount() < 1) {
header('Location: ../../frontend/');
die;
}
$userData = $st->fetchAll();
$userData = $userData[0];
$hash = hash('sha256', $userData['salt'] . hash('sha256', $password));
if ($hash != $userData['password']) {
header('Location: ../../frontend/');
die;
} else {
validateUser($userData['username']);
//sets the session data for this user
}
//redirect to another page or display "login success" message
header('Location: ../../frontend/');
开发者ID:rquiring,项目名称:klipsmobile,代码行数:29,代码来源:login.php
示例18: explode
if (!empty($altinfo) && !isset($_SERVER['PHP_AUTH_USER'])) {
$val = $altinfo;
$pieces = explode(' ', $val);
// bad.
if ($pieces[0] == 'Basic') {
$chunk = $pieces[1];
$decoded = base64_decode($chunk);
$credential_info = explode(':', $decoded);
if (count($credential_info) == 2) {
$_SERVER['PHP_AUTH_USER'] = $credential_info[0];
$_SERVER['PHP_AUTH_PW'] = $credential_info[1];
$_SERVER["AUTH_TYPE"] = 'Basic';
}
}
}
if (!validateUser($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) {
header('WWW-Authenticate: Basic realm="KnowledgeTree DMS"');
header('HTTP/1.0 401 Unauthorized');
echo 'This RSS feed requires authentication. Please enter your username and password.';
exit;
} else {
$user = DBAuthenticator::getUser($_SERVER['PHP_AUTH_USER'], array('id' => 'id'));
$id = $user[$_SERVER['PHP_AUTH_USER']]['id'];
if (OS_WINDOWS) {
$sReferrer = $_SERVER['HTTP_USER_AGENT'];
// Check if this is IE 6
if (strstr($sReferrer, 'MSIE 6.0')) {
header('Content-Type: application/rss+xml; charset=utf-8;');
header('Content-Disposition: inline; filename="rss.xml"');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
开发者ID:5haman,项目名称:knowledgetree,代码行数:31,代码来源:rss.php
示例19: header
<?php
require '../functions.inc.php';
if ($_POST['submit']) {
// if they are the master, redirect them to the create new calendar page
if ($_POST['login'] == 'master') {
header('Location: ./new_calendar.php');
} else {
if ($calendar = validateUser($_POST['login'], $_POST['password'])) {
echo "login success";
echo '<p><a href="../?cal=' . $calendar . '&admin=weak">cool</a></p>';
// this is a lazy hack here.
exit;
//header('Location: ./?cal=$calendar&admin=weak');
}
}
// if they have hit here something must have gone wrong. tell them that.
$message = "something went wrong. try again.";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>CS Office Hours - Admin</title>
<link rel="stylesheet" type="text/css" href="../style.css" />
</head>
<body>
<?php
echo "<h2>May the 4th be with you</h2>";
开发者ID:BGCX261,项目名称:zona-cal-svn-to-git,代码行数:31,代码来源:index.php
示例20: isset
<?php
include "class/class.Security.php";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$userLogin = isset($_POST['userLogin']) ? $_POST['userLogin'] : '';
$userPassword = isset($_POST['userPassword']) ? $_POST['userPassword'] : '';
$userPassword = md5($userPassword);
$date = date("d/m/Y");
$hour = date("H:i");
if (validateUser($userLogin, $userPassword) == true) {
$query = mysql_query("SELECT `userChangePassword` FROM users WHERE `userLogin` = '" . $userLogin . "' AND `userPassword` = '" . $userPassword . "'");
$changePassword = mysql_fetch_assoc($query);
if ($changePassword['userChangePassword'] == 1) {
header("Location: ../login.php?action=changePassword");
exit;
} else {
$query = mysql_query("INSERT INTO login_log (`loginLogUser`, `loginLogDate`, `loginLogHour`) VALUES ('{$userLogin}', '{$date}', '{$hour}')");
header("Location: ../index.php");
exit;
}
} else {
unset($_SESSION['userId'], $_SESSION['userName'], $_SESSION['userLogin'], $_SESSION['userPassword']);
header("Location: ../login.php?error=1");
exit;
}
}
开发者ID:caiodavinis,项目名称:dvinesweb,代码行数:26,代码来源:validate.php
注:本文中的validateUser函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论