本文整理汇总了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");
}
}
}
}
示例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");
}
}
}
}
示例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 {