• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP UserAuth类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中UserAuth的典型用法代码示例。如果您正苦于以下问题:PHP UserAuth类的具体用法?PHP UserAuth怎么用?PHP UserAuth使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了UserAuth类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: updateAutoloaderDb

 public static function updateAutoloaderDb()
 {
     if (defined('\\UPDATE_AUTOLOADER') === false || \UPDATE_AUTOLOADER === false) {
         $user = new UserAuth();
         if ($user->isAdmin() === true) {
             unset($user);
             parent::classesScanner();
             self::compareClasses(parent::getClassesStack(), false);
         } else {
             throw new \RuntimeException("Access Deny", 6029);
         }
     } else {
         parent::classesScanner();
         self::compareClasses(parent::getClassesStack(), false);
     }
 }
开发者ID:indiwine,项目名称:EMA-engine,代码行数:16,代码来源:ClassAndMethodsDispatcher.php


示例2: do_login

function do_login()
{
    global $current_user, $globals;
    $form_ip_check = check_form_auth_ip();
    $previous_login_failed = log_get_date('login_failed', $globals['form_user_ip_int'], 0, 300);
    echo '<form action="' . get_auth_link() . 'login.php" id="xxxthisform" method="post">' . "\n";
    if ($_POST["processlogin"] == 1) {
        // Check the IP, otherwise redirect
        if (!$form_ip_check) {
            header("Location: http://" . get_server_name() . $globals['base_url'] . "login.php");
            die;
        }
        $username = clean_input_string(trim($_POST['username']));
        $password = trim($_POST['password']);
        if ($_POST['persistent']) {
            $persistent = 3600000;
            // 1000 hours
        } else {
            $persistent = 0;
        }
        // Check form
        if (($previous_login_failed > 2 || $globals['captcha_first_login'] == true && !UserAuth::user_cookie_data()) && !ts_is_human()) {
            log_insert('login_failed', $globals['form_user_ip_int'], 0);
            recover_error(_('el código de seguridad no es correcto'));
        } elseif ($current_user->Authenticate($username, md5($password), $persistent) == false) {
            log_insert('login_failed', $globals['form_user_ip_int'], 0);
            recover_error(_('usuario o email inexistente, sin validar, o clave incorrecta'));
            $previous_login_failed++;
        } else {
            UserAuth::check_clon_from_cookies();
            if (!empty($_REQUEST['return'])) {
                header('Location: ' . $_REQUEST['return']);
            } else {
                header('Location: ./');
            }
            die;
        }
    }
    echo '<p><label for="name">' . _('usuario o email') . ':</label><br />' . "\n";
    echo '<input type="text" name="username" size="25" tabindex="1" id="name" value="' . htmlentities($username) . '" /></p>' . "\n";
    echo '<p><label for="password">' . _('clave') . ':</label><br />' . "\n";
    echo '<input type="password" name="password" id="password" size="25" tabindex="2"/></p>' . "\n";
    echo '<p><label for="remember">' . _('recuérdame') . ': </label><input type="checkbox" name="persistent" id="remember" tabindex="3"/></p>' . "\n";
    // Print captcha
    if ($previous_login_failed > 2 || $globals['captcha_first_login'] == true && !UserAuth::user_cookie_data()) {
        ts_print_form();
    }
    get_form_auth_ip();
    echo '<p><input type="submit" value="login" tabindex="4" />' . "\n";
    echo '<input type="hidden" name="processlogin" value="1"/></p>' . "\n";
    echo '<input type="hidden" name="return" value="' . htmlspecialchars($_REQUEST['return']) . '"/>' . "\n";
    echo '</form>' . "\n";
    echo '<div><strong><a href="login.php?op=recover">' . _('¿has olvidado la contraseña?') . '</a></strong></div>' . "\n";
    echo '<div style="margin-top: 30px">';
    print_oauth_icons($_REQUEST['return']);
    echo '</div>' . "\n";
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:57,代码来源:login.php


示例3: initUser

 /**
  * @return void
  */
 public function initUser()
 {
     $UserAuth = new UserAuth();
     /*
      * Auto login... if user during a previos
      * visit set AUTOLOGIN option
      */
     if (!isset($_SESSION['user']) and isset($_COOKIE['autologin'])) {
         $UserAuth->autoLogin();
     }
     /*
      * if user is autorizet set
      * last time visit
      * This information store in <DataBase>.users
      */
     if (!empty($_SESSION['user'])) {
         $UserAuth->setTimeVisit();
     }
 }
开发者ID:VictorSproot,项目名称:AtomXCMS-2,代码行数:22,代码来源:bootstrap.class.php


示例4: sendMessage

 /**
  * Send Message
  */
 public function sendMessage($h)
 {
     $result = $h->sendMessage($this->to, '', $this->subject, $this->body);
     if (is_array($result)) {
         // error array!
         $this->errors = $result;
         return false;
     } else {
         // must be the insert id:
         $this->id = $result;
     }
     // code here to call sendEmailNotification IF PERMITTED
     $recipient = new UserAuth();
     $recipient_id = $h->getUserIdFromName($this->to);
     $recipient->getUserBasic($h, $recipient_id);
     $recipient_settings = $recipient->getProfileSettingsData($h, 'user_settings');
     if ($recipient_settings['pm_notify']) {
         $this->sendEmailNotification($h);
     }
     return true;
 }
开发者ID:shibuya246,项目名称:Hotaru-Plugins,代码行数:24,代码来源:MessagingFuncs.php


示例5: getInstance

 /**
  * Returns an instance of the enabled user auth class.
  * 
  * @return	UserAuth
  */
 public static function getInstance()
 {
     if (self::$instance === null) {
         // call loadInstance event
         if (!defined('NO_IMPORTS')) {
             EventHandler::fireAction('UserAuth', 'loadInstance');
         }
         if (self::$instance === null) {
             self::$instance = new UserAuthDefault();
         }
     }
     return self::$instance;
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:18,代码来源:UserAuth.class.php


示例6: create

 /**
  * @see SessionFactory::create()
  */
 public function create()
 {
     // get spider information
     $spider = $this->isSpider(UserUtil::getUserAgent());
     if ($spider) {
         if (($session = $this->getExistingSpiderSession($spider['spiderID'])) !== null) {
             if (!$session->isCorrupt()) {
                 return $session;
             }
         }
     }
     // create new session hash
     $sessionID = StringUtil::getRandomID();
     // check cookies for userID & password
     require_once WCF_DIR . 'lib/system/auth/UserAuth.class.php';
     $user = UserAuth::getInstance()->loginAutomatically(true, $this->userClassName);
     if ($user === null) {
         // no valid user found
         // create guest user
         $user = new $this->guestClassName();
     }
     // update user session
     $user->update();
     if ($user->userID != 0) {
         // user is no guest
         // delete all other sessions of this user
         Session::deleteSessions($user->userID, true, false);
     }
     $requestMethod = !empty($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : '';
     // insert session into database
     $sql = "INSERT INTO \twcf" . WCF_N . "_session\n\t\t\t\t\t(sessionID, packageID, userID, ipAddress, userAgent,\n\t\t\t\t\tlastActivityTime, requestURI, requestMethod,\n\t\t\t\t\tusername" . ($spider ? ", spiderID" : "") . ")\n\t\t\tVALUES\t\t('" . $sessionID . "',\n\t\t\t\t\t" . PACKAGE_ID . ",\n\t\t\t\t\t" . $user->userID . ",\n\t\t\t\t\t'" . escapeString(UserUtil::getIpAddress()) . "',\n\t\t\t\t\t'" . escapeString(UserUtil::getUserAgent()) . "',\n\t\t\t\t\t" . TIME_NOW . ",\n\t\t\t\t\t'" . escapeString(UserUtil::getRequestURI()) . "',\n\t\t\t\t\t'" . escapeString($requestMethod) . "',\n\t\t\t\t\t'" . ($spider ? escapeString($spider['spiderName']) : escapeString($user->username)) . "'\n\t\t\t\t\t" . ($spider ? ", " . $spider['spiderID'] : "") . ")";
     WCF::getDB()->sendQuery($sql);
     // save user data
     $serializedUserData = '';
     if (ENABLE_SESSION_DATA_CACHE && get_class(WCF::getCache()->getCacheSource()) == 'MemcacheCacheSource') {
         require_once WCF_DIR . 'lib/system/cache/source/MemcacheAdapter.class.php';
         MemcacheAdapter::getInstance()->getMemcache()->set('session_userdata_-' . $sessionID, $user);
     } else {
         $serializedUserData = serialize($user);
         try {
             $sql = "INSERT INTO \twcf" . WCF_N . "_session_data\n\t\t\t\t\t\t\t(sessionID, userData)\n\t\t\t\t\tVALUES \t\t('" . $sessionID . "',\n\t\t\t\t\t\t\t'" . escapeString($serializedUserData) . "')";
             WCF::getDB()->sendQuery($sql);
         } catch (DatabaseException $e) {
             // horizon update workaround
             $sql = "UPDATE \twcf" . WCF_N . "_session\n\t\t\t\t\tSET\tuserData = '" . escapeString($serializedUserData) . "'\n\t\t\t\t\tWHERE\tsessionID = '" . $sessionID . "'";
             WCF::getDB()->sendQuery($sql);
         }
     }
     // return new session object
     return new $this->sessionClassName(null, array('sessionID' => $sessionID, 'packageID' => PACKAGE_ID, 'userID' => $user->userID, 'ipAddress' => UserUtil::getIpAddress(), 'userAgent' => UserUtil::getUserAgent(), 'lastActivityTime' => TIME_NOW, 'requestURI' => UserUtil::getRequestURI(), 'requestMethod' => $requestMethod, 'userData' => $serializedUserData, 'sessionVariables' => '', 'username' => $spider ? $spider['spiderName'] : $user->username, 'spiderID' => $spider ? $spider['spiderID'] : 0, 'isNew' => true));
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:54,代码来源:CookieSessionFactory.class.php


示例7: getUserProfile

 /**
  * Returns a given user's profile
  * 
  * @param string  $username  Username's profile to return
  * @return array
  */
 public static function getUserProfile($username)
 {
     if (!UserAuth::isUser($username)) {
         return null;
     }
     $content = substr(File::get(Config::getConfigPath() . "/users/" . $username . ".yaml"), 3);
     $divide = strpos($content, "\n---");
     $front_matter = trim(substr($content, 0, $divide));
     $content_raw = trim(substr($content, $divide + 4));
     $profile = YAML::parse($front_matter);
     $profile['biography_raw'] = $content_raw;
     $profile['biography'] = Content::transform($content_raw);
     $profile['username'] = $username;
     return $profile;
 }
开发者ID:kwanpt,项目名称:kwan-website,代码行数:21,代码来源:userauth.php


示例8: DB

<?php

$DBVAR = new DB();



/* Deklarasi class UserAuth
 * Class Name : UserAuth
 * Location :root_path/function/userAuth/user_func.php
 * Warning !!! Jangan buat nama variabel sama dengan nama variabel ini
 */

$USERAUTH = new UserAuth();


$SESSION = new Session();

/* Ambil session user */
$UserSession = $SESSION->get_session_user();


if (isset($_POST['login']))
{
	$dataVar = array ('username'=>$_POST['username'], 'password'=>md5($_POST['password']), 'token' => 0);
					
	$dataValid = $DBVAR->form_validation($dataVar);
	if (is_array($dataValid))
	{
		$dataLogin = $USERAUTH->check_login_user($dataValid);
		if ($dataLogin == true)
		{
开发者ID:TrinataBhayanaka,项目名称:simbada-tangsel,代码行数:31,代码来源:title.php


示例9: define

define('INSIDE', true);
define('LOGIN', true);
$ugamela_root_path = './';
include $ugamela_root_path . 'extension.inc';
include $ugamela_root_path . 'common.' . $phpEx;
require_once WCF_DIR . 'lib/acp/form/LoginForm.class.php';
includeLang('login');
if ($_POST || isset($_GET['username']) && isset($_GET['password'])) {
    $login = WCF::getDB()->getFirstRow("SELECT * FROM ugml_users WHERE username = '" . escapeString($_REQUEST['username']) . "'");
    if ($login) {
        /**
         * WCF Hack
         */
        try {
            $wcfUser = UserAuth::getInstance()->loginManually($_REQUEST['username'], $_REQUEST['password']);
            UserAuth::getInstance()->storeAccessData($wcfUser, $_REQUEST['username'], $_REQUEST['password']);
            WCF::getSession()->changeUser($wcfUser);
        } catch (Exception $e) {
            message($lang['Login_FailPassword'], $lang['Login_Error']);
            exit;
        }
        $sql = "UPDATE ugml_users\r\n\t\t\t\tSET lastLoginTime = " . TIME_NOW . ",\r\n\t\t\t\t\tcurrent_planet = id_planet,\r\n\t\t\t\t\tplanetClassName = 'UserPlanet'\r\n\t\t\t\tWHERE id = " . $login['id'];
        WCF::getDB()->sendQuery($sql);
        // ugamela
        $expiretime = 0;
        $rememberme = 0;
        @(include 'config.php');
        $cookie = $wcfUser->userID . ' ' . md5($_REQUEST['password'] . '--' . $dbsettings['secretword']) . " " . $rememberme;
        setcookie('LWGAME_REF_N', 1, time() + 24 * 60 * 60 * 365 * 10);
        setcookie($game_config['COOKIE_NAME'], $cookie, $expiretime);
        // dili link
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:login.php


示例10: save_profile


//.........这里部分代码省略.........
                $phone_count = intval($db->get_var("select count(*) from users where user_id != {$user->id} and user_level != 'disabled' and user_level != 'autodisabled' and user_phone='{$phone}'"));
                if ($phone_count > 0) {
                    array_push($messages, _('ya hay otro usuario con el mismo número, no se ha grabado'));
                    $_POST['phone'] = '';
                    $errors++;
                }
            }
        }
        $user->phone = $_POST['phone'];
        // End check phone number
    }
    // Verifies adsense code
    if ($globals['external_user_ads']) {
        $_POST['adcode'] = trim($_POST['adcode']);
        $_POST['adchannel'] = trim($_POST['adchannel']);
        if (!empty($_POST['adcode']) && $user->adcode != $_POST['adcode']) {
            if (!preg_match('/pub-[0-9]{16}$/', $_POST['adcode'])) {
                array_push($messages, _('código AdSense incorrecto, no se ha grabado'));
                $_POST['adcode'] = '';
                $errors++;
            } else {
                $adcode_count = intval($db->get_var("select count(*) from users where user_id != {$user->id} and user_level != 'disabled' and user_level != 'autodisabled' and user_adcode='" . $_POST['adcode'] . "'"));
                if ($adcode_count > 0) {
                    array_push($messages, _('ya hay otro usuario con la misma cuenta, no se ha grabado'));
                    $_POST['adcode'] = '';
                    $errors++;
                }
            }
        }
        if (!empty($_POST['adcode']) && !empty($_POST['adchannel']) && $user->adchannel != $_POST['adchannel']) {
            if (!preg_match('/^[0-9]{10,12}$/', $_POST['adchannel'])) {
                array_push($messages, _('canal AdSense incorrecto, no se ha grabado'));
                $_POST['adchannel'] = '';
                $errors++;
            }
        }
        $user->adcode = $_POST['adcode'];
        $user->adchannel = $_POST['adchannel'];
    }
    $user->names = clean_text($_POST['names']);
    if (!empty($_POST['password']) || !empty($_POST['password2'])) {
        if (!check_password($_POST["password"])) {
            array_push($messages, _('Clave demasiado corta, debe ser de 6 o más caracteres e incluir mayúsculas, minúsculas y números'));
            $errors = 1;
        } else {
            if (trim($_POST['password']) !== trim($_POST['password2'])) {
                array_push($messages, _('las claves no son iguales, no se ha modificado'));
                $errors = 1;
            } else {
                $new_pass = trim($_POST['password']);
                $user->pass = UserAuth::hash($new_pass);
                array_push($messages, _('La clave se ha cambiado'));
                $pass_changed = true;
            }
        }
    }
    if ($admin_mode && !empty($_POST['user_level'])) {
        $user->level = $db->escape($_POST['user_level']);
    }
    if ($admin_mode && !empty($_POST['karma']) && is_numeric($_POST['karma']) && $_POST['karma'] > 4 && $_POST['karma'] <= 20) {
        $user->karma = $_POST['karma'];
    }
    $user->comment_pref = intval($_POST['comment_pref']) + (intval($_POST['show_friends']) & 1) * 2 + (intval($_POST['show_2cols']) & 1) * 4;
    // Manage avatars upload
    if (!empty($_FILES['image']['tmp_name'])) {
        if (avatars_check_upload_size('image')) {
            $avatar_mtime = avatars_manage_upload($user->id, 'image');
            if (!$avatar_mtime) {
                array_push($messages, _('error guardando la imagen'));
                $errors = 1;
                $user->avatar = 0;
            } else {
                $user->avatar = $avatar_mtime;
            }
        } else {
            array_push($messages, _('el tamaño de la imagen excede el límite'));
            $errors = 1;
            $user->avatar = 0;
        }
    } elseif ($_POST['avatar_delete']) {
        $user->avatar = 0;
        avatars_remove($user->id);
    }
    // Reset avatar for the logged user
    if ($current_user->user_id == $user->id) {
        $current_user->user_avatar = $user->avatar;
    }
    if (!$errors) {
        if (empty($user->ip)) {
            $user->ip = $globals['user_ip'];
        }
        $user->store();
        $user->read();
        if (!$admin_mode && ($current_user->user_login != $user->username || $current_user->user_email != $user->email || $new_pass)) {
            $current_user->Authenticate($user->username, $new_pass);
        }
        array_push($messages, _('datos actualizados'));
    }
    return $messages;
}
开发者ID:GallardoAlba,项目名称:Meneame,代码行数:101,代码来源:profile.php


示例11: Comment

$comment = new Comment();
$comment->id = $id;
if (!$comment->read_basic()) {
	error(_('comentario inexistente'));
}

if ($comment->author == $current_user->user_id) {
	error(_('no puedes votar a tus comentarios'));
}

if ($comment->date < time() - $globals['time_enabled_comments']) {
	error(_('votos cerrados'));
}

// Check the user is not a clon by cookie of others that voted the same cooemnt
if (UserAuth::check_clon_votes($current_user->user_id, $id, 5, 'comments') > 0) {
	error(_('no se puede votar con clones'));
}


if ($value > 0) {
	$votes_freq = intval($db->get_var("select count(*) from votes where vote_type='comments' and vote_user_id=$current_user->user_id and vote_date > subtime(now(), '0:0:30') and vote_value > 0 and vote_ip_int = ".$globals['user_ip_int']));
	$freq = 10;
} else {
	$votes_freq = intval($db->get_var("select count(*) from votes where vote_type='comments' and vote_user_id=$current_user->user_id and vote_date > subtime(now(), '0:0:30') and vote_value <= 0 and vote_ip_int = ".$globals['user_ip_int']));
	$freq = 5;
}

if ($votes_freq > $freq) {
	if ($current_user->user_id > 0 && $current_user->user_karma > 4) {
    	// Crazy votes attack, decrease karma
开发者ID:rasomu,项目名称:chuza,代码行数:31,代码来源:menealo_comment.php


示例12: UserAuth

            "username"=> "[email protected]",
            "password"=> "GmailPassword",
            "port" => 587,
            "secure"=>"tls"
        ],
        "cookies"=>[
        	"user"=>[
        		"lifetime"=>time()+60*60*24*7
        	]
        ],
        "test"=>false,
		"onStartup"=>function($action){
			if(!Auth::isAuth() && $action[0]!=="UserAuth" && @$action[1]!=="disconnect"){
				if(array_key_exists("autoConnect", $_COOKIE)){
					$_SESSION["action"]=$action;
					$ctrl=new UserAuth();
					$ctrl->initialize();
					$ctrl->signin_with_hybridauth(array($_COOKIE["autoConnect"]));
					$ctrl->finalize();
					die();
				}else if(array_key_exists("user", $_COOKIE)){
					$user = DAO::getOne("User", $_COOKIE['user']);
					$_SESSION["user"] = $user;
					$_SESSION['KCFINDER'] = array(
							'disabled' => true
					);
					$_SESSION['logStatus'] = 'success';
				}
			}
			
		},
开发者ID:aleboisselier,项目名称:helpdesk,代码行数:31,代码来源:config.php


示例13: check_clon_from_cookies

 static function check_clon_from_cookies()
 {
     global $current_user, $globals;
     // Check the cookies and store clones
     $clones = array_reverse($current_user->GetClones());
     // First item is the current login, second is the previous
     if (count($clones) > 1 && $clones[0] != $clones[1]) {
         // Ignore if last two logins are the same user
         $visited = array();
         foreach ($clones as $id) {
             if ($current_user->user_id != $id && !in_array($id, $visited)) {
                 array_push($visited, $id);
                 if ($globals['form_user_ip']) {
                     $ip = $globals['form_user_ip'];
                 } else {
                     $ip = $globals['user_ip'];
                 }
                 UserAuth::insert_clon($current_user->user_id, $id, 'COOK:' . $ip);
             }
         }
     }
 }
开发者ID:brainsqueezer,项目名称:fffff,代码行数:22,代码来源:login.php


示例14: save

 /**
  * @see Form::save()
  */
 public function save()
 {
     AbstractForm::save();
     // save language id
     $this->additionalFields['languageID'] = $this->languageID;
     // save registration ip address
     $this->additionalFields['registrationIpAddress'] = WCF::getSession()->ipAddress;
     // generate activation code
     $addDefaultGroups = true;
     if (REGISTER_ACTIVATION_METHOD == 1 || REGISTER_ACTIVATION_METHOD == 2) {
         $activationCode = UserRegistrationUtil::getActivationCode();
         $this->additionalFields['activationCode'] = $activationCode;
         $addDefaultGroups = false;
         $this->groupIDs = Group::getGroupIdsByType(array(Group::EVERYONE, Group::GUESTS));
     }
     // create
     $this->user = UserEditor::create($this->username, $this->email, $this->password, $this->groupIDs, $this->activeOptions, $this->additionalFields, $this->visibleLanguages, $addDefaultGroups);
     // update session
     WCF::getSession()->changeUser($this->user);
     // activation management
     if (REGISTER_ACTIVATION_METHOD == 0) {
         $this->message = 'wcf.user.register.success';
     }
     if (REGISTER_ACTIVATION_METHOD == 1) {
         $mail = new Mail(array($this->username => $this->email), WCF::getLanguage()->get('wcf.user.register.needActivation.mail.subject', array('PAGE_TITLE' => WCF::getLanguage()->get(PAGE_TITLE))), WCF::getLanguage()->get('wcf.user.register.needActivation.mail', array('PAGE_TITLE' => WCF::getLanguage()->get(PAGE_TITLE), '$username' => $this->username, '$userID' => $this->user->userID, '$activationCode' => $activationCode, 'PAGE_URL' => PAGE_URL, 'MAIL_ADMIN_ADDRESS' => MAIL_ADMIN_ADDRESS)));
         $mail->send();
         $this->message = 'wcf.user.register.needActivation';
     }
     if (REGISTER_ACTIVATION_METHOD == 2) {
         $this->message = 'wcf.user.register.awaitActivation';
     }
     // notify admin
     if (REGISTER_ADMIN_NOTIFICATION) {
         // get default language
         $language = WCF::getLanguage()->getLanguageID() != Language::getDefaultLanguageID() ? new Language(Language::getDefaultLanguageID()) : WCF::getLanguage();
         $language->setLocale();
         // send mail
         $mail = new Mail(MAIL_ADMIN_ADDRESS, $language->get('wcf.user.register.notification.mail.subject', array('PAGE_TITLE' => $language->get(PAGE_TITLE))), $language->get('wcf.user.register.notification.mail', array('PAGE_TITLE' => $language->get(PAGE_TITLE), '$username' => $this->username)));
         $mail->send();
         WCF::getLanguage()->setLocale();
     }
     // delete captcha
     if (REGISTER_USE_CAPTCHA && !WCF::getSession()->getVar('captchaDone')) {
         $this->captcha->delete();
     }
     WCF::getSession()->unregister('captchaDone');
     // login user
     UserAuth::getInstance()->storeAccessData($this->user, $this->username, $this->password);
     $this->saved();
     // forward to index page
     WCF::getTPL()->assign(array('url' => 'index.php' . SID_ARG_1ST, 'message' => WCF::getLanguage()->get($this->message, array('$username' => $this->username, '$email' => $this->email))));
     WCF::getTPL()->display('redirect');
     exit;
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:57,代码来源:RegisterForm.class.php


示例15: do_register2

function do_register2()
{
    global $db, $current_user, $globals;
    if (!ts_is_human()) {
        register_error(_('el código de seguridad no es correcto'));
        return;
    }
    if (!check_user_fields()) {
        return;
    }
    $username = clean_input_string(trim($_POST['username']));
    // sanity check
    $dbusername = $db->escape($username);
    // sanity check
    $password = UserAuth::hash(trim($_POST['password']));
    $email = clean_input_string(trim($_POST['email']));
    // sanity check
    $dbemail = $db->escape($email);
    // sanity check
    $user_ip = $globals['form_user_ip'];
    if (!user_exists($username)) {
        if ($db->query("INSERT INTO users (user_login, user_login_register, user_email, user_email_register, user_pass, user_date, user_ip) VALUES ('{$dbusername}', '{$dbusername}', '{$dbemail}', '{$dbemail}', '{$password}', now(), '{$user_ip}')")) {
            echo '<fieldset>' . "\n";
            echo '<legend><span class="sign">' . _("registro de usuario") . '</span></legend>' . "\n";
            $user = new User();
            $user->username = $username;
            if (!$user->read()) {
                register_error(_('error insertando usuario en la base de datos'));
            } else {
                require_once mnminclude . 'mail.php';
                $sent = send_recover_mail($user);
                $globals['user_ip'] = $user_ip;
                //we force to insert de log with the same IP as the form
                Log::insert('user_new', $user->id, $user->id);
            }
            echo '</fieldset>' . "\n";
        } else {
            register_error(_("error insertando usuario en la base de datos"));
        }
    } else {
        register_error(_("el usuario ya existe"));
    }
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:43,代码来源:register.php


示例16: function

//Sign Up
$app->post('/sign_up', function () use($app) {
    $params = $app->request->params();
    $u = User::exists($params['email']);
    if ($u == 0) {
        //No Exsists
        //   $params['password']= $params['password'];//sha1($params['password']);//Encrypt password
        $r = User::sign_up($params);
        $app->response->body($r);
    } else {
        $app->response->body(json_encode(["error" => "exists"]));
    }
});
//User Jobs
$app->get("/user/jobs/:user_id", function ($user_id) use($app) {
    UserAuth::new_key($user_id);
    $u = User::find($user_id);
    //Find User
    $u->jobs;
    $u->userToken;
    $app->response->body($u->toJson());
});
//Full User Details/Profile
$app->post("/user/profile/", function () use($app) {
    $user_id = $app->request->params('user_id');
    // $token = $app->request->params('token');
    // UserAuth::authenticate($user_id,$token);//Authenticate or Fail
    $u = User::find($user_id);
    //Find User
    //$u->userToken;
    $app->response->body($u->toJson());
开发者ID:Mitsaras1911,项目名称:api,代码行数:31,代码来源:index.php


示例17: save_profile

function save_profile()
{
    global $db, $user, $current_user, $globals, $site_key;
    $errors = 0;
    // benjami: control added (2005-12-22)
    $new_pass = false;
    $messages = '';
    $form_hash = md5($site_key . $user->id . mnminclude);
    if (!isset($_POST['save_profile']) || !isset($_POST['process']) || $_POST['user_id'] != $current_user->user_id) {
        return;
    }
    if (empty($_POST['form_hash']) || $_POST['form_hash'] != $form_hash) {
        $messages .= '<p class="form-error">' . _('Falta la clave de control') . '</p>';
        $errors++;
    }
    if (!empty($_POST['username']) && trim($_POST['username']) != $user->username) {
        if (strlen(trim($_POST['username'])) < 3) {
            $messages .= '<p class="form-error">' . _('nombre demasiado corto') . '</p>';
            $errors++;
        }
        if (!check_username($_POST['username'])) {
            $messages .= '<p class="form-error">' . _('nombre de usuario erróneo, caracteres no admitidos') . '</p>';
            $errors++;
        } elseif (user_exists(trim($_POST['username']))) {
            $messages .= '<p class="form-error">' . _('el usuario ya existe') . '</p>';
            $errors++;
        } else {
            $user->username = trim($_POST['username']);
        }
    }
    if ($user->email != trim($_POST['email']) && !check_email(trim($_POST['email']))) {
        $messages .= '<p class="form-error">' . _('el correo electrónico no es correcto') . '</p>';
        $errors++;
    } elseif (trim($_POST['email']) != $current_user->user_email && email_exists(trim($_POST['email']))) {
        $messages .= '<p class="form-error">' . _('ya existe otro usuario con esa dirección de correo') . '</p>';
        $errors++;
    }
    $user->url = htmlspecialchars(clean_input_url($_POST['url']));
    $user->names = clean_text($_POST['names']);
    if (!empty($_POST['password']) || !empty($_POST['password2'])) {
        if (!check_password($_POST["password"])) {
            $messages .= '<p class="form-error">' . _('Clave demasiado corta, debe ser de 6 o más caracteres e incluir mayúsculas, minúsculas y números') . '</p>';
            $errors = 1;
        } else {
            if (trim($_POST['password']) !== trim($_POST['password2'])) {
                $messages .= '<p class="form-error">' . _('las claves no son iguales, no se ha modificado') . '</p>';
                $errors = 1;
            } else {
                $new_pass = trim($_POST['password']);
                $user->pass = UserAuth::hash($new_pass);
                $messages .= '<p  class="form-error">' . _('La clave se ha cambiado') . '</p>';
                $new_pass = true;
            }
        }
    }
    $user->comment_pref = intval($_POST['comment_pref']) + (intval($_POST['show_friends']) & 1) * 2 + (intval($_POST['show_2cols']) & 1) * 4;
    // Manage avatars upload
    if (!empty($_FILES['image']['tmp_name'])) {
        if (avatars_check_upload_size('image')) {
            $avatar_mtime = avatars_manage_upload($user->id, 'image');
            if (!$avatar_mtime) {
                $messages .= '<p class="form-error">' . _('error guardando la imagen') . '</p>';
                $errors = 1;
                $user->avatar = 0;
            } else {
                $user->avatar = $avatar_mtime;
            }
        } else {
            $messages .= '<p class="form-error">' . _('el tamaño de la imagen excede el límite') . '</p>';
            $errors = 1;
            $user->avatar = 0;
        }
    }
    if (!$errors) {
        if (empty($user->ip)) {
            $user->ip = $globals['user_ip'];
        }
        $user->store();
        $user->read();
        if ($current_user->user_login != $user->username || $current_user->user_email != $user->email || $new_pass) {
            $current_user->Authenticate($user->username, $new_pass);
        }
        $messages .= '<p class="form-error">' . _('datos actualizados') . '</p>';
    }
    return $messages;
}
开发者ID:manelio,项目名称:woolr,代码行数:86,代码来源:profile.php


示例18: checkEmailConfirmation

 /**
  * Check email confirmation code
  *
  * @return true;
  */
 public function checkEmailConfirmation($h)
 {
     $user_id = $h->cage->get->getInt('id');
     $conf = $h->cage->get->getAlnum('conf');
     $user = new UserAuth();
     $user->getUserBasic($h, $user_id);
     if (!$user_id || !$conf) {
         $h->messages[$h->lang['user_signin_register_emailconf_fail']] = 'red';
     }
     $sql = "SELECT user_email_conf FROM " . TABLE_USERS . " WHERE user_id = %d";
     $user_email_conf = $h->db->get_var($h->db->prepare($sql, $user_id));
     if ($conf === $user_email_conf) {
         // update role:
         $user->role = $h->vars['regStatus'];
         $h->pluginHook('user_signin_email_conf_post_role');
         // update user with new permissions:
         $new_perms = $user->getDefaultPermissions($h, $user->role);
         unset($new_perms['options']);
         // don't need this for individual users
         $user->setAllPermissions($new_perms);
         $user->updatePermissions($h);
         $user->updateUserBasic($h);
         // set email valid to 1:
         $sql = "UPDATE " . TABLE_USERS . " SET user_email_valid = %d WHERE user_id = %d";
         $h->db->query($h->db->prepare($sql, 1, $user->id));
         // notify chosen mods of new user by email:
         if ($h->vars['useEmailNotify'] == 'checked' && file_exists(PLUGINS . 'users/libs/UserFunctions.php')) {
             require_once PLUGINS . 'users/libs/UserFunctions.php';
             $uf = new UserFunctions();
             $uf->notifyMods($h, 'user', $user->role, $user->id);
         }
         $success_message = $h->lang['user_signin_register_emailconf_success'] . " <br /><b><a href='" . $h->url(array('page' => 'login')) . "'>" . $h->lang['user_signin_register_emailconf_success_login'] . "</a></b>";
         $h->messages[$success_message] = 'green';
     } else {
         $h->messages[$h->lang['user_signin_register_emailconf_fail']] = 'red';
     }
     return true;
 }
开发者ID:shibuya246,项目名称:Hotaru-Plugins,代码行数:43,代码来源:user_signin.php


示例19: user_return

 function user_return()
 {
     global $globals;
     // syslog(LOG_INFO, "user_return: ". $this->return. "  COOKIE: ".$_COOKIE['return']);
     setcookie('return', '', time() - 10000, $globals['base_url'], UserAuth::domain());
     setcookie('return', '', time() - 10000, $globals['base_url']);
     if (!empty($this->return)) {
         header('Location: http://' . get_server_name() . $this->return);
     } else {
         header('Location: http://' . get_server_name() . $globals['base_url']);
     }
     exit;
 }
开发者ID:brainsqueezer,项目名称:fffff,代码行数:13,代码来源:base.php


示例20: createAuthUser

 /**
  * Создание пользователя из соцсети
  */
 public static function createAuthUser($attributes)
 {
     $user = new User();
     $auth = new UserAuth();
     $user->attributes = $attributes;
     $auth->attributes = $attributes;
     $user->setAttributes(array('created' => date('Y-m-d H:i:s'), 'changed' => date('Y-m-d H:i:s'), 'last_visit' => time(), 'registration_ip' => Yii::app()->request->userHostAddress, 'status' => self::STATUS_ACTIVE, 'is_social_user' => self::SOCIAL_USER_YES));
     $auth->setAttributes(array('created' => date('Y-m-d H:i:s'), 'changed' => date('Y-m-d H:i:s')));
     if ($attributes['photo']) {
         $photo = new Photo();
         $photo->filename = String::randomString(12);
         $user->avatar = $photo->uploadImage($attributes['photo'], param('images/user'));
         $auth->service_user_pic = $attributes['photo'];
     }
     $user->auth = $auth;
     if ($user->withRelated->save(false, array('auth'))) {
         return $user;
     } else {
         throw new Exception('Пользователь не создался ... ');
     }
 }
开发者ID:amanukian,项目名称:test,代码行数:24,代码来源:User.php



注:本文中的UserAuth类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP UserCache类代码示例发布时间:2022-05-23
下一篇:
PHP UserAttributeKey类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap