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


PHP random_str函数代码示例

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


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

示例1: upgrade15_dbchanges

function upgrade15_dbchanges()
{
    global $db, $output, $mybb, $cache;
    $output->print_header("Performing Queries");
    echo "<p>Performing necessary upgrade queries..</p>";
    flush();
    if ($db->type != "pgsql") {
        $db->update_query("settinggroups", array('isdefault' => '1'), "isdefault='yes'");
        $db->update_query("settinggroups", array('isdefault' => '0'), "isdefault='no'");
        $db->write_query("ALTER TABLE " . TABLE_PREFIX . "events CHANGE timezone timezone varchar(4) NOT NULL default '0'");
    }
    if ($db->type == "pgsql") {
        $db->write_query("ALTER TABLE " . TABLE_PREFIX . "warnings ALTER COLUMN revokereason SET default ''");
        $db->write_query("ALTER TABLE " . TABLE_PREFIX . "warnings ALTER COLUMN notes SET default ''");
    }
    $cache->update("internal_settings", array('encryption_key' => random_str(32)));
    if ($db->type != "sqlite2" && $db->type != "sqlite3") {
        $ip_index = $db->index_exists("sessions", "ip");
        if ($ip_index == false) {
            if ($db->type == "pgsql") {
                $db->write_query("CREATE INDEX ip ON " . TABLE_PREFIX . "sessions (ip)");
            } else {
                $db->write_query("ALTER TABLE " . TABLE_PREFIX . "sessions ADD INDEX (`ip`)");
            }
        }
    }
    $contents .= "Click next to continue with the upgrade process.</p>";
    $output->print_contents($contents);
    $output->print_footer("15_usernameverify");
}
开发者ID:benn0034,项目名称:SHIELDsite2.old,代码行数:30,代码来源:upgrade15.php

示例2: upgrade15_dbchanges

function upgrade15_dbchanges()
{
    global $db, $output, $mybb, $cache;
    $output->print_header("Wykonywanie zapytań");
    echo "<p>Trwa wykonywanie wymaganych zapytań do bazy danych...</p>";
    flush();
    if ($db->type != "pgsql") {
        $db->update_query("settinggroups", array('isdefault' => '1'), "isdefault='yes'");
        $db->update_query("settinggroups", array('isdefault' => '0'), "isdefault='no'");
        $db->write_query("ALTER TABLE " . TABLE_PREFIX . "events CHANGE timezone timezone varchar(4) NOT NULL default '0'");
    }
    if ($db->type == "pgsql") {
        $db->write_query("ALTER TABLE " . TABLE_PREFIX . "warnings ALTER COLUMN revokereason SET default ''");
        $db->write_query("ALTER TABLE " . TABLE_PREFIX . "warnings ALTER COLUMN notes SET default ''");
    }
    $cache->update("internal_settings", array('encryption_key' => random_str(32)));
    if ($db->type != "sqlite") {
        $ip_index = $db->index_exists("sessions", "ip");
        if ($ip_index == false) {
            if ($db->type == "pgsql") {
                $db->write_query("CREATE INDEX ip ON " . TABLE_PREFIX . "sessions (ip)");
            } else {
                $db->write_query("ALTER TABLE " . TABLE_PREFIX . "sessions ADD INDEX (`ip`)");
            }
        }
    }
    $contents .= "Naciśnij przycisk Dalej, aby kontynuować proces aktualizacji.</p>";
    $output->print_contents($contents);
    $output->print_footer("15_usernameverify");
}
开发者ID:Nidrax,项目名称:ppm-1.6,代码行数:30,代码来源:upgrade15.php

