当前位置: 首页>>代码示例>>PHP>>正文


PHP randString函数代码示例

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


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

示例1: checkUploadScriptExecution

 /**
  * Check if any server-side script executed in /upload dir and push those information to detail error
  * @return bool
  */
 protected function checkUploadScriptExecution()
 {
     $baseMessageKey = "SECURITY_SITE_CHECKER_UPLOAD_EXECUTABLE";
     if (self::isHtaccessOverrided()) {
         $isHtaccessOverrided = true;
         $this->addUnformattedDetailError("SECURITY_SITE_CHECKER_UPLOAD_HTACCESS", CSecurityCriticalLevel::LOW);
     } else {
         $isHtaccessOverrided = false;
     }
     $uniqueString = randString(20);
     if (self::isScriptExecutable("test.php", "<?php echo '{$uniqueString}'; ?>", $uniqueString)) {
         $isPhpExecutable = true;
         $this->addUnformattedDetailError($baseMessageKey . "_PHP", CSecurityCriticalLevel::LOW);
     } else {
         $isPhpExecutable = false;
     }
     if (!$isPhpExecutable && self::isScriptExecutable("test.php.any", "<?php echo '{$uniqueString}'; ?>", $uniqueString)) {
         $isPhpDoubleExtensionExecutable = true;
         $this->addUnformattedDetailError($baseMessageKey . "_PHP_DOUBLE", CSecurityCriticalLevel::LOW);
     } else {
         $isPhpDoubleExtensionExecutable = false;
     }
     if (self::isScriptExecutable("test.py", "print 'Content-type:text/html\\r\\n\\r\\n{$uniqueString}'", $uniqueString)) {
         $isPythonCgiExecutable = true;
         $this->addUnformattedDetailError($baseMessageKey . "_PY", CSecurityCriticalLevel::LOW);
     } else {
         $isPythonCgiExecutable = false;
     }
     return !($isPhpExecutable || $isPhpDoubleExtensionExecutable || $isHtaccessOverrided || $isPythonCgiExecutable);
 }
开发者ID:spas-viktor,项目名称:books,代码行数:34,代码来源:environment.php

