本文整理匯總了PHP中newUser函數的典型用法代碼示例。如果您正苦於以下問題:PHP newUser函數的具體用法?PHP newUser怎麽用?PHP newUser使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了newUser函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loginAsNormalUser
protected function loginAsNormalUser()
{
$un = 'user-' . uniqid();
$u = newUser($email = $un . '@example.com', $username = $un, $password = 'abc123');
$this->login($un, $password);
$this->user = $u;
return $u;
}
示例2: getUser
function getUser($email = 'joe@test.net')
{
if (DB\countRows('users', "email = ?", array($email)) == 0) {
return newUser($email, 'big-joe-' . time(), 'something');
} else {
return User::loadFromEmailAddr($email);
}
}
示例3: testOneEmailAddressMayNotBeAssociatedWithMultipleAccounts
function testOneEmailAddressMayNotBeAssociatedWithMultipleAccounts()
{
newUser($email = 'josh@example.com', $username = 'joshers', $password = 'abc123');
$this->get('/account/signup');
$this->submitFormExpectingErrors($this->getForm(), array('username' => 'bigkid', 'email' => 'josh@example.com', 'password1' => 't0pS33cret', 'password2' => 't0pS33cret'));
$this->assertContains("//div[contains(., 'already have an account')]");
assertEqual(1, DB\countRows('users', 'email = ?', array('josh@example.com')));
}
示例4: testUsersOverviewScreen
function testUsersOverviewScreen()
{
newUser('some-user@example.com', 'some-user', 'abc');
$u2 = newUser('other-user@example.com', 'other-user', 'def');
DB\updateByID('users', $u2->id, array('created_at' => new \DateTime('now')));
newUser('chris@easyweaze.net', 'chris', 'secret!');
$this->login('chris', 'secret!');
$this->get('/admin/users/');
}
示例5: testUpdatePassword
function testUpdatePassword()
{
clearDB();
$u1 = newUser('a@test.org', 'a', 'mysecretpass');
$u2 = newUser('b@test.org', 'b', 'sumthingsecret');
$u1->updatePassword('newpass');
$rows = DB\selectAllRows('users');
assertNotEqual($rows[0]['password'], $rows[1]['password']);
}
示例6: signUp
function signUp($db)
{
if (!empty($_POST['username'])) {
$myusername = mysqli_real_escape_string($db, $_POST['username']);
$mypassword = mysqli_real_escape_string($db, $_POST['password']);
$sql = "SELECT user_id FROM user WHERE username = '{$myusername}' and password = '{$mypassword}'";
$result = mysqli_query($db, $sql);
if (!$result) {
die('Invalid query: ' . mysqli_error($db));
}
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
$count = mysqli_num_rows($result);
if ($count == 1) {
echo "Sorry you are already a registered user";
echo "</br></br>This page will redirect in 5 seconds";
header("refresh:5;url=../views/register-form.php");
} else {
newUser($db);
}
}
}
示例7: get_client_ip
<?php
include './functions/user_logic.php';
include './functions/photo_logic.php';
$ip = get_client_ip();
$nick = $_POST['nick'];
$password = $_POST['password'];
$email = $_POST['email'];
$name = $_POST['name'];
$surname = $_POST['surname'];
$age = $_POST['age'];
$gender = $_POST['gender'];
$avatar = $_FILES['avatar'];
if (newUser($ip, $nick, $password, $email, $name, $surname, $age, $gender)) {
echo "Usuario registrado.<br/>";
$path = "data/user.png";
if (isset($_FILES['avatar'])) {
if (acceptImage($avatar)) {
echo "Imagen aceptada.<br/>";
$path = "data/" . $nick;
if (!file_exists("../" . $path) and !is_dir("../" . $path)) {
mkdir("../" . $path, 0777, true);
// 0777 default for folder, rather than 0755
}
$path = $path . "/" . $avatar["name"];
$error = uploadPhoto($ip, $avatar, $nick, $email, $path, "Fotos de Perfil");
if ($error != '0') {
$path = "data/user.png";
switch ($error) {
case '1':
echo "No se ha podido crear el álbum de fotos.";
示例8: dataBase
$con = dataBase();
//Подключение разных языков!!!
if (!isset($_SESSION['lang']) and $_SESSION['lang'] == NULL) {
$_SESSION['lang'] = "ru";
}
if (isset($_POST['lang'])) {
$_SESSION['lang'] = $_POST['lang'];
}
$lang = getLang($_SESSION['lang'], $con);
//Конец подключения разных языков!!!
if (isset($_POST['register']) and isset($_POST['login']) and isset($_POST['email']) and isset($_POST['password']) and isset($_POST['repassword'])) {
$login = $_POST['login'];
$email = $_POST['email'];
$pass = $_POST['password'];
$repass = $_POST['repassword'];
$newUser = newUser($login, $email, $pass, $repass, $con);
if ($newUser == "true") {
header("Location: ../index.php?registration=success");
exit;
} else {
$error = $newUser;
}
}
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
示例9: __isset
$o->{1} = $first_name;
$o->{2} = $last_name;
return $o;
}
class Something
{
public function __isset($name)
{
return $name == 'first_name';
}
public function __get($name)
{
return new User(4, 'Jack', 'Sparrow');
}
}
$records = array(newUser(1, 'John', 'Doe'), newUser(2, 'Sally', 'Smith'), newUser(3, 'Jane', 'Jones'), new User(1, 'John', 'Doe'), new User(2, 'Sally', 'Smith'), new User(3, 'Jane', 'Jones'), new Something());
echo "*** Testing array_column() : object property fetching (numeric property names) ***\n";
echo "-- first_name column from recordset --\n";
var_dump(array_column($records, 1));
echo "-- id column from recordset --\n";
var_dump(array_column($records, 0));
echo "-- last_name column from recordset, keyed by value from id column --\n";
var_dump(array_column($records, 2, 0));
echo "-- last_name column from recordset, keyed by value from first_name column --\n";
var_dump(array_column($records, 2, 1));
echo "*** Testing array_column() : object property fetching (string property names) ***\n";
echo "-- first_name column from recordset --\n";
var_dump(array_column($records, 'first_name'));
echo "-- id column from recordset --\n";
var_dump(array_column($records, 'id'));
echo "-- last_name column from recordset, keyed by value from id column --\n";
開發者ID:gleamingthecube,項目名稱:php,代碼行數:31,代碼來源:ext_standard_tests_array_array_column_variant_objects.php
示例10: InputFilter
<?php
// $query = $coll->findOne(array('login' => $_POST['login']));
require_once 'seguridad/class.inputfilter.php';
$filtro = new InputFilter();
$_POST = $filtro->process($_POST);
$usuario = $_POST['login'];
$password = $_POST['password'];
///////////////////////////////////////
include_once "config.php";
if (newUser($usuario, $password)) {
header("Refresh: 0;url=confirmar.php?mensaje=1");
} else {
header("Refresh: 0;url=confirmar.php?mensaje=2");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Crear usuario</title>
</head>
<body>
</body>
</html>
示例11: session_start
<?php
session_start();
//подключение конфигов
include "../include/stack.php";
$con = dataBase();
if (isset($_POST['register']) and isset($_POST['login']) and isset($_POST['email']) and isset($_POST['password']) and isset($_POST['repassword'])) {
$login = $_POST['login'];
$email = $_POST['email'];
$pass = $_POST['password'];
$repass = $_POST['repassword'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$newUser = newUser($login, $email, $pass, $repass, "registration", $firstname, $lastname, "", $con);
if ($newUser == "true") {
header("Location: ../index.php?registration=success");
exit;
} else {
$error = $newUser;
}
}
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Cake Group | Регистрация</title>
示例12: USERS2
return false;
}
$stmnt2->close();
$stmnt = $conn->prepare("INSERT INTO USERS2(USER_UID,USER_PWDHSH,USER_PWDSALT,USER_FNAME,USER_LNAME, USER_EMAIL, VERIFYED) VALUES(?,?,?,?,?,?,1)");
$salt = file_get_contents('/dev/urandom', false, null, 0, 64);
$options = array('salt' => $salt);
$phash = crypt($password, $salt);
$stmnt->bind_param('ssssss', $username, $phash, $salt, $fname, $lname, $email);
$stmnt->execute();
$stmnt->close();
$conn->close();
return true;
}
$fail = false;
session_start();
if (newUser($_POST["USERNAME"], $_POST["PASSWORD"], $_POST["PASSWORD2"], $_POST["FNAME"], $_POST["LNAME"], $_POST["EMAIL"])) {
echo "True";
//make folder for every new user
$dir = "/var/www/html/facePics/" . $_POST["USERNAME"];
mkdir($dir);
//make csv file
$file = $dir . "/csv";
touch($file);
$mail = $_POST["EMAIL"];
$name = $_POST["USERNAME"];
$subject = "Welcome to the Who R U";
$message = "141.210.25.46/email.php?USERNAME={$name}";
$headers = "";
$from = "-f your@email.here";
if (mail($mail, $subject, $message)) {
// echo "Mail worked";
示例13: array
$result = false;
$params = array('client_id' => $client_id, 'redirect_uri' => $redirect_uri, 'client_secret' => $client_secret, 'code' => $_GET['code']);
$url = 'https://graph.facebook.com/oauth/access_token';
}
//Для того чтобы распарсить данный ответ, воспользуемся функцией parse_str, а результат (в виде массива) запишем в переменную $tokenInfo:
$tokenInfo = null;
parse_str(file_get_contents($url . '?' . http_build_query($params)), $tokenInfo);
//Получение информации о пользователе
if (count($tokenInfo) > 0 && isset($tokenInfo['access_token'])) {
$params = array('access_token' => $tokenInfo['access_token']);
$userInfo = json_decode(file_get_contents('https://graph.facebook.com/me' . '?' . urldecode(http_build_query($params))), true);
if (isset($userInfo['id'])) {
$userInfo = $userInfo;
$result = true;
}
}
//Показ данных пользователя
if ($result) {
$login = formChars($userInfo['id']);
$pass = formChars($userInfo['id']);
$repass = formChars($userInfo['id']);
$id = userLogin($login, $pass, $con);
if ($id == false) {
newUser($login, "", $pass, $repass, "facebook", $userInfo['name'], "", "http://graph.facebook.com/" . $userInfo['id'] . "/picture?type=large", $con);
}
$id = userLogin($login, $pass, $con);
usersLog($id, "Пользователь успешно авторизовался и вошел в сеть", $con);
$_SESSION['idUser'] = $id;
header("Location: ../pages/profile.php");
exit;
}
示例14: participantSearch
echo participantSearch($_GET['search']);
}
if(isset($_GET['confirm'])){
participantConfirm($_GET['confirm']);
}
if(isset($_GET['participantevent'])){
echo participantEvents($_GET['participantevent']);
}
if(isset($_GET['participantinfo'])){
echo participantInfo($_GET['participantinfo']);
}
if(isset($_POST['pname'])&&
isset($_POST['pemail'])&&
isset($_POST['pclg'])&&
isset($_POST['pcntct'])&&
isset($_POST['pstate'])&&
isset($_POST['pgender'])&&
isset($_POST['preq'])){
header("Location: ../details.php?tid=".newUser($_POST['pname'],$_POST['pemail'],$_POST['pclg'],$_POST['pcntct'],$_POST['pstate'],$_POST['pgender'],$_POST['preq']));
}
if(isset($_POST['pid']) && isset($_POST['pname']) && isset($_POST['pemail']) && isset($_POST['pclg']) && isset($_POST['pcntct']) && isset($_POST['pstate']) && isset($_POST['preq']) && isset($_POST['pnitc'])){
echo updateParticipantInfo($_POST['pid'], $_POST['pname'],$_POST['pemail'],$_POST['pclg'],$_POST['pcntct'],$_POST['pstate'],$_POST['preq'],$_POST['pnitc']);
}
?>
示例15: trigger_error
trigger_error($result->getMessage(), E_USER_ERROR);
}
// Find the max cust_id
$result = $connection->query("SELECT max(cust_id) FROM customer");
if (DB::isError($result)) {
trigger_error($result->getMessage(), E_USER_ERROR);
}
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
// Work out the next available ID
$cust_id = $row["max(cust_id)"] + 1;
// Insert the new customer
$query = "INSERT INTO customer VALUES ({$cust_id}, \n '{$_SESSION["custFormVars"]["surname"]}', \n '{$_SESSION["custFormVars"]["firstname"]}', \n '{$_SESSION["custFormVars"]["initial"]}', \n {$_SESSION["custFormVars"]["title_id"]}, \n '{$_SESSION["custFormVars"]["address"]}', \n '{$_SESSION["custFormVars"]["city"]}', \n '{$_SESSION["custFormVars"]["state"]}', \n '{$_SESSION["custFormVars"]["zipcode"]}', \n {$_SESSION["custFormVars"]["country_id"]}, \n '{$_SESSION["custFormVars"]["phone"]}', \n '{$_SESSION["custFormVars"]["birth_date"]}')";
$result = $connection->query($query);
if (DB::isError($result)) {
trigger_error($result->getMessage(), E_USER_ERROR);
}
// Unlock the customer table
$result = $connection->query("UNLOCK TABLES");
if (DB::isError($result)) {
trigger_error($result->getMessage(), E_USER_ERROR);
}
// As this was an INSERT, we need to INSERT into the users table too
newUser($_SESSION["custFormVars"]["loginUsername"], $_SESSION["custFormVars"]["loginPassword"], $cust_id, $connection);
// Log the user into their new account
registerLogin($_SESSION["custFormVars"]["loginUsername"]);
}
// Clear the custFormVars so a future form is blank
unset($_SESSION["custFormVars"]);
unset($_SESSION["custErrors"]);
// Now show the customer receipt
header("Location: " . S_CUSTRECEIPT);