當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sotf_Utils::randString方法代碼示例

本文整理匯總了PHP中sotf_Utils::randString方法的典型用法代碼示例。如果您正苦於以下問題:PHP sotf_Utils::randString方法的具體用法?PHP sotf_Utils::randString怎麽用?PHP sotf_Utils::randString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sotf_Utils的用法示例。


在下文中一共展示了sotf_Utils::randString方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sotf_Page

 function sotf_Page()
 {
     global $lang, $user, $outputLanguages, $smarty, $defaultLanguage;
     global $nodeId, $basedir, $lang, $rootdir, $imagedir, $smartyDebug, $debug;
     // start session
     session_start();
     // load user data
     if ($_SESSION['userid']) {
         //debug("userid", $_SESSION['userid']);
         $this->user = new sotf_User($_SESSION['userid']);
     }
     // Currently it is not needed
     /*else
     		{
     			$this->user = new sotf_User();
     		}*/
     $user = $this->user;
     // determine language
     if ($this->user) {
         $lang = $this->user->language;
         if (!in_array($lang, $outputLanguages)) {
             $lang = '';
         }
         // user's language is not allowed yet
     }
     if (!$lang && in_array($_SERVER['HTTP_ACCEPT_LANGUAGE'], $outputLanguages)) {
         $lang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
     }
     if (!$lang) {
         $lang = $defaultLanguage;
     }
     // load localization constants for language
     $this->loadLoc();
     // determine the action
     preg_match('/(\\w+)\\.php$/', $_SERVER['SCRIPT_NAME'], $m);
     $this->action = $m[1];
     // auth key generation
     if (!$this->loggedIn()) {
         if (!$this->getAuthKey()) {
             $key = sotf_Utils::randString(30);
             //debug("KEY", $key);
             $c = base64_encode(myGetenv("REMOTE_ADDR") . ':' . $key);
             if (!setcookie($this->authKeyName, $c, time() + 365 * 24 * 3600, '/')) {
                 debug("could not set cookie for auth key");
             }
         }
     }
 }
開發者ID:BackupTheBerlios,項目名稱:sotf,代碼行數:48,代碼來源:sotf_Page.class.php

示例2: sotf_Page

 function sotf_Page()
 {
     global $lang, $user, $config, $smarty;
     // load user data
     if ($_SESSION['currentUserId']) {
         //debug("userid", $_SESSION['currentUserId']);
         $this->user = new sotf_User($_SESSION['currentUserId']);
     }
     // Currently it is not needed
     /*else
     		{
     			$this->user = new sotf_User();
     		}*/
     $user = $this->user;
     // determine language
     $lang = sotf_Utils::getParameter('uiLang');
     if (!$lang) {
         $lang = $_COOKIE['uiLang'];
     }
     if (!$lang && $this->user) {
         $lang = $this->user->language;
     }
     debug("LANG1", $lang);
     // check if this is an allowed language
     $langOK = false;
     foreach ($config['outputLanguages'] as $oLang) {
         if ($lang == $oLang[0]) {
             $langOK = true;
             break;
         }
     }
     if (!$langOK) {
         $lang = '';
     }
     // user's language is not allowed yet
     debug("LANG2", $lang);
     /*
     	if(!$lang && in_array($_SERVER['HTTP_ACCEPT_LANGUAGE'], $config['outputLanguages']))
       $lang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
     */
     if (!$lang) {
         $lang = $config['defaultLanguage'];
     }
     debug("LANG5", $lang);
     // load localization constants for language
     $this->loadLoc();
     // determine the action
     preg_match('/(\\w+)\\.php$/', $_SERVER['SCRIPT_NAME'], $m);
     $this->action = $m[1];
     // auth key generation
     if (!headers_sent() && !$this->loggedIn()) {
         if (!$this->getAuthKey()) {
             $key = sotf_Utils::randString(30);
             //debug("KEY", $key);
             $c = base64_encode(myGetenv("REMOTE_ADDR") . ':' . $key);
             if (!setcookie($this->authKeyName, $c, time() + 365 * 24 * 3600, '/')) {
                 debug("could not set cookie for auth key");
             }
         }
     }
 }
開發者ID:BackupTheBerlios,項目名稱:sotf-svn,代碼行數:61,代碼來源:sotf_Page.class.php

示例3: sotf_User

 * Created for the StreamOnTheFly project (IST-2001-32226)
 * Author: Martin Schmidt, ptmschmidt@fh-stpoelten.ac.at
 */
require "init.inc.php";
$username = sotf_Utils::getParameter('userid');
$email = sotf_Utils::getParameter('email');
$okURL = sotf_Utils::getParameter('okURL');
if ($username && $email) {
    $temp_user = new sotf_User();
    $storage = $temp_user->getStorageObject();
    $fields['userid'] = $temp_user->getUserid($username);
    if ($fields['userid'] != NULL) {
        $data = $storage->userDbSelect($fields);
    }
    if ($email == $data['email'] && $username == $data['username']) {
        $new_password = sotf_Utils::randString(6);
        global $page;
        $login_href = "http://" . $_SERVER['HTTP_HOST'] . $config['localPrefix'] . "/login.php";
        $subject = $page->getlocalized("pass_mail_subject");
        $message = $page->getlocalizedWithParams("pass_mail_message", $username, $new_password, $login_href);
        mail($email, $subject, $message, "From: no-reply@streamonthefly.org\r\nX-Mailer: PHP/" . phpversion() . "\r\nMIME-Version: 1.0\r\nContent-Type: text/html; charset=utf-8\r\nContent-Transfer-Encoding: 8bit\r\n\r\n");
        $fields['password'] = $new_password;
        $fields['email'] = $email;
        $storage->userDbUpdate($fields);
    } else {
        $errorMsg = $page->getlocalized("new_pass_error");
    }
    if (!$errorMsg) {
        if ($okURL) {
            $page->redirect($okURL);
        } else {
開發者ID:BackupTheBerlios,項目名稱:sotf-svn,代碼行數:31,代碼來源:newPassword.php


注:本文中的sotf_Utils::randString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。