示例2: registerControl

 public function registerControl($CID, $controlId = "")
 {
     if (func_num_args() == 1) {
         $controlId = $CID;
         $CID = "";
     }
     $CID = !empty($CID) ? $CID : md5(randString(15));
     $this->initSession($CID, $controlId);
     return $CID;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:10,代码来源:fileinpututility.php

示例3: __get_vve_uid

 function __get_vve_uid()
 {
     static $arUid = array();
     $uid = randString(5);
     while (in_array($uid, $arUid)) {
         $uid = randString(5);
     }
     $arUid[] = $uid;
     return $uid;
 }
开发者ID:spas-viktor,项目名称:books,代码行数:10,代码来源:result_modifier.php

示例4: set

 public static function set($msg, $level = 'Notice')
 {
     if ($level != 'Notice') {
         self::emailError($msg);
     }
     loadFunc('randString');
     $db = self::db();
     $msg = $db->quote($msg);
     defined('LOGRAND') || define('LOGRAND', randString('4'));
     $sql = "INSERT INTO log (session, level, message) VALUES ('" . LOGRAND . "', '{$level}', {$msg});";
     //echo $sql;die;
     $db->exec($sql);
 }
开发者ID:robotamer,项目名称:oldstuff,代码行数:13,代码来源:Logger.php

示例5: sendVerificationEmail

 static function sendVerificationEmail($user)
 {
     if ($user->verified == "true") {
         return false;
     }
     $user->email_verification_code = randString(70);
     $user->save();
     if (sendEmail(array("from" => array("email" => getSiteEmail(), "name" => getSiteName()), "to" => array("email" => $user->email, "name" => $user->first_name . " " . $user->last_name), "subject" => display("email/verify_email_subject", array("user_guid" => $user->guid)), "body" => display("email/verify_email_body", array("user_guid" => $user->guid))))) {
         return true;
     }
     $user->email_verification_code = NULL;
     $user->save();
     return false;
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:14,代码来源:Email.php

示例6: SaveFile

 public static function SaveFile($arFile, $arFileStorage)
 {
     $arResult = array();
     if (empty($arFile)) {
         $arResult = array("ERROR_CODE" => "EMPTY_FILE", "ERROR_MESSAGE" => "File is empty");
     }
     if (!empty($arFileStorage["DISC_FOLDER"])) {
         $file = $arFileStorage["DISC_FOLDER"]->uploadFile($arFile, array('NAME' => $arFile["name"], 'CREATED_BY' => $GLOBALS["USER"]->GetID()), array(), true);
         $arResult["ID"] = $file->getId();
     } elseif (!empty($arFileStorage["WEBDAV_DATA"]) && !empty($arFileStorage["WEBDAV_IBLOCK_OBJECT"])) {
         $dropTargetID = $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->GetMetaID("DROPPED");
         $arParent = $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->GetObject(array("section_id" => $dropTargetID));
         if (!$arParent["not_found"]) {
             $path = $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->_get_path($arParent["item_id"], false);
             $tmpName = str_replace(array(":", ".", "/", "\\"), "_", ConvertTimeStamp(time(), "FULL"));
             $tmpOptions = array("path" => str_replace("//", "/", $path . "/" . $tmpName));
             $arParent = $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->GetObject($tmpOptions);
             if ($arParent["not_found"]) {
                 $rMKCOL = $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->MKCOL($tmpOptions);
                 if (intval($rMKCOL) == 201) {
                     $arFileStorage["WEBDAV_DATA"]["SECTION_ID"] = $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->arParams["changed_element_id"];
                 }
             } else {
                 $arFileStorage["WEBDAV_DATA"]["SECTION_ID"] = $arParent['item_id'];
                 if (!$arFileStorage["WEBDAV_IBLOCK_OBJECT"]->CheckUniqueName($tmpName, $arFileStorage["WEBDAV_DATA"]["SECTION_ID"], $tmpRes)) {
                     $path = $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->_get_path($arFileStorage["WEBDAV_DATA"]["SECTION_ID"], false);
                     $tmpName = randString(6);
                     $tmpOptions = array("path" => str_replace("//", "/", $path . "/" . $tmpName));
                     $rMKCOL = $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->MKCOL($tmpOptions);
                     if (intval($rMKCOL) == 201) {
                         $arFileStorage["WEBDAV_DATA"]["SECTION_ID"] = $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->arParams["changed_element_id"];
                     }
                 }
             }
         }
         $options = array("new" => true, 'dropped' => true, "arFile" => $arFile, "arDocumentStates" => false, "arUserGroups" => array_merge($arFileStorage["WEBDAV_IBLOCK_OBJECT"]->USER["GROUPS"], array("Author")), "FILE_NAME" => $arFile["name"], "IBLOCK_ID" => $arFileStorage["WEBDAV_DATA"]["IBLOCK_ID"], "IBLOCK_SECTION_ID" => $arFileStorage["WEBDAV_DATA"]["SECTION_ID"], "USER_FIELDS" => array());
         $GLOBALS['USER_FIELD_MANAGER']->EditFormAddFields($arFileStorage["WEBDAV_IBLOCK_OBJECT"]->GetUfEntity(), $options['USER_FIELDS']);
         $GLOBALS["DB"]->StartTransaction();
         if (!$arFileStorage["WEBDAV_IBLOCK_OBJECT"]->put_commit($options)) {
             $arResult = array("ERROR_CODE" => "error_put", "ERROR_MESSAGE" => $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->LAST_ERROR);
             $GLOBALS["DB"]->Rollback();
         } else {
             $GLOBALS["DB"]->Commit();
             $arResult["ID"] = $options['ELEMENT_ID'];
         }
     } else {
         $arResult["ID"] = CFile::SaveFile($arFile, $arFile["MODULE_ID"]);
     }
     return $arResult;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:50,代码来源:mobile_helper.php

示例7: init

 /**
  * Initializing method: Removes slashes from GPC.
  *
  * @return Recipe_Request_IDS
  */
 protected function init()
 {
     parent::init();
     $this->setIds(new IDS_Monitor(array("GET" => $_GET, "POST" => $_POST, "COOKIE" => $_COOKIE), IDS_Init::init(RD . "IDS/Config/Config.ini")), array("sqli", "spam", "dt"));
     $result = $this->getIds()->run();
     if (!$result->isEmpty()) {
         $report = $result->__toString();
         $report .= "<br/>URI: " . $_SERVER["REQUEST_URI"] . "<br/>IP-Address: " . IPADDRESS;
         echo $report;
         $file = randString(8) . ".html";
         file_put_contents(AD . "var/reports/injection_" . $file, $report);
         exit;
     }
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:20,代码来源:IDS.php

示例8: generateFilename

function generateFilename($filetype)
{
    if ($filetype == "image/jpeg" || $filetype == "image/pjpeg") {
        $ext = ".jpg";
    } else {
        if ($filetype == "image/png" || $filetype == "image/x-png") {
            $ext = ".png";
        } else {
            if ($filetype == "image/gif") {
                $ext = ".gif";
            }
        }
    }
    return randString(12) . $ext;
}
开发者ID:quchunguang,项目名称:test,代码行数:15,代码来源:feedback.php

示例9: prepareParams

 protected function prepareParams()
 {
     parent::prepareParams();
     if (isset($this->arParams['BREADCRUMBS_ID']) && $this->arParams['BREADCRUMBS_ID'] !== '') {
         $this->arParams['BREADCRUMBS_ID'] = preg_replace('/[^a-z0-9_]/i', '', $this->arParams['BREADCRUMBS_ID']);
     } else {
         $this->arParams['BREADCRUMBS_ID'] = 'breadcrumbs_' . strtolower(randString(5));
     }
     if (!isset($this->arParams['SHOW_ONLY_DELETED'])) {
         $this->arParams['SHOW_ONLY_DELETED'] = false;
     }
     if (!isset($this->arParams['BREADCRUMBS'])) {
         $this->arParams['BREADCRUMBS'] = array();
     }
     return $this;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:16,代码来源:class.php

示例10: getRandomeStr

function getRandomeStr($num)
{
    $random_string = randString($num);
    //dd($random_string);
    $is_unique = false;
    while (!$is_unique) {
        $result = Cita::where('folio', '=', $random_string)->first();
        if (!$result) {
            // if you don't get a result, then you're good
            $is_unique = true;
        } else {
            // if you DO get a result, keep trying
            $random_string = randString($num);
        }
    }
    return $random_string;
}
开发者ID:rikardote,项目名称:agenda,代码行数:17,代码来源:helpers.php

示例11: printError

 /**
  * Prints this error.
  *
  * @return Recipe_Exception_Generic
  */
 public function printError()
 {
     if (LOG_EXCEPTIONS) {
         ob_start();
         $file = randString(8);
         require_once AD . "app/templates/error.phtml";
         $report = ob_get_contents();
         $path = AD . "var/reports/exception_" . $file . ".html";
         file_put_contents($path, $report);
         chmod($path, 0766);
         exit;
         ob_end_flush();
     }
     require_once AD . "app/templates/error.phtml";
     exit;
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:22,代码来源:Generic.php

示例12: forgotpassword

function forgotpassword()
{
    global $handler;
    global $mailer;
    global $mail;
    global $emptyerror;
    global $catcherror;
    global $notactive;
    global $emailDoesNotExist;
    global $website_url;
    global $error;
    global $contactemail;
    if (!empty($_POST['email'])) {
        $email = $_POST['email'];
        $checkuser = $handler->prepare("SELECT * FROM users WHERE email = :email");
        $checkuser->execute([':email' => $email]);
        if ($checkuser->rowCount()) {
            $fetch = $checkuser->fetch(PDO::FETCH_ASSOC);
            $password = randString(10);
            if ($mailer === '0') {
                mail($email, 'Password reset', "You requested a new password for your account on {$website_url}:<br />\r\n\n                    Your username is: {$fetch['username']}<br />\n                    Your new password is: {$password}<br /><br />\n                    It is safer if your password when you login.", "From: {$contactemail}");
            } elseif ($mailer === '1') {
                $mail->setFrom($contactemail);
                $mail->addAddress($email);
                // Add a recipient
                $mail->isHTML(true);
                // Set email format to HTML
                $mail->Subject = 'Password reset';
                $mail->Body = "You requested a new password for your account on {$website_url}:<br />\r\n\n                    Your username is: {$fetch['username']}<br />\n                    Your new password is: {$password}<br /><br />\n                    It is safer if your password when you login.";
                if (!$mail->send()) {
                    echo $error;
                }
            }
            $options = ['cost' => 11];
            $password = password_hash($password, PASSWORD_BCRYPT, $options);
            perry('UPDATE users SET password = :password WHERE email = :email', [':password' => $password, ':email' => $fetch['email']]);
            setcookie('newpassword', 'newpassword', time() + 10);
            header("refresh:0;url={$website_url}p/login");
        } else {
            echo $emailDoesNotExist;
        }
    }
}
开发者ID:MrGoatsy,项目名称:GoatBB,代码行数:43,代码来源:forgotpassword.php

示例13: onPrepareComponentParams

 public function onPrepareComponentParams($params)
 {
     $params["TYPE"] = isset($params["TYPE"]) ? trim($params["TYPE"]) : "";
     if ($params["NOINDEX"] != "Y") {
         $params["NOINDEX"] = "N";
     }
     if ($params["CACHE_TYPE"] == "Y" || $params["CACHE_TYPE"] == "A" && COption::GetOptionString("main", "component_cache_on", "Y") == "Y") {
         $params["CACHE_TIME"] = intval($params["CACHE_TIME"]);
     } else {
         $params["CACHE_TIME"] = 0;
     }
     if (isset($params['QUANTITY']) && intval($params['QUANTITY']) > 0) {
         $params['QUANTITY'] = intval($params['QUANTITY']);
     } else {
         $params['QUANTITY'] = 1;
     }
     $params['ID'] = randString(5);
     $params['BANNER_ID'] = intval($params["BANNER_ID"]);
     return $params;
 }
开发者ID:k-kalashnikov,项目名称:geekcon,代码行数:20,代码来源:class.php

示例14: captchaListener

 static function captchaListener()
 {
     if (isset($_GET['qgcaptcha'])) {
         $ticket = $_GET['qgcaptcha'];
         $text = randString(5, "abcdefghijkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ23456789");
         $_SESSION['qg_rTicket'][$ticket]['captcha'] = $text;
         header('Content-type: image/png');
         $img = ImageCreateFromPNG(sysPATH . 'core/util/rTicket/captchabg.png');
         //Backgroundimage
         $color = ImageColorAllocate($img, 0, 0, 0);
         //Farbe
         $ttf = sysPATH . 'core/util/rTicket/xfiles.ttf';
         //Schriftart
         $ttfsize = 13;
         //Schriftgrösse
         $angle = rand(0, 7);
         $t_x = rand(5, 20);
         $t_y = 23;
         imagettftext($img, $ttfsize, $angle, $t_x, $t_y, $color, $ttf, $text);
         imagepng($img);
         imagedestroy($img);
         Abort();
     }
 }
开发者ID:atifzaidi,项目名称:shwups-cms,代码行数:24,代码来源:rTicket.php

示例15: unset

     }
     unset($arDirValue["UF_DELETE"]);
 }
 if (!is_array($arDirValue) || !isset($arDirValue['UF_NAME']) || '' == trim($arDirValue['UF_NAME'])) {
     continue;
 }
 if (isset($arImageResult[$dirKey]["FILE"]) && is_array($arImageResult[$dirKey]["FILE"]) && $arImageResult[$dirKey]["FILE"]['name'] != '' || isset($_POST['PROPERTY_DIRECTORY_VALUES_del'][$dirKey]["FILE"]) && $_POST['PROPERTY_DIRECTORY_VALUES_del'][$dirKey]["FILE"] == 'Y') {
     $arDirValue['UF_FILE'] = $arImageResult[$dirKey]["FILE"];
 }
 if ($arDirValue["ID"] == $_POST['PROPERTY_VALUES_DEF']) {
     $arDirValue['UF_DEF'] = true;
 } else {
     $arDirValue['UF_DEF'] = false;
 }
 if (!isset($arDirValue["UF_XML_ID"]) || $arDirValue["UF_XML_ID"] == '') {
     $arDirValue['UF_XML_ID'] = randString(8);
 }
 if ($_POST["PROPERTY_USER_TYPE_SETTINGS"]["TABLE_NAME"] == '-1' && isset($result) && $result->isSuccess()) {
     $entityDataClass::add($arDirValue);
 } else {
     if (isset($arDirValue["ID"]) && $arDirValue["ID"] > 0) {
         $rsData = $entityDataClass::getList(array());
         while ($arData = $rsData->fetch()) {
             $arAddField = array();
             if (!isset($arData["UF_DESCRIPTION"])) {
                 $arAddField[] = 'UF_DESCRIPTION';
             }
             if (!isset($arData["UF_FULL_DESCRIPTION"])) {
                 $arAddField[] = 'UF_FULL_DESCRIPTION';
             }
             $obUserField = new CUserTypeEntity();
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:iblock_edit_property.php


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