示例3: create

 function create($a)
 {
     if (!$a["id"]) {
         $a["id"] = random_str();
     }
     $a['created_at'] = date("Y/m/d H:i:s");
     //$a['cookie']=@$_COOKIE['cookie'];
     $this->lastid = $a["id"];
     $lines = $this->get_lines();
     $head = explode("\t", array_shift($lines));
     $head_num = count($head);
     $b = array();
     for ($i = 0; $i < $head_num; $i++) {
         if ($a[$head[$i]]) {
             $b[] = $this->escape($a[$head[$i]]);
         } else {
             $b[] = "";
         }
     }
     $handle = fopen(SAFEPATH . $this->tablename, 'a');
     if (flock($handle, LOCK_EX)) {
         $line = implode("\t", $b);
         fwrite($handle, $line . "\n");
         flock($handle, LOCK_UN);
         // ロックを解放します
     } else {
         fclose($fp);
         return false;
     }
     fclose($fp);
     return $a;
 }
开发者ID:tranngocthang89,项目名称:basephpmvc,代码行数:32,代码来源:DBFLAT.php

示例4: authpic

 function authpic()
 {
     $random = random_str(4, "123456789");
     $_SESSION["authcode"] = $random;
     code2pic($random);
     exit;
 }
开发者ID:tranngocthang89,项目名称:basephpmvc,代码行数:7,代码来源:out_controller.php

示例5: upload_attach_func

function upload_attach_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    $lang->load("member");
    $parser = new postParser();
    $input = Tapatalk_Input::filterXmlInput(array('forum_id' => Tapatalk_Input::INT, 'group_id' => Tapatalk_Input::STRING, 'content' => Tapatalk_Input::STRING), $xmlrpc_params);
    $fid = $input['forum_id'];
    //return xmlrespfalse(print_r($_FILES, true));
    // Fetch forum information.
    $forum = get_forum($fid);
    if (!$forum) {
        return xmlrespfalse($lang->error_invalidforum);
    }
    $forumpermissions = forum_permissions($fid);
    if ($forum['open'] == 0 || $forum['type'] != "f") {
        return xmlrespfalse($lang->error_closedinvalidforum);
    }
    if ($mybb->user['uid'] < 1 || $forumpermissions['canview'] == 0 || $forumpermissions['canpostthreads'] == 0 || $mybb->user['suspendposting'] == 1) {
        return tt_no_permission();
    }
    // Check if this forum is password protected and we have a valid password
    tt_check_forum_password($forum['fid']);
    $posthash = $input['group_id'];
    if (empty($posthash)) {
        $posthash = md5($mybb->user['uid'] . random_str());
    }
    $mybb->input['posthash'] = $posthash;
    if (!empty($mybb->input['pid'])) {
        $attachwhere = "pid='{$mybb->input['pid']}'";
    } else {
        $attachwhere = "posthash='{$posthash}'";
    }
    $query = $db->simple_select("attachments", "COUNT(aid) as numattachs", $attachwhere);
    $attachcount = $db->fetch_field($query, "numattachs");
    //if(is_array($_FILES['attachment']['name'])){
    foreach ($_FILES['attachment'] as $k => $v) {
        if (is_array($_FILES['attachment'][$k])) {
            $_FILES['attachment'][$k] = $_FILES['attachment'][$k][0];
        }
    }
    //}
    if ($_FILES['attachment']['type'] == 'image/jpg') {
        $_FILES['attachment']['type'] = 'image/jpeg';
    }
    // If there's an attachment, check it and upload it
    if ($_FILES['attachment']['size'] > 0 && $forumpermissions['canpostattachments'] != 0 && ($mybb->settings['maxattachments'] == 0 || $attachcount < $mybb->settings['maxattachments'])) {
        require_once MYBB_ROOT . "inc/functions_upload.php";
        $attachedfile = upload_attachment($_FILES['attachment'], false);
    }
    if (empty($attachedfile)) {
        return xmlrespfalse("No file uploaded");
    }
    //return xmlrespfalse(print_r($attachedfile, true));
    if ($attachedfile['error']) {
        return xmlrespfalse(implode(" :: ", $attachedfile['error']));
    }
    $result = new xmlrpcval(array('attachment_id' => new xmlrpcval($attachedfile['aid'], 'string'), 'group_id' => new xmlrpcval($posthash, 'string'), 'result' => new xmlrpcval(true, 'boolean'), 'result_text' => new xmlrpcval('', 'base64'), 'file_size' => new xmlrpcval($attachedfile['filesize'], 'int')), 'struct');
    return new xmlrpcresp($result);
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:59,代码来源:upload_attach.php

示例6: create_payment_id

 /**
  * Create & Assign a new payment ID to user 
  * 
  * @param   object      User
  * @return  string      payment id    
  */
 public function create_payment_id($user)
 {
     $res = false;
     // Keep generating payment id until successfully inserted.
     while (!$res) {
         $payment_id = random_str(64);
         $sql = insert_query('users_cn_payment_ids', array('asset_id' => $this->id, 'payment_id' => $payment_id, 'user_id' => $user->id(), 'date_created' => array('UTC_TIMESTAMP()')));
         $res = db()->query($sql);
     }
     return $payment_id;
 }
开发者ID:songproducer,项目名称:xmr-integration,代码行数:17,代码来源:class.cryptonote.php

示例7: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest('/token/314159265?state=' . random_str(20));
         }
     }
     return $next($request);
 }
开发者ID:3x14159265,项目名称:telegramlogin,代码行数:18,代码来源:Authenticate.php

示例8: get_user_from_cookie

/**
 * This function return user if user is logged in and update It's expire time.
 * If user is not logged in , returns false;
 * @return bool|WP_USER
 */
function get_user_from_cookie()
{
    if (!isset($_COOKIE[COOKIE_NAME])) {
        return false;
    }
    $user = get_user_by('ID', substr($_COOKIE[COOKIE_NAME], 34, strlen($_COOKIE[COOKIE_NAME]) - 56));
    if ($user) {
        setcookie(COOKIE_NAME, random_str(34) . strval($user->ID) . random_str(22), time() + 21600, '/');
        return $user;
    }
    return false;
}
开发者ID:alihoseiny,项目名称:Shek,代码行数:17,代码来源:get_user.php

示例9: convert_data

 function convert_data($data)
 {
     global $db, $error_notice, $mybb;
     $error_notice = "";
     $insert_data = array();
     // Invision Power Board 2 values
     $insert_data['import_aid'] = $data['attach_id'];
     $posthash = $this->get_import->post_attachment_details($data['attach_pid']);
     $insert_data['pid'] = $posthash['pid'];
     if ($posthash['posthash']) {
         $insert_data['posthash'] = $posthash['posthash'];
     } else {
         $insert_data['posthash'] = md5($posthash['tid'] . $posthash['uid'] . random_str());
     }
     $insert_data['filetype'] = $this->get_attach_type($data['attach_ext']);
     // Check if it is it an image
     switch (strtolower($insert_data['filetype'])) {
         case "image/gif":
         case "image/jpeg":
         case "image/x-jpg":
         case "image/x-jpeg":
         case "image/pjpeg":
         case "image/jpg":
         case "image/png":
         case "image/x-png":
             $is_image = 1;
             break;
         default:
             $is_image = 0;
             break;
     }
     // should have thumbnail if it's an image
     if ($is_image == 1) {
         $insert_data['thumbnail'] = 'SMALL';
     } else {
         $insert_data['thumbnail'] = '';
     }
     $insert_data['posthash'] = $data['attach_post_key'];
     $insert_data['uid'] = $this->get_import->uid($data['attach_member_id']);
     $insert_data['filename'] = $data['attach_file'];
     $insert_data['attachname'] = "post_" . $insert_data['uid'] . "_" . $data['attach_date'] . ".attach";
     $insert_data['filesize'] = $data['attach_filesize'];
     $insert_data['downloads'] = $data['attach_hits'];
     $insert_data['visible'] = $data['attach_approved'];
     if ($data['attach_thumb_location']) {
         $ext = get_extension($data['attach_thumb_location']);
         $insert_data['thumbnail'] = str_replace(".attach", "_thumb.{$ext}", basename($insert_data['attachname']));
     }
     return $insert_data;
 }
开发者ID:dgrp,项目名称:merge-system,代码行数:50,代码来源:attachments.php

示例10: add_user

    /**
     * Adds user to the databse.
     * Creates a temporary randomly generated password string
     * for user, emails the user a confirmation message about account creation
     * along with
     * temporary password string.
     *
     * @param $DB_con -
     *        	PDO Database connection object
     */
    public function add_user($DB_con)
    {
        // generate random password string
        $temp_password = random_str(10);
        // not currently needed
        // hash password
        // if (isset($password)) {
        // $password = crypt($password);
        // }
        // prepare and executer query to add user to database
        $add_user_query = 'INSERT INTO `tat_user` (`employee_number`, `First_Name`, `Last_Name`, `Email`, `Phone_Number`, `GPA`, `Gender`, `Password`, `Access_Level`)
VALUES (:sid, :first_name, :last_name, :email, :phone_number, :gpa, :gender, :password, :access_level)';
        $statement = $DB_con->prepare($add_user_query);
        // bind query parameters
        $statement->bindParam(':sid', $this->id, PDO::PARAM_STR);
        $statement->bindParam(':first_name', $this->first_name, PDO::PARAM_STR);
        $statement->bindParam(':last_name', $this->last_name, PDO::PARAM_STR);
        $statement->bindParam(':email', $this->email, PDO::PARAM_STR);
        $statement->bindParam(':phone_number', $this->phone_number, PDO::PARAM_STR);
        $statement->bindParam(':gpa', $this->gpa, PDO::PARAM_STR);
        $statement->bindParam(':gender', $this->gender, PDO::PARAM_STR);
        $statement->bindParam(':password', $temp_password, PDO::PARAM_STR);
        $statement->bindParam(':access_level', $this->access_level, PDO::PARAM_STR);
        // execute query
        if (!$statement->execute()) {
            // set error message and redirect user
            $_SESSION['add_user_error'] = 'An unknown error has occurred. Please contact system support and provide a detailed description of what you were trying to accomplish when this error occurred. (Error: -1)';
            header('Location: ../add_user_gui.php');
            die;
        } else {
            // redirect to dash board
            $_SESSION['user_added'] = 1;
            $fullName = $this->first_name . " " . $this->last_name;
            // finally send them an email
            if ($this->access_level == 'lecturer') {
                $email = new Emailer();
                $email->sendLecturerTempEmail($_POST['user_email'], $fullName, $temp_password);
                header('Location: ../add_user_gui.php');
                die;
            } else {
                if ($this->access_level == 'student') {
                    $email = new Emailer();
                    $email->sendStudentTempEmail($_POST['user_email'], $fullName, $temp_password);
                    header('Location: ../add_user_gui.php');
                    die;
                }
            }
        }
    }
开发者ID:Shan1983,项目名称:tat,代码行数:59,代码来源:class_user.php

示例11: addUser

 public function addUser($user_info)
 {
     $result = array('success' => false, 'message' => "Something went wrong.");
     if (sizeof($user_info) > 0) {
         $result['success'] = (isset($user_info['name']) and ctype_alnum($user_info['name']) and strlen($user_info['name']) > 2 or isset($user_info['email']) and filter_var($user_info['email'], FILTER_VALIDATE_EMAIL) or isset($user_info['country']) and ctype_alpha($user_info['country']) or isset($user_info['password']) and strlen($user_info['password']) < 5 or isset($user_info['confirm_password'])) ? true : false;
         if ($user_info['password'] != $user_info['confirm_password']) {
             $result['success'] = false;
             $result['message'] = "Password did not match.";
             $result['field'] = "password";
             return $result;
         }
         if ($this->db->checkExists($this->user_table, 'email', $user_info['email'])) {
             $result['success'] = false;
             $result['message'] = "Email already exists.";
             $result['field'] = "email";
             return $result;
         }
         if ($result['success']) {
             $salt = random_str(20);
             $password = crypt($user_info['password'], $salt);
             unset($user_info['password']);
             unset($user_info['confirm_password']);
             $user_result = $this->db->add($this->user_table, $user_info);
             if ($user_result['success']) {
                 $result['user_id'] = $user_result['lastInsertId'];
                 $result['secret_id'] = $this->_saveUserSecret(array('user_id' => $result['user_id'], 'password' => $password, 'email_confirmation' => random_str(20)));
                 if ($result['secret_id']) {
                     /* TO DO :
                      * Email Confirmation
                      */
                     $result['success'] = true;
                     unset($result['message']);
                 }
             }
         }
     }
     return $result;
 }
开发者ID:jrdncchr,项目名称:danero-framework,代码行数:38,代码来源:User_Model.php

示例12: error

 }
 if (isset($mybb->input['code']) && $user) {
     $query = $db->simple_select("awaitingactivation", "code", "uid='" . $user['uid'] . "' AND type='p'");
     $activationcode = $db->fetch_field($query, 'code');
     $now = TIME_NOW;
     if (!$activationcode || $activationcode != $mybb->get_input('code')) {
         error($lang->error_badlostpwcode);
     }
     $db->delete_query("awaitingactivation", "uid='" . $user['uid'] . "' AND type='p'");
     $username = $user['username'];
     // Generate a new password, then update it
     $password_length = (int) $mybb->settings['minpasswordlength'];
     if ($password_length < 8) {
         $password_length = 8;
     }
     $password = random_str($password_length);
     $logindetails = update_password($user['uid'], md5($password), $user['salt']);
     $email = $user['email'];
     $plugins->run_hooks("member_resetpassword_process");
     $emailsubject = $lang->sprintf($lang->emailsubject_passwordreset, $mybb->settings['bbname']);
     $emailmessage = $lang->sprintf($lang->email_passwordreset, $username, $mybb->settings['bbname'], $password);
     my_mail($email, $emailsubject, $emailmessage);
     $plugins->run_hooks("member_resetpassword_reset");
     error($lang->redirect_passwordreset);
 } else {
     $plugins->run_hooks("member_resetpassword_form");
     switch ($mybb->settings['username_method']) {
         case 0:
             $lang_username = $lang->username;
             break;
         case 1:
开发者ID:nicopinto,项目名称:fantasitura.com,代码行数:31,代码来源:member.php

示例13: install_done

/**
 * Installation is finished
 */
function install_done()
{
    global $output, $db, $mybb, $errors, $cache, $lang;
    if (empty($mybb->input['adminuser'])) {
        $errors[] = $lang->admin_step_error_nouser;
    }
    if (empty($mybb->input['adminpass'])) {
        $errors[] = $lang->admin_step_error_nopassword;
    }
    if ($mybb->get_input('adminpass') != $mybb->get_input('adminpass2')) {
        $errors[] = $lang->admin_step_error_nomatch;
    }
    if (empty($mybb->input['adminemail'])) {
        $errors[] = $lang->admin_step_error_noemail;
    }
    if (is_array($errors)) {
        create_admin_user();
    }
    require MYBB_ROOT . 'inc/config.php';
    $db = db_connection($config);
    require MYBB_ROOT . 'inc/settings.php';
    $mybb->settings =& $settings;
    ob_start();
    $output->print_header($lang->finish_setup, 'finish');
    echo $lang->done_step_usergroupsinserted;
    // Insert all of our user groups from the XML file
    $usergroup_settings = file_get_contents(INSTALL_ROOT . 'resources/usergroups.xml');
    $parser = new XMLParser($usergroup_settings);
    $parser->collapse_dups = 0;
    $tree = $parser->get_tree();
    $admin_gid = '';
    $group_count = 0;
    foreach ($tree['usergroups'][0]['usergroup'] as $usergroup) {
        // usergroup[cancp][0][value]
        $new_group = array();
        foreach ($usergroup as $key => $value) {
            if (!is_array($value)) {
                continue;
            }
            $new_group[$key] = $db->escape_string($value[0]['value']);
        }
        $db->insert_query("usergroups", $new_group, false);
        // If this group can access the admin CP and we haven't established the admin group - set it (just in case we ever change IDs)
        if ($new_group['cancp'] == 1 && !$admin_gid) {
            $admin_gid = $usergroup['gid'][0]['value'];
        }
        $group_count++;
    }
    // Restart usergroup sequence with correct # of groups
    if ($config['database']['type'] == "pgsql") {
        $db->query("SELECT setval('{$config['database']['table_prefix']}usergroups_gid_seq', (SELECT max(gid) FROM {$config['database']['table_prefix']}usergroups));");
    }
    echo $lang->done . '</p>';
    echo $lang->done_step_admincreated;
    $now = TIME_NOW;
    $salt = random_str();
    $loginkey = generate_loginkey();
    $saltedpw = md5(md5($salt) . md5($mybb->get_input('adminpass')));
    $newuser = array('username' => $db->escape_string($mybb->get_input('adminuser')), 'password' => $saltedpw, 'salt' => $salt, 'loginkey' => $loginkey, 'email' => $db->escape_string($mybb->get_input('adminemail')), 'usergroup' => $admin_gid, 'regdate' => $now, 'lastactive' => $now, 'lastvisit' => $now, 'website' => '', 'icq' => '', 'aim' => '', 'yahoo' => '', 'skype' => '', 'google' => '', 'birthday' => '', 'signature' => '', 'allownotices' => 1, 'hideemail' => 0, 'subscriptionmethod' => '0', 'receivepms' => 1, 'pmnotice' => 1, 'pmnotify' => 1, 'buddyrequestspm' => 1, 'buddyrequestsauto' => 0, 'showimages' => 1, 'showvideos' => 1, 'showsigs' => 1, 'showavatars' => 1, 'showquickreply' => 1, 'invisible' => 0, 'style' => '0', 'timezone' => 0, 'dst' => 0, 'threadmode' => '', 'daysprune' => 0, 'regip' => $db->escape_binary(my_inet_pton(get_ip())), 'language' => '', 'showcodebuttons' => 1, 'tpp' => 0, 'ppp' => 0, 'referrer' => 0, 'buddylist' => '', 'ignorelist' => '', 'pmfolders' => '', 'notepad' => '', 'showredirect' => 1, 'usernotes' => '');
    $db->insert_query('users', $newuser);
    echo $lang->done . '</p>';
    echo $lang->done_step_adminoptions;
    $adminoptions = file_get_contents(INSTALL_ROOT . 'resources/adminoptions.xml');
    $parser = new XMLParser($adminoptions);
    $parser->collapse_dups = 0;
    $tree = $parser->get_tree();
    $insertmodule = array();
    $db->delete_query("adminoptions");
    // Insert all the admin permissions
    foreach ($tree['adminoptions'][0]['user'] as $users) {
        $uid = $users['attributes']['uid'];
        foreach ($users['permissions'][0]['module'] as $module) {
            foreach ($module['permission'] as $permission) {
                $insertmodule[$module['attributes']['name']][$permission['attributes']['name']] = $permission['value'];
            }
        }
        $defaultviews = array();
        foreach ($users['defaultviews'][0]['view'] as $view) {
            $defaultviews[$view['attributes']['type']] = $view['value'];
        }
        $adminoptiondata = array('uid' => (int) $uid, 'cpstyle' => '', 'notes' => '', 'permissions' => $db->escape_string(my_serialize($insertmodule)), 'defaultviews' => $db->escape_string(my_serialize($defaultviews)));
        $insertmodule = array();
        $db->insert_query('adminoptions', $adminoptiondata);
    }
    echo $lang->done . '</p>';
    // Automatic Login
    my_unsetcookie("sid");
    my_unsetcookie("mybbuser");
    my_setcookie('mybbuser', $uid . '_' . $loginkey, null, true);
    ob_end_flush();
    // Make fulltext columns if supported
    if ($db->supports_fulltext('threads')) {
        $db->create_fulltext_index('threads', 'subject');
    }
    if ($db->supports_fulltext_boolean('posts')) {
        $db->create_fulltext_index('posts', 'message');
    }
//.........这里部分代码省略.........
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:101,代码来源:index.php

示例14: my_unsetcookie

        // Wrong code -> close session (aka logout)
        $db->delete_query("adminsessions", "sid='" . $db->escape_string($mybb->cookies['adminsid']) . "'");
        my_unsetcookie('adminsid');
        // Now test whether we need to lock this guy completly
        $db->update_query("adminoptions", array("loginattempts" => "loginattempts+1"), "uid='{$mybb->user['uid']}'", '', true);
        $loginattempts = login_attempt_check_acp($mybb->user['uid'], true);
        // Have we attempted too many times?
        if ($loginattempts['loginattempts'] > 0) {
            // Have we set an expiry yet?
            if ($loginattempts['loginlockoutexpiry'] == 0) {
                $db->update_query("adminoptions", array("loginlockoutexpiry" => TIME_NOW + (int) $mybb->settings['loginattemptstimeout'] * 60), "uid='{$mybb->user['uid']}'");
            }
            // Did we hit lockout for the first time? Send the unlock email to the administrator
            if ($loginattempts['loginattempts'] == $mybb->settings['maxloginattempts']) {
                $db->delete_query("awaitingactivation", "uid='{$mybb->user['uid']}' AND type='l'");
                $lockout_array = array("uid" => $mybb->user['uid'], "dateline" => TIME_NOW, "code" => random_str(), "type" => "l");
                $db->insert_query("awaitingactivation", $lockout_array);
                $subject = $lang->sprintf($lang->locked_out_subject, $mybb->settings['bbname']);
                $message = $lang->sprintf($lang->locked_out_message, htmlspecialchars_uni($mybb->user['username']), $mybb->settings['bbname'], $mybb->settings['maxloginattempts'], $mybb->settings['bburl'], $mybb->config['admin_dir'], $lockout_array['code'], $lockout_array['uid']);
                my_mail($mybb->user['email'], $subject, $message);
            }
            log_admin_action(array('type' => 'admin_locked_out', 'uid' => $mybb->user['uid'], 'username' => $mybb->user['username']));
            $page->show_lockedout();
        }
        // Still here? Show a custom login page
        $page->show_login($lang->my2fa_failed, "error");
    }
}
// Show our 2FA page
if (!empty($admin_options['authsecret']) && $admin_session['authenticated'] != 1) {
    $page->show_2fa();
开发者ID:styv300,项目名称:ToRepublic2.5,代码行数:31,代码来源:index.php

示例15: array

             $captcha = $post_captcha->html;
         }
     }
     $postoptionschecked = array('signature' => '', 'emailnotify' => '');
     if ($mybb->user['signature']) {
         $postoptionschecked['signature'] = 'checked="checked"';
     }
     // Hide signature option if no permission
     $option_signature = '';
     if ($mybb->usergroup['canusesig'] && !$mybb->user['suspendsignature']) {
         eval("\$option_signature = \"" . $templates->get('showthread_quickreply_options_signature') . "\";");
     }
     if (isset($mybb->user['emailnotify']) && $mybb->user['emailnotify'] == 1) {
         $postoptionschecked['emailnotify'] = 'checked="checked"';
     }
     $posthash = md5($mybb->user['uid'] . random_str());
     eval("\$quickreply = \"" . $templates->get("showthread_quickreply") . "\";");
 }
 // If the user is a moderator, show the moderation tools.
 if ($ismod) {
     $customthreadtools = $customposttools = '';
     if (is_moderator($forum['fid'], "canusecustomtools") && (!empty($forum_stats[-1]['modtools']) || !empty($forum_stats[$forum['fid']]['modtools']))) {
         switch ($db->type) {
             case "pgsql":
             case "sqlite":
                 $query = $db->simple_select("modtools", "tid, name, type", "','||forums||',' LIKE '%,{$fid},%' OR ','||forums||',' LIKE '%,-1,%' OR forums=''");
                 break;
             default:
                 $query = $db->simple_select("modtools", "tid, name, type", "CONCAT(',',forums,',') LIKE '%,{$fid},%' OR CONCAT(',',forums,',') LIKE '%,-1,%' OR forums=''");
         }
         while ($tool = $db->fetch_array($query)) {
开发者ID:ThinhNguyenVB,项目名称:Gradient-Studios-Website,代码行数:31,代码来源:showthread.php


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