本文整理汇总了PHP中user_active函数的典型用法代码示例。如果您正苦于以下问题:PHP user_active函数的具体用法?PHP user_active怎么用?PHP user_active使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_active函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
<?php
include 'core/init.php';
$error = null;
// Ako e pristapeno so post metod, proverka na greski za username i password
if (!empty($_POST)) {
$username = $_POST['user'];
$password = $_POST['pass'];
if (empty($username) || empty($password)) {
$error = 'Потребно е да внесите корисничко име и лозинка';
} else {
if (!user_exists($username)) {
$error = 'Корисничкото име што го внесивте не постои';
} else {
if (!user_active($username)) {
$error = 'Потрено е да ја активирате вашата корисничка сметка';
} else {
$login = login($username, $password);
if (!$login) {
$error = 'Корисничкото име или лозинката се погрешни';
}
}
}
}
}
// Ako error e null togas znaci deka ili korisnikot ne pristapil so post metod i ke bidi vraten na prethodnata strana,
// ili deka korisnikot se logiral uspesno i ke bidi startuvana sesija
if (!is_null($error)) {
$_SESSION['error'] = $error;
$_SESSION['user_value'] = $username;
// Ako ima greska da se zapamti to so go zapisal userot za da ne go pisi pak
示例2: array
$config['db'] = array('host' => 'localhost', 'username' => 'root', 'password' => '', 'dbname' => 'medium');
try {
$db = new PDO('mysql:host=' . $config['db']['host'] . ';dbname=' . $config['db']['dbname'], $config['db']['username'], $config['db']['password']);
} catch (PDOException $e) {
echo $e->getMessage();
}
require 'functions/general.php';
require 'functions/users.php';
require 'functions/posthandler.php';
// echo $current_file = basename(__FILE__);
$current_file = explode('/', $_SERVER['SCRIPT_NAME']);
$current_file = end($current_file);
// print_r($current_file);
if (logged_in() === true) {
$session_user_id = $_SESSION['user_id'];
$user_data = user_data($session_user_id, 'user_id', 'username', 'password', 'first_name', 'last_name', 'email', 'password_recover', 'type', 'allow_email', 'profile');
// echo $user_data['username'];
if (user_active($user_data['username']) === false) {
session_destroy();
header('Location: index.php');
exit;
}
if ($current_file !== 'changepassword.php' && $user_data['password_recover'] == 1) {
header('Location: changepassword.php?force');
exit;
}
} else {
$session_user_id = 0;
}
// echo $user_data['type'];
$errors = array();
示例3: session_start
<?php
session_start();
//error_reporting(0);
require_once 'config.php';
require_once 'includes/functions/general.php';
if (logged_in() === true) {
if (user_active($_SESSION['user_username'], $conn) === false) {
session_destroy();
header('Location: index.php');
exit;
}
}
示例4: array
<?php
include "include/overall/header.php";
include "core/init.php";
if (empty($_POST) === false) {
$name = $_POST['name'];
$password = $_POST['password'];
$errors = array();
if (empty($name) === true || empty($password) === true) {
$errors[] = "You need to enter a name and password";
} else {
if (user_exists($name) === false) {
$errors[] = "We can't find that name. Have you registered?";
} else {
if (user_active($name) === false) {
$errors[] = "You haven't activated your account!";
} else {
$login = login($name, $password);
if ($login === false) {
$errors[] = "That Name and Password combination is incorrect";
} else {
$_SESSION['ID'] = $login;
$_SESSION['name'] = $name;
$userNameCookie = "name";
$passwordCookie = "password";
setcookie($userNameCookie, $name, time() + 604800 * 30);
setcookie($passwordCookie, $password, time() + 604800 * 30);
header('Location: index.php');
exit;
}
}
示例5: add_header
add_header("New Item");
if (!$conn) {
echo "Could not establish connection to database.";
exit;
}
if (isset($_SESSION['valid_user'])) {
$sql = " SELECT email, active FROM users WHERE email = '" . $_SESSION['valid_user'] . "'";
$result = $conn->query($sql);
if (!$result) {
echo "connection to the database couldn't be establish";
exit;
}
while ($row = $result->fetch_assoc()) {
extract($row);
if ($active == 0) {
user_active();
break;
}
}
@($user = addslashes($_GET['user']));
@($list_id = addslashes($_GET['list_id']));
@($description = addslashes($_GET['description']));
@($date = date("m-d-Y"));
if (isset($_POST['submit'])) {
$name = addslashes(trim($_POST['name']));
$content = addslashes(trim($_POST['content']));
$date = addslashes(trim($_POST['date']));
$completed = $_POST['completed'];
$query = "\n INSERT INTO todolist_items(name,content,item_id,date,completed)VALUES(?,?,?,?,?)\n ";
$result = $conn->prepare($query);
$result->bind_param("ssiss", $name, $content, $date, $completed);
示例6: login
include 'core/init.php';
?>
<?php
if (empty($_POST) === false) {
$email = $_POST['email'];
$password = $_POST['password'];
//Check if user exists
if (empty($email) === true || empty($password) === true) {
$errors[] = 'You need to enter a email and password';
} else {
if (user_exists($email) === false) {
$errors[] = 'We cannot find that email. Have you registered?';
} else {
if (user_active($email) === false) {
$errors[] = 'You haven\'t activated your account';
} else {
// Trying to get multiple things into the errors array to display
if (strlen($password) > 32) {
$errors[] = "Password is too long";
}
// Try logging in user
$login = login($email, $password);
if ($login === false) {
$errors[] = 'That email and password combination is incorrect';
} else {
echo 'goody';
// set user session
$_SESSION['user_id'] = $login;
// redirect user home
示例7: header
<li><a href="blog.php">blog</a></li>
<li><a href="index.php#contact">contact</a></li>
<li><a href="includes/logout.php">log out</a></li>
<li><a href="login.php">profile settings</a></li>
<li><a href="../ro/login.php">ro</a></li>
</ul>
<div id="logo"><a href="index.php"><img src="img/provisory-logo.gif"></a></div>
</nav>';
echo '<h3 class="delete_success">User deleted successfully!</h3>';
echo '<a href="admin.php" class="email_success_a">Go back to the admin page</a>';
} else {
if (empty($_POST) === false) {
if (user_exists($_POST['username']) === false) {
$errors[] = 'Username does not exist';
} else {
if (user_active($_POST['username']) === true) {
$errors[] = 'That user is active';
}
}
}
if (empty($_POST) === false && empty($errors) === true) {
delete_inactive_user($_POST['username']);
header('Location: delete_users.php?success');
exit;
} else {
if (empty($errors) === false) {
echo output_errors($errors);
}
}
?>
示例8: logged_in_redirect
logged_in_redirect();
// test:
//if (user_exists('foo')) {
// echo 'exists';
//}
//die();
if (empty($_POST) === false) {
$username = $_POST['username'];
$password = $_POST['password'];
if (empty($username) === true || empty($password) === true) {
$errors[] = 'You need to enter a username and password';
} else {
if (user_exists($username) == 0) {
$errors[] = 'We can\'t find that username. Have you registered?';
} else {
if (user_active($username) == 0) {
$errors[] = 'You haven\'t activated your account;';
} else {
if (strlen($password) > 32) {
$errors[] = 'Password too long';
}
$login = login($username, $password);
if ($login === false) {
$errors[] = 'That username/password combination is incorrect';
} else {
// set the user session
$_SESSION['user_id'] = $login;
// redirect user to home
header('Location: index.php');
exit;
}
示例9: elseif
<?php
include 'core/init.php';
if (empty($_POST) === false) {
$username = $_POST['username'];
$password = $_POST['password'];
if (empty($username) === true || empty($password) === true) {
$errors[] = 'You need to enter a username and password';
} elseif (user_exists($username) === false) {
$errors[] = 'We can\'t find that username. Have you registered?';
} elseif (user_active($username) === false) {
$errors[] = 'You haven\'t activated your account.';
} else {
if (strlen($password) > 32) {
$errors[] = 'Password too long.';
}
$login = login($username, $password);
if ($login === false) {
$errors[] = 'The username/password is incorrect.';
} else {
// set the user session
$_SESSION['user_id'] = $login;
//redirect user to home
header('Location: index.php');
exit;
}
}
} else {
$errors[] = 'No data received.';
}
include 'includes/overall/header.php';
示例10: session_start
<?php
session_start();
//error_reporting(0);
require 'database/connect.php';
require 'functions/general.php';
require 'functions/users.php';
if (logged_in()) {
$session_serial = $_SESSION['serial'];
$user_data = user_data($session_serial, 'serial', 'name', 'email', 'user_name', 'password', 'school', 'level');
if (!user_active($user_data['user_name'])) {
session_destroy();
header("Location: index.php");
}
}
$errors = array();
示例11: header
<li><a href="blog.php">blog</a></li>
<li><a href="index.php#contact">contact</a></li>
<li><a href="includes/logout.php">delogare</a></li>
<li><a href="login.php">setari profil</a></li>
<li><a href="../en/login.php">en</a></li>
</ul>
<div id="logo"><a href="index.php"><img src="img/provisory-logo.gif"></a></div>
</nav>';
echo '<h3 class="delete_success">Utilizatorul a fost sters cu succes!</h3>';
echo '<a href="admin.php" class="email_success_a">Inapoi la pagina de admin</a>';
} else {
if (empty($_POST) === false) {
if (user_exists($_POST['username']) === false) {
$errors[] = 'Utilizatorul nu exista.';
} else {
if (user_active($_POST['username']) === false) {
$errors[] = 'Acel utilizator nu este activ';
}
}
}
if (empty($_POST) === false && empty($errors) === true) {
delete_user($_POST['username']);
header('Location: delete_users.php?success');
exit;
} else {
if (empty($errors) === false) {
echo output_errors($errors);
}
}
?>
示例12: mysql_real_escape_string
<?php
//require_once '../../core/init.php'; //not use for this action without jquery
// Login Script (function use from user.php)
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$username = mysql_real_escape_string(htmlentities(input_validation($_POST['username'])));
//@$pin = mysql_real_escape_string(htmlentities(input_validation($_POST['pin'])));
$password = mysql_real_escape_string(htmlentities(input_validation($_POST['password'])));
$password_md5 = md5($password);
@($remember_me = mysql_real_escape_string(htmlentities(input_validation($_POST['remember_me']))));
if (!empty($username) && !empty($password)) {
if (user_exists($con, $username) === false) {
//$con is PDO connection variable
$errors[] = 'We can\'t find your Username';
} elseif (user_active($con, $username, $password_md5) === false) {
//echo 'You haven\'t activated your account.';
$errors[] = 'Your account isn\'t active. Please contact with administrator.';
} elseif (user_lock($con, $username, $password_md5) === false) {
//echo 'You account is Locked, Please contact with admin.';
$errors[] = 'You account is Locked, Please contact with administrator.';
} else {
$login = login($con, $username, $password_md5);
if ($login === false) {
//if login return false
//echo 'Your Username / Password combination is incorrect.';
$errors[] = 'Your Username / Password combination is incorrect.';
} else {
$_SESSION['user_id'] = $login;
session_regenerate_id();
//creates a new unique-ID for to represent the current user’s session.
//for login user log;
示例13: session_start
<?php
session_start();
error_reporting(0);
require 'database/connect.php';
require 'functions/general.php';
require 'functions/users.php';
$current_file = explode('/', $_SERVER['SCRIPT_NAME']);
$current_file = end($current_file);
if (logged_in() === true) {
$session_user_id = $_SESSION['user_id'];
$user_data = user_data($_SESSION['user_id'], 'user_id', 'first_name', 'middle_name', 'last_name', 'email', 'phone', 'dob', 'sex', 'dept_name', 'deptrn', 'uuregno', 'address', 'password', 'password_recover');
$edu_data = edu_data($_SESSION['user_id'], 'x_board', 'x_pass', 'x_percent', 'xii_branch', 'xii_stream', 'xii_pass', 'xii_percent', 'grdu_university', 'grdu_course', 'grdu_join', 'grdu_pass', 'grdu_percent', 'pg_course', 'pg_join', 'pg_pass', 'pg_percent');
if (user_active($user_data['email']) === false) {
session_destroy();
header('Location: index.php');
exit;
}
if ($current_file !== 'changepassword.php' && $user_data['password_recover'] == 1) {
header('Location: changepassword.php?force');
exit;
}
}
$errors = array();
示例14: test_input
<?php
include "../init.php";
$loginError = "";
$username = $password = "";
$username = test_input($_POST["username"]);
$password = test_input($_POST["password"]);
if (empty($username) === true || empty($password) === true) {
$loginError = 'Ievadiet lietotājvārdu un paroli';
} else {
if (username_exists($username, $conn) === false) {
$loginError = 'Lietotājvārds netika atrasts';
} else {
if (user_active($username, $conn) === false) {
$loginError = 'Apstipriniet savu e-pasu';
} else {
$login = login($username, $password, $conn);
if ($login === false) {
$loginError = 'Nepareiza parole';
} else {
$_SESSION['user_id'] = $login;
if (logged_in() === true) {
$_SESSION['user_username'] = fetch_value('username', 'users', 'user_id', $_SESSION['user_id'], $conn);
$_SESSION['user_email'] = fetch_value('email', 'users', 'user_id', $_SESSION['user_id'], $conn);
}
exit;
}
}
}
}
echo $loginError;