本文整理汇总了PHP中user_exists函数的典型用法代码示例。如果您正苦于以下问题:PHP user_exists函数的具体用法?PHP user_exists怎么用?PHP user_exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_exists函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: registra_usuario
function registra_usuario($username, $password, $email)
{
global $db;
if (user_exists($username)) {
$mensaje_de_error = "El usuario " . $username . " ya existe";
} else {
if (check_email($email) == 0) {
$mensaje_de_error = "El mail no es válido";
} else {
if (email_exists($email)) {
$mensaje_de_error = "El mail " . $email . " ya existe";
} else {
$SELECT = "INSERT INTO usuarios ( usuario_login, usuario_password, usuario_email, usuario_nombre )";
$SELECT .= " VALUES ( '" . $username . "', '" . md5($password) . "', '" . $email . "', '" . $username . "' )";
$result = $db->get_results($SELECT);
logea("registro " . $username, "", $_SESSION["usuario"]);
//Creamos el ranking con un día atrás para que no obtenga beneficios de 60000 al actualizar el ranking hoy
$SELECT = "INSERT INTO ranking ( ranking_usuario, ranking_saldo, ranking_invertido, ranking_total, ranking_beneficio_hoy, ranking_fecha ) ";
$SELECT .= " VALUES ( '" . $username . "', '60000', '0', '60000', '0', CURDATE()-INTERVAL 1 DAY )";
$result = $db->get_results($SELECT);
}
}
}
return $mensaje_de_error;
}
开发者ID:joanma100,项目名称:bolsaphp,代码行数:25,代码来源:plugfunctions.php
示例2: mci_account_get_array_by_id
/**
* Get username, realname and email from for a given user id
* @param integer $p_user_id A valid user identifier.
* @return array
*/
function mci_account_get_array_by_id($p_user_id)
{
$t_result = array();
$t_result['id'] = $p_user_id;
if (user_exists($p_user_id)) {
$t_current_user_id = auth_get_current_user_id();
$t_access_level = user_get_field($t_current_user_id, 'access_level');
$t_can_manage = access_has_global_level(config_get('manage_user_threshold')) && access_has_global_level($t_access_level);
# this deviates from the behaviour of view_user_page.php, but it is more intuitive
$t_is_same_user = $t_current_user_id === $p_user_id;
$t_can_see_realname = access_has_project_level(config_get('show_user_realname_threshold'));
$t_can_see_email = access_has_project_level(config_get('show_user_email_threshold'));
$t_result['name'] = user_get_field($p_user_id, 'username');
if ($t_is_same_user || $t_can_manage || $t_can_see_realname) {
$t_realname = user_get_realname($p_user_id);
if (!empty($t_realname)) {
$t_result['real_name'] = $t_realname;
}
}
if ($t_is_same_user || $t_can_manage || $t_can_see_email) {
$t_email = user_get_email($p_user_id);
if (!empty($t_email)) {
$t_result['email'] = $t_email;
}
}
}
return $t_result;
}
开发者ID:gtn,项目名称:mantisbt,代码行数:33,代码来源:mc_account_api.php
示例3: checkLogin
function checkLogin($u, $p)
{
global $seed;
// global because $seed is declared in the header.php file
if (!valid_username($u) || !valid_password($p) || !user_exists($u)) {
return false;
// the name was not valid, or the password, or the username did not exist
}
//Now let us look for the user in the database.
$query = sprintf("\n\t\tSELECT loginid \n\t\tFROM login \n\t\tWHERE \n\t\tusername = '%s' AND password = '%s' \n\t\tAND disabled = 0 AND activated = 1 \n\t\tLIMIT 1;", mysql_real_escape_string($u), mysql_real_escape_string(sha1($p . $seed)));
$result = mysql_query($query);
// If the database returns a 0 as result we know the login information is incorrect.
// If the database returns a 1 as result we know the login was correct and we proceed.
// If the database returns a result > 1 there are multple users
// with the same username and password, so the login will fail.
if (mysql_num_rows($result) != 1) {
return false;
} else {
// Login was successfull
$row = mysql_fetch_array($result);
// Save the user ID for use later
$_SESSION['loginid'] = $row['loginid'];
// Save the username for use later
$_SESSION['username'] = $u;
// Now we show the userbox
return true;
}
return false;
}
开发者ID:carbans,项目名称:PHPLogin,代码行数:29,代码来源:login.functions.inc.php
示例4: prepare_user_name
/**
* prepares the name of the user given the id. also makes it an email link.
* @param int $p_user_id
* @return string
*/
function prepare_user_name($p_user_id)
{
# Catch a user_id of NO_USER (like when a handler hasn't been assigned)
if (NO_USER == $p_user_id) {
return '';
}
$t_username = user_get_name($p_user_id);
if (user_exists($p_user_id) && user_get_field($p_user_id, 'enabled')) {
$t_username = string_display_line($t_username);
// WK/BFE: Original-Zeile auskommentiert: , LB/BFE 2015
// return '<a href="' . string_sanitize_url( 'view_user_page.php?id=' . $p_user_id, true ) . '">' . $t_username . '</a>';
// ersetzt durch: (Link auf view_user_page nur wenn globale Rolle mindestens $g_manage_user_threshold
if (user_is_administrator(auth_get_current_user_id())) {
return '<a href="' . string_sanitize_url('view_user_page.php?id=' . $p_user_id, true) . '">' . $t_username . '</a>';
} else {
return $t_username;
}
// WK/BFE: Ende der Modifikation
} else {
$t_result = '<font STYLE="text-decoration: line-through">';
$t_result .= string_display_line($t_username);
$t_result .= '</font>';
return $t_result;
}
}
开发者ID:bfekomsthoeft,项目名称:TTS_Praxisprojekt1,代码行数:30,代码来源:prepare_api.php
示例5: register
/**
* @param $in
* @return array
*
* @code
* $ php index.php "route=user.Controller.register&username=abc&password=1234&[email protected]"
* @endcode
*
*/
public function register($in)
{
if (!isset($in['username'])) {
sys()->log("Username is empty.");
return ERROR(-111, "Username is empty.");
}
if (!isset($in['password'])) {
return ERROR(-1121, "Password is empty.");
}
if (!isset($in['email'])) {
return ERROR(-113, "Email is empty.");
}
if (user_exists($in['username'])) {
return ERROR(-121, "User: {$in['username']} exists.");
}
if (user_email_exists($in['email'])) {
return ERROR(-121, "User email: {$in['email']} exists.");
}
$sets = array();
$sets['username'] = $in['username'];
$sets['password'] = password_encrypt($in['password']);
$sets['email'] = $in['email'];
$sets['first_name'] = hi('first_name', '');
$sets['middle_name'] = hi('middle_name', '');
$sets['last_name'] = hi('last_name');
$sets['mobile'] = hi('mobile', '');
$sets['landline'] = hi('landline', '');
$sets['address'] = hi('address');
$re = user()->create()->sets($sets)->save();
if ($re) {
return SUCCESS();
} else {
return ERROR(-4, 'Failed on saving user information.');
}
}
开发者ID:thruthesky,项目名称:backend,代码行数:44,代码来源:Controller.php
示例6: getData
function getData()
{
parent::getData();
$this->wop = value_from_POST_GET(FMWK_PARAM_OP, 'sign');
if (empty($this->asked_app)) {
$this->asked_app = value_from_POST('asked_app', Null);
}
$op = $this->wop;
$siteuser = $this->site->username();
$this->user_signed = isset($siteuser);
if ($this->user_signed) {
$this->wusername = $siteuser;
} else {
$this->wusername = value_from_POST('username', Null);
$this->wpassword = value_from_POST('password', Null);
}
switch ($op) {
case 'logout':
$auth = $this->site->auth;
$auth->logoutUser($this->wusername);
$this->site->redirectToApp($this->asked_app);
exit;
break;
case 'login':
if ($this->user_signed) {
$this->message .= "Already authentificated in";
$this->wop = 'info';
} else {
$is_ok = FALSE;
if (!empty($this->wusername)) {
$auth = $this->site->auth;
if (isset($auth)) {
$is_ok = $auth->loginUser($this->wusername, $this->wpassword);
}
}
if ($is_ok) {
require_once INC_DIR . "users.inc";
if (user_exists($auth->signed_username)) {
$this->message .= "Welcome";
$this->wop = 'login';
$this->site->redirectToApp($this->asked_app);
} else {
$this->message .= "Sorry your account is not configured yet.<br/>";
$auth->logoutUser();
$this->wop = 'sign';
}
} else {
$this->message .= "Invalid login or password";
$this->wop = 'sign';
}
}
break;
default:
$this->wop = 'info';
break;
}
}
开发者ID:BackupTheBerlios,项目名称:djocewebtools-svn,代码行数:57,代码来源:app.sign.php
示例7: adduser
function adduser($username, $password, $level, $email = "", $realname = "", $can_modify_passwd = '1', $description = "")
{
if (!user_exists($username)) {
$encrypted = crypt($password, '$1$' . generateSalt(8) . '$');
return dbInsert(array('username' => $username, 'password' => $encrypted, 'level' => $level, 'email' => $email, 'realname' => $realname, 'can_modify_passwd' => $can_modify_passwd, 'descr' => $description), 'users');
} else {
return FALSE;
}
}
开发者ID:RomanBogachev,项目名称:observium,代码行数:9,代码来源:mysql.inc.php
示例8: __construct
function __construct($Username, $key)
{
if (!user_exists($Username)) {
return false;
}
$this->username = $Username;
$this->rehash();
$_SESSION['user'] =& $this;
$this->decryptionKey = $key;
}
开发者ID:ss23,项目名称:Pass-Store,代码行数:10,代码来源:User.php
示例9: adduser
function adduser($username, $password, $level, $email = '', $realname = '', $can_modify_passwd = '1')
{
if (!user_exists($username)) {
$hasher = new PasswordHash(8, false);
$encrypted = $hasher->HashPassword($password);
return dbInsert(array('username' => $username, 'password' => $encrypted, 'level' => $level, 'email' => $email, 'realname' => $realname), 'users');
} else {
return false;
}
}
开发者ID:n-st,项目名称:librenms,代码行数:10,代码来源:http-auth.inc.php
示例10: adduser
function adduser($username, $password, $level, $email = "", $realname = "", $can_modify_passwd = 1, $description = "", $twofactor = 0)
{
if (!user_exists($username)) {
$hasher = new PasswordHash(8, FALSE);
$encrypted = $hasher->HashPassword($password);
return dbInsert(array('username' => $username, 'password' => $encrypted, 'level' => $level, 'email' => $email, 'realname' => $realname, 'can_modify_passwd' => $can_modify_passwd, 'descr' => $description, 'twofactor' => $twofactor), 'users');
} else {
return FALSE;
}
}
开发者ID:REAP720801,项目名称:librenms,代码行数:10,代码来源:mysql.inc.php
示例11: pass_check
function pass_check($user, $pass)
{
if (user_exists($user)) {
$hpass = sha1(sha1($pass));
$q = "SELECT COUNT(*) FROM users WHERE user='" . sqlite_escape_string($user) . "' AND pass='" . $hpass . "'";
$res = db_fetch_array(db_query($q), SQLITE_NUM);
return $res['0']['0'];
} else {
return FALSE;
}
}
开发者ID:vulnerabilityCode,项目名称:ctf,代码行数:11,代码来源:user.inc.php
示例12: update_user
private function update_user()
{
$fb_response = $this->facebook->api('/me');
$this->display_name = $fb_response['name'];
global $db;
if (user_exists($this)) {
$this->updated = time();
$db->query('UPDATE users SET display_name = "' . $this->display_name . '", updated = ' . $this->updated . ' WHERE uid = ' . $this->uid);
} else {
create_user($this);
}
}
开发者ID:nodefortytwo,项目名称:rmpl,代码行数:12,代码来源:users.php
示例13: authenticate
function authenticate($username, $password)
{
global $config;
if (isset($_SERVER['REMOTE_USER'])) {
$_SESSION['username'] = mres($_SERVER['REMOTE_USER']);
if (user_exists($_SESSION['username'])) {
return 1;
}
$_SESSION['username'] = $config['http_auth_guest'];
return 1;
}
return 0;
}
开发者ID:greggcz,项目名称:librenms,代码行数:13,代码来源:ldap-authorization.inc.php
示例14: verify_password
function verify_password($pseudo, $password)
{
$error = false;
//Pseudo pas existant
if (!user_exists(array('pseudo' => $pseudo, 'password' => sha1(md5($password))))) {
$_SESSION['connexion_error'][] = 'Le mot de passe entré n\'est pas le bon.';
$error = true;
}
if (!$error) {
return true;
}
return false;
}
开发者ID:YannBertrand,项目名称:CovoiturageENIB,代码行数:13,代码来源:index.php
示例15: generate_request
function generate_request($email, &$db)
{
//echo "generate request function called. <br><br>";
$user_confirmed = user_exists($email, $db);
if ($user_confirmed[0]) {
$requestkey = mt_rand(10000000, mt_getrandmax());
$time = time();
//echo "user confirmed to exist; request key generated: $requestkey <br><br>";
try {
$sql = 'INSERT INTO password_reset_requests
(email, requestkey, time)
VALUES (:email, :requestkey, :time)';
$stmt = $db->prepare($sql);
$stmt->bindValue(':email', $email);
$stmt->bindValue(':requestkey', $requestkey);
$stmt->bindValue(':time', $time);
$stmt->execute();
$errorInfo = $stmt->errorInfo();
if (isset($errorInfo[2])) {
$error = $errorInfo[2];
}
} catch (Exception $e) {
$error = $e->getMessage();
}
if (isset($error)) {
//echo "database error in request insertion: $error <br><br>";
return [false, $error];
}
$requestid = $db->lastInsertId();
if (!isset($requestid)) {
//echo "error: no request id returned by db. <br><br>";
return [false, 'Error: Could not add request to database.'];
} else {
//echo "made it! have a request id: $requestid <br><br>";
$key = $requestid . '-' . $requestkey;
//echo "about to generate an email with address $email and key $key <br><br>";
if (generate_email($email, $key)) {
//echo "email sent. <br><br>";
return [true];
} else {
//echo "email not sent. <br><br>";
return [false, "Error: email could not be sent."];
}
}
} else {
//echo "user does not exist. <br><br>";
return $user_confirmed;
// already in the form [false, error]
}
}
开发者ID:ReveWeber,项目名称:storyboardapp,代码行数:50,代码来源:pw_recovery_fns.php
示例16: prepare_user_name
/**
* prepares the name of the user given the id. also makes it an email link.
* @param int $p_user_id
* @return string
*/
function prepare_user_name( $p_user_id ) {
# Catch a user_id of NO_USER (like when a handler hasn't been assigned)
if( NO_USER == $p_user_id ) {
return '';
}
$t_username = user_get_name( $p_user_id );
$t_username = string_display_line( $t_username );
if( user_exists( $p_user_id ) && user_get_field( $p_user_id, 'enabled' ) ) {
return '<a class="user" href="' . string_sanitize_url( 'view_user_page.php?id=' . $p_user_id, true ) . '">' . $t_username . '</a>';
} else {
return '<del class="user">' . $t_username . '</del>';
}
}
开发者ID:rombert,项目名称:mantisbt,代码行数:19,代码来源:prepare_api.php
示例17: create_user
function create_user($dbc, $username, $password, $password2, $firstname, $lastname)
{
if ($password != $password2) {
return false;
}
if (user_exists($dbc, $username)) {
return false;
}
$create_user = "INSERT INTO users (username, password, firstname, lastname) VALUES (?, ?, ?, ?)";
$stmt = mysqli_prepare($dbc, $create_user);
$password_hash = password_hash($password, PASSWORD_DEFAULT);
mysqli_stmt_bind_param($stmt, "ssss", $username, $password_hash, $firstname, $lastname);
mysqli_stmt_execute($stmt);
$affected_rows = mysqli_stmt_affected_rows($stmt);
return $affected_rows == 1;
}
开发者ID:AndrewBerlin,项目名称:cfbpickem,代码行数:16,代码来源:account_utils.php
示例18: get
/**
* Gets the avatar information for the user. The avatars are provided by
* plugins that can integrate with a variety of services like gravatar.com,
* LDAP, Social Identities, etc.
*
* If logged in user doesn't have access to view avatars or not avatar is found,
* then a default avatar will be used.
*
* Note that the provided user id may no longer has a corresponding user in the
* system, if the user was deleted.
*
* @param integer $p_user_id The user id.
* @param integer $p_size The desired width/height of the avatar.
*
* @return array The array with avatar information.
*/
public static function get($p_user_id, $p_size = 80)
{
$t_enabled = config_get('show_avatar') !== OFF;
$t_avatar = null;
if ($t_enabled) {
$t_user_exists = user_exists($p_user_id);
if ($t_user_exists && access_has_project_level(config_get('show_avatar_threshold'), null, $p_user_id)) {
$t_avatar = event_signal('EVENT_USER_AVATAR', array($p_user_id, $p_size));
}
if ($t_avatar === null) {
$t_avatar = new Avatar();
}
$t_avatar->normalize($p_user_id, $t_user_exists);
}
return $t_avatar;
}
开发者ID:spring,项目名称:spring-website,代码行数:32,代码来源:Avatar.class.php
示例19: mci_account_get_array_by_id
/**
* Get username, realname and email from for a given user id
* @param integer $p_user_id A valid user identifier.
* @return array
*/
function mci_account_get_array_by_id($p_user_id)
{
$t_result = array();
$t_result['id'] = $p_user_id;
if (user_exists($p_user_id)) {
$t_result['name'] = user_get_field($p_user_id, 'username');
$t_dummy = user_get_field($p_user_id, 'realname');
if (!empty($t_dummy)) {
$t_result['real_name'] = $t_dummy;
}
$t_dummy = user_get_field($p_user_id, 'email');
if (!empty($t_dummy)) {
$t_result['email'] = $t_dummy;
}
}
return $t_result;
}
开发者ID:derrickweaver,项目名称:mantisbt,代码行数:22,代码来源:mc_account_api.php
示例20: prepare_user_name
/**
* prepares the name of the user given the id. also makes it an email link.
* @param int $p_user_id
* @return string
*/
function prepare_user_name($p_user_id)
{
# Catch a user_id of NO_USER (like when a handler hasn't been assigned)
if (NO_USER == $p_user_id) {
return '';
}
$t_username = user_get_name($p_user_id);
if (user_exists($p_user_id) && user_get_field($p_user_id, 'enabled')) {
$t_username = string_display_line($t_username);
return '<a href="' . string_sanitize_url('view_user_page.php?id=' . $p_user_id, true) . '">' . $t_username . '</a>';
} else {
$t_result = '<font STYLE="text-decoration: line-through">';
$t_result .= string_display_line($t_username);
$t_result .= '</font>';
return $t_result;
}
}
开发者ID:nourchene-benslimane,项目名称:mantisV0,代码行数:22,代码来源:prepare_api.php
注:本文中的user_exists函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论