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


PHP randomstring函数代码示例

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


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

示例1: forgotten_password

/**
 * send_password
 * 
 * takes a user's email address and sends them their password
 * for password reminder service
 *
 * @param 	string	$email
 * @return 	string	$message - error/success message
 */
function forgotten_password($email)
{
    // set new values for password and last_sess database fields
    $now = (int) time();
    $key = (int) rand(1000, 9999);
    $sess = $now * $key;
    $auth = randomstring();
    // update database with key/sess
    $conn = author_connect();
    $update = "UPDATE " . WW_USER_TBL . " \n\t\t\t\t\tSET \n\t\t\t\t\t" . WW_LAST_SESS . " = " . $sess . ",\n\t\t\t\t\t" . WW_PASS . " = '" . $conn->real_escape_string($auth) . "'\n\t\t\t\t\tWHERE " . WW_EMAIL . " = '" . $conn->real_escape_string($email) . "'";
    $update_result = $conn->query($update);
    if (!$update_result) {
        return $conn->error;
    }
    // compile email message
    $subject = WW_SITE_NAME . " password reset";
    $url = WW_WEB_ROOT . '/ww_edit/index.php?changepass';
    $message = "Your password for the " . WW_SITE_NAME . " website has been reset. To change your password please do the following:<br/><br/>";
    $message .= "1 - Go to " . $url . "<br/><br/>";
    $message .= "2 - Enter this auth code:<br/>" . $auth . "<br/><br/>";
    $message .= "3 - Enter this key:<br/>" . $key . "<br/><br/>";
    $message .= "4 - Enter your new password<br/><br/>";
    $message .= "NOTE: this must be completed with ONE HOUR otherwise you will need to reset your password again.";
    $headers = "From: " . WW_ADMIN_EMAIL . "\n" . "X-Mailer: PHP/" . phpversion() . "\n" . "Content-Type: text/html; charset=utf-8\n" . "Content-Transfer-Encoding: 8bit\n\n";
    if (mail($email, $subject, $message, $headers, "-f" . WW_ADMIN_EMAIL . "")) {
        $message = "Instructions for resetting your password have been sent to: " . $email . ".";
    } else {
        $message = "There was a problem sending the email.";
    }
    return $message;
}
开发者ID:justincawthorne,项目名称:Wicked-Words,代码行数:40,代码来源:bouncer_functions.php

示例2: randomvalue

function randomvalue()
{
    //	$randomvalue = '';
    static $numberofarrays = 0;
    //var_dump($numberofarrays);
    $typeDeterminatior = rand(1, 3);
    switch ($typeDeterminatior) {
        case '1':
            return randomstring(15);
            break;
        case '2':
            return rand(1, 1000);
            break;
        case '3':
            ++$numberofarrays;
            //if the allowed number of arrays is too large, a fatal error will occur due to too much nesting.
            if ($numberofarrays < 20) {
                return randomarr(rand(3, 6));
            } else {
                return randomvalue();
            }
            //return 'this should be an array';
            break;
        default:
            break;
    }
}
开发者ID:WVits,项目名称:web-backend-oplossingen,代码行数:27,代码来源:opdracht_functionsDeel2_randomarray.php

示例3: post

function post(&$vars)
{
    extract($vars);
    $nickname = '';
    $letters = str_split(strtolower($request->params['blog']['title']));
    foreach ($letters as $letter) {
        if (ereg("([a-z])", $letter)) {
            $nickname .= $letter;
        }
    }
    $prefix = substr($nickname, 0, 2);
    for ($i = 0; $i < 10; $i++) {
        $b = $Blog->find_by('prefix', $prefix);
        if (!$b && !in_array($prefix . "_db_sessions", $db->tables) && strlen($prefix) > 1) {
            continue;
        } else {
            $prefix = randomstring(2);
        }
    }
    $request->set_param(array('blog', 'prefix'), $prefix);
    $request->set_param(array('blog', 'nickname'), $nickname);
    $resource->insert_from_post($request);
    header_status('201 Created');
    redirect_to($request->url_for('admin') . '#ui-tabs-11');
}
开发者ID:Br3nda,项目名称:openmicroblogger,代码行数:25,代码来源:blogs.php

示例4: randomarr

function randomarr($arrlength, $wordlengthmin = 10, $wordlengthmax = 20)
{
    $arr;
    for ($key = 0; $key < $arrlength; $key++) {
        $arr[$key] = randomstring(rand($wordlengthmin, $wordlengthmax));
    }
    return $arr;
}
开发者ID:WVits,项目名称:web-backend-oplossingen,代码行数:8,代码来源:opdracht_functionsDeel2.php

示例5: build_where_string

 function build_where_string()
 {
     global $db, $app_list_strings, $beanList, $beanFiles, $current_user;
     /*
      * Block to build the Where Clause
      */
     // see if we need to ovveride
     /*
      if(is_array($this->whereOverrideArray))
      {
      foreach($this->whereOverrideArray as $overrideKey => $overrideData)
      {
      reset($this->whereArray);
      foreach($this->whereArray as $originalKey => $originalData)
      {
      if($originalData['fieldid'] == $overrideData['fieldid'])
      {
      $this->whereArray[$originalKey] = $overrideData;
      // need to exit the while loop
      }
      }
      }
      }
     */
     // initialize
     $arrayWhereGroupsIndexed = array();
     // $arrayWhereGroupsIndexed['root'] = array();
     // build the where String for each Group
     foreach ($this->whereGroupsArray as $whereGroupIndex => $thisWhereGroup) {
         $thisWhereString = '';
         // reset the Where fields and loop over all fields to see if any is in our group
         reset($this->whereArray);
         foreach ($this->whereArray as $thisWhere) {
             //2012-11-24 cater for a potential empty where string
             $tempWhereString = '';
             // check if this is for the current group
             // 2011--01-24 add ignore filter
             if ($thisWhere['groupid'] == $thisWhereGroup['id'] && $thisWhere['operator'] != 'ignore') {
                 // process the Field and link with the joinalias
                 $fieldName = substr($thisWhere['path'], strrpos($thisWhere['path'], "::") + 2, strlen($thisWhere['path']));
                 $pathName = substr($thisWhere['path'], 0, strrpos($thisWhere['path'], "::"));
                 $fieldArray = explode(':', $fieldName);
                 if ($thisWhere['jointype'] != 'notexisting') {
                     //getWhereOperatorClause($operator, $fieldname, $alias,  $value, $valuekey, $valueto)
                     //$thisWhereString .= $this->getWhereOperatorClause($thisWhere['operator'], $fieldArray[1], $this->joinSegments[$pathName]['alias'],  $thisWhere['value'], $thisWhere['valuekey'], $thisWhere['valueto']);
                     //2012-11-24 ... changed to fill into temnpWherestring
                     //2013-08-07 .. process fixed value
                     if (!empty($thisWhere['fixedvalue'])) {
                         $tempWhereString = $this->getWhereOperatorClause($thisWhere['operator'], $fieldArray[1], '\'' . $thisWhere['fixedvalue'] . '\'', $pathName, $thisWhere['value'], $thisWhere['valuekey'], $thisWhere['valueto'], $thisWhere['valuetokey'], $thisWhere['jointype']);
                     } elseif (!empty($pathName)) {
                         $tempWhereString = $this->getWhereOperatorClause($thisWhere['operator'], $fieldArray[1], $thisWhere['fieldid'], $pathName, $thisWhere['value'], $thisWhere['valuekey'], $thisWhere['valueto'], $thisWhere['valuetokey'], $thisWhere['jointype']);
                     }
                 } else {
                     // we have a not esists clause
                     $tempWhereString .= 'not exists(';
                     // get the last enrty and the one before and the relevant arrays
                     $rightPath = substr($pathName, strrpos($pathName, "::") + 2, strlen($pathName));
                     $leftPath = substr($pathName, 0, strrpos($pathName, "::"));
                     // explode into the relevant arrays
                     $rightArray = explode(':', $rightPath);
                     $leftArray = explode(':', $leftPath);
                     // set aliases for left and right .. will be processed properly anyway in the build of the link
                     // ... funny enough so
                     $join_params = array('right_join_table_alias' => $this->joinSegments[$leftPath]['alias'], 'left_join_table_alias' => $this->joinSegments[$leftPath]['alias'], 'join_table_link_alias' => randomstring(), 'join_table_alias' => $this->joinSegments[$pathName]['alias']);
                     $tempWhereString .= $this->joinSegments[$leftPath]['object']->{$rightArray}[2]->getWhereExistsStatement($join_params);
                     // add the standard Where Clause
                     // $thisWhereString .= $this->getWhereOperatorClause($thisWhere['operator'], $fieldArray[1], $this->joinSegments[$pathName]['alias'],  $thisWhere['value'], $thisWhere['valuekey'], $thisWhere['valueto']);
                     $tempWhereString .= 'AND ' . $this->getWhereOperatorClause($thisWhere['operator'], $fieldArray[1], $thisWhere['fieldid'], $pathName, $thisWhere['value'], $thisWhere['valuekey'], $thisWhere['valueto'], $thisWhere['valuetokey']);
                     // close the select clause
                     $tempWhereString .= ')';
                 }
                 //2012-11-24 moved to cehck if the where string returned something at all
                 if ($tempWhereString != '') {
                     // if we have an where string already concetanate with the type for the group AND or OR
                     if ($thisWhereString != '') {
                         $thisWhereString .= ' ' . $thisWhereGroup['type'] . ' (';
                     } else {
                         $thisWhereString .= '(';
                     }
                     $thisWhereString .= $tempWhereString;
                     // close this condition
                     $thisWhereString .= ')';
                 }
             }
         }
         $thisWhereGroup['whereClause'] = $thisWhereString;
         // write into an array with the id as index in the array (will need that tobuild the hierarchy
         $arrayWhereGroupsIndexed[$thisWhereGroup['id']] = $thisWhereGroup;
     }
     // 2013-01-16 check if we have a where string already from the auth check
     // 2013-02-22 moved into the adding of the where clause ...
     //if ($this->whereString != '')
     //    $this->whereString .= ' AND ';
     // process now topDown
     if (isset($arrayWhereGroupsIndexed['root'])) {
         $levelWhere = $this->buildWhereClauseForLevel($arrayWhereGroupsIndexed['root'], $arrayWhereGroupsIndexed);
         if ($levelWhere != '') {
             if ($this->whereString != '') {
                 $this->whereString .= ' AND ';
             }
//.........这里部分代码省略.........
开发者ID:ambientelivre,项目名称:GeneratorTargetList,代码行数:101,代码来源:KReportQuery.php

示例6: unpack

    $header = unpack('vtype/vchannels/Vsamplerate/Vbytespersec/valignment/vbits', $rawheader);
    $sec = ceil($size_in_bytes / $header['bytespersec']);
    return $sec;
}
if (isset($name) && $_SESSION['userclass'] == 'admin') {
    if (isset($_POST['usernames'])) {
        $newspeakers = [];
        foreach (explode("\n", $_POST['usernames']) as $newuser) {
            $school = $_SESSION['user']['school'];
            $newname = strtolower($school) . "_" . randomstring(4);
            $sqlcommand = "SELECT count(*) FROM speakers WHERE username='{$newname}'";
            while ($db->querySingle($sqlcommand) > 0) {
                $newname = strtolower($_SESSION['user']['school']) . "_" . randomstring(4);
                $sqlcommand = "SELECT count(*) FROM speakers WHERE username='{$newname}'";
            }
            $newpassword = randomstring(5);
            $langchoice = $_POST['langchoice'];
            $yearinschool = $_POST['yearinschool'];
            $teacher = $_SESSION['user']['username'];
            $timestamp = date('Y-m-d h:i:s', time());
            $newspeaker = array('username' => $newname, 'yearinschool' => $yearinschool, 'langchoice' => $langchoice, 'password' => $newpassword, 'realname' => $newuser, 'timestamp' => $timestamp, 'teacher' => $teacher);
            $sqlcommand = "INSERT INTO speakers (username, password, school, teacher, langchoice, yearinschool, timestamp) ";
            $sqlcommand .= "values ('{$newname}','{$newpassword}','{$school}','{$teacher}','{$langchoice}','{$yearinschool}','{$timestamp}');";
            $trying = $db->exec($sqlcommand);
            if (!$trying) {
                print "<pre> Problem with SQL:" . PHP_EOL;
                print "{$sqlcommand}" . PHP_EOL;
                print "</pre>" . PHP_EOL;
            }
            array_push($newspeakers, $newspeaker);
        }
开发者ID:safiely,项目名称:html5_audiorecorder,代码行数:31,代码来源:teacher.php

示例7: elseif

             //CLIENT
         } elseif ($reset_m_type = 3) {
             $failure_query = "UPDATE client SET log='{$new_log}' WHERE mid='{$mid}' AND cid='{$cid}' LIMIT 1";
         }
         //UPDATE LOG COLUMN. INCREASE LOGIN ATTEMPTS
         //echo $failure_query;
         mysql_query($failure_query) or die(mysql_error());
         $_SESSION['failure'] = '<div class="error"><span class="errormsg">Incorrect Security Question or Answer.<br>Please try again.</span></div>';
         $failure = $_SESSION['failure'];
         session_write_close();
         header("Location: https://www.benfund.com/reset_password/challenge.php");
     }
     //HAS EXCEEDED LOGIN ATTEMPTS
 } else {
     //SEND WARNING EMAIL
     $randomstring = randomstring(22);
     if (isset($cid)) {
         $reset_query = "UPDATE client SET log='4^{$REMOTE_ADDR}^{$randomstring}' WHERE mid='{$mid}' AND cid='{$cid}' LIMIT 1";
         $reset_url = 'https://www.benfund.com/reset_login.php?mid=' . $mid . '&cid=' . $cid . '&astrum=' . $randomstring;
         $acct_num = $mid . ' - ' . $cid;
     } else {
         $reset_query = "UPDATE merchant SET log='4^{$REMOTE_ADDR}^{$randomstring}' WHERE id='{$mid}' LIMIT 1";
         $reset_url = 'https://www.benfund.com/reset_login.php?mid=' . $mid . '&astrum=' . $randomstring;
         $acct_num = $mid;
     }
     //SET RESET STRING IN ACCOUNT LOG COLUMN
     benfund_connect();
     mysql_query($reset_query) or die(mysql_error());
     $from = 'customerservice@benfund.com';
     $from_name = 'BenFund Customer Service';
     $recipient = $email;
开发者ID:centaurustech,项目名称:BenFund,代码行数:31,代码来源:truth.php

示例8: uppercaseandlength

    }
    return $result;
}
function uppercaseandlength($str)
{
    $arr_result["length"] = strlen($str);
    $arr_result["uppercase"] = strtoupper($str);
    return $arr_result;
}
function randomstring($length = 10)
{
    $randomString = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
    return $randomString;
}
///////////// Overige code //////////////////////
$startstring = randomstring(rand(10, 400));
$resultArr = uppercaseandlength($startstring);
$outputstr = "De string " . $startstring . " heeft een lengte van: " . $resultArr["length"] . " en ziet er in hoofdletters zo uit: " . $resultArr["uppercase"];
?>

<!DOCTYPE html>
<html>
<head>
	<title> Functions Deel 1</title>
</head>
<body>
	<h1> Functions Deel 1</h1>
	<h2> Vermenigvuldig </h2>
	<p> U kocht <?php 
echo $aantalStuks;
?>
开发者ID:WVits,项目名称:web-backend-oplossingen,代码行数:31,代码来源:opdracht_functionsDeel1.php

示例9: include_once

<?php
include_once("/var/www/take/files/functions/randomstring.php");

?>

<html>
<head>
<script type="text/javascript" src="http://localhost/take/jquery/jquery.tools.min.js">

</script>
</head>
<body>
<?php
$random=randomstring();
?>
<div id='<?=$random?>' style="width:300px;height:300px;margin:top;background-color:red;">
"<?=var_dump($random);
?>"
</div>
<?php
?>
<script type="text/javascript" >
$(document).ready(function(){var one=$("div").attr('id');$('div#'+one).mouseover(function(){$(this).css("background-color","yellow");});});
</script>.
</body>
</html>
开发者ID:rubulh,项目名称:delta_music,代码行数:26,代码来源:getaidvar.php

示例10: generateTokens

/**
 * [generate survey tokens and auth token for invitation auto-login]
 * @param  [type] $user        [description]
 * @param  [type] $evaluation_id [description]
 * @return [type]              [description]
 */
function generateTokens($user, $evaluation_id)
{
    error_log('got this far 1');
    // is relationship 180 or 360 ?
    $evaluation_pod = pods('evaluation', $evaluation_id);
    $relation_pod = pods('relation', $evaluation_pod->field('relation')['ID']);
    $relation_type = $evaluation_pod->field('180_360');
    $relation_steps = EvaluationModel::getSteps($relation_type);
    error_log('got this far 2 ' . json_encode($relation_steps));
    // survey meta info
    $survey_args = ['user' => $user->ID, 'evaluation' => $evaluation_id, 'user_type' => get_field('company_or_agency', 'user_' . $user->ID), 'token_180' => false, 'token_360' => false, 'survey_id_180' => false, 'survey_id_360' => false, 'auth_token' => randomstring(16)];
    // get survey metadata pod
    $survey = SurveyModel::getByUserAndRelation($user->ID, $evaluation_id);
    error_log('got this far 3 ' . json_encode($survey));
    // for each relation step
    foreach ($relation_steps as $key => $relation_step) {
        error_log('got this far 4');
        $limesurvey_id = EvaluationModel::surveyID($evaluation_id, $relation_step);
        error_log('got this far 4a ' . $limesurvey_id);
        if (empty($limesurvey_id) || !$limesurvey_id) {
            error_log('Error: generateTokens ' . $limesurvey_id . '-' . $evaluation_id . '-' . $relation_step);
            return;
        }
        $ls_token = LimesurveyModel::getTokenByRelation($limesurvey_id, $user->user_email, $evaluation_id, false);
        error_log('got this far 4b');
        // create a new limesuvey survey token if one doesn't exist
        if ($ls_token) {
            error_log('A token already exists ' . LS_USER . ' - ' . LS_PASSWORD);
            continue;
        }
        error_log('got this far 4z ');
        //limesurvey token
        $limesurvey_token = [(object) ['email' => $user->user_email, 'firstname' => $user->first_name, 'lastname' => $user->last_name, 'attribute_1' => $user->roles[0], 'attribute_2' => $evaluation_id]];
        error_log('got this far 4b2 ' . json_encode($limesurvey_token));
        // instantiate a new client
        $myJSONRPCClient = new jsonRPCClient(LS_BASEURL);
        error_log('got this far 4b3 ' . json_encode($myJSONRPCClient));
        error_log('Le base url ' . LS_BASEURL);
        // receive session key
        $sessionKey = $myJSONRPCClient->get_session_key(LS_USER, LS_PASSWORD);
        error_log('got this far 4b4 ' . json_encode($sessionKey));
        // create limesurvey token
        $success_status = $myJSONRPCClient->add_participants($sessionKey, $limesurvey_id, $limesurvey_token);
        error_log('got this far 4b5 ' . json_encode($success_status));
        // release session key
        $myJSONRPCClient->release_session_key($sessionKey);
        error_log('got this far 4c ');
        // check status
        if (isset($success_status['error'])) {
            error_log('Error: ' . $success_status['error']);
        }
        $token_str = isset($success_status[0]['token']) ? $success_status[0]['token'] : "";
        if (empty($token_str)) {
            error_log('generateTokens() - Token str is empty');
            continue;
        }
        // update survey meta
        $survey_args['user'] = $user->ID;
        $survey_args['token_' . $relation_step] = $token_str;
        $survey_args['survey_id_' . $relation_step] = $limesurvey_id;
        // this will add/update the survey meta pod using pods save
        SurveyModel::save($user->ID, $evaluation_id, $survey_args);
        error_log('got this far 4');
    }
    error_log('got this far 5');
}
开发者ID:strikles,项目名称:php,代码行数:72,代码来源:tokens.php

示例11: randomstring

function randomstring($length)
{
    /*$c = "abcdefghijklmnopqrstuvwxyz";
      $rand = '';
      srand((double)microtime()*1000000);
      for ($i=0; $i<$length; $i++)
      {
          $rand .= $c[rand()%strlen($c)];
      }
      return $rand;*/
    $random = GeneratePassword(false, $length, "/^[a-z]{1}[a-z0-9]*\$/");
    $return = implode('', $random);
    return $return;
}
for ($i = 0; $i < 1500; $i++) {
    $domains[] = randomstring(20) . '.nl';
}
echo "Checking " . count($domains) . " domain names\n";
try {
    $conn = new Metaregistrar\EPP\metaregEppConnection();
    $conn->setConnectionDetails('');
    // Connect to the EPP server
    $mtime = microtime();
    $mtime = explode(" ", $mtime);
    $starttime = $mtime[1] + $mtime[0];
    if ($conn->login()) {
        $counter = 0;
        while ($counter < count($domains)) {
            $list[] = $domains[$counter];
            $counter++;
            if ($counter % 10 == 0) {
开发者ID:pkaz,项目名称:php-epp-client,代码行数:31,代码来源:timeddomaincheck.php

示例12: die

	}
//write the download path song m3u path etc and the netered detailsin the general databse -allsongs table
$connection_upload_handler=mysqli_connect($_SERVER['HTTP_HOST'],$sqlusername,$sqlpassword,$databasename);
$query_extract_user_details_uploadhandler="select registration_timestamp ,username,profile_string from users_basic where email_id='$the_email_id_in_session'";
//echo "<br>";var_dump($query_extract_user_details_uploadhandler);echo "<br>";
$result_extract_user_details_uploadhandler=mysqli_query($connection_upload_handler,$query_extract_user_details_uploadhandler)or die(mysqli_error($connection_upload_handler));/*echo "shhs";*/
$answer_extract_user_details_uploadhandler=mysqli_fetch_array($result_extract_user_details_uploadhandler);
//var_dump($answer_extract_user_details_uploadhandler);//echo "<br>";
$username_extract_user_details_uploadhandler=$answer_extract_user_details_uploadhandler['username'];
$registration_timestamp_uploadhandler=$answer_extract_user_details_uploadhandler['registration_timestamp'];
$profile_string_uploadhandler=$answer_extract_user_details_uploadhandler['profile_string'];
$the_session_user_db_uploadhandler="$username_extract_user_details_uploadhandler-$the_email_id_in_session--$registration_timestamp_uploadhandler";



$another_randomstring=randomstring();
$another_randomstring_complete=md5($another_randomstring.$the_current_time_uploadehandler.$another_randomstring);
$theanchor_to_the_song_in_the_allsongs_chart=$another_randomstring_complete;

//$username_extract_user_details_uploadhandler-$the_email_id_in_session--$registration_timestamp_uploadhandler";
$complete_name_for_m3u='http://localhost/'.$the_total_filename;
$query_insert_details_general_allsongs="insert into allsongs (song_title,album,artist,genre,language,play_path,the_anchor,download_path,added_by,added_by_profile_string) values('$title_uploadhandler','$album_uploadhandler','$artist_uploadhandler','$genre_uploadhandler','$language_uploadhandler','$m3u_path_on_the_directory','$theanchor_to_the_song_in_the_allsongs_chart','$destination','$username_extract_user_details_uploadhandler','$profile_string_uploadhandler')";//echo "^&*^&*^*^&*^*^okay";
	//var_dump($query_insert_details_general_allsongs);/*echo "```````````````````````````````````shhs";*/
$result_insert_details_general_allsongs=mysqli_query($connection_upload_handler,$query_insert_details_general_allsongs)or die(mysqli_error($connection_upload_handler));
$answer_insert_details_general_allsongs=mysqli_affected_rows($connection_upload_handler);
if(!$answer_insert_details_general_allsongs)
	{     
	/*setcookie('authkey','',time()-60*60);//returns bool
						setcookie('clue','',time()-60*60);//returns bool
						session_destroy();
						$_SESSION=array();
开发者ID:rubulh,项目名称:delta_music,代码行数:31,代码来源:uploadhandler.php

示例13: define

<?php

// load composer autoloader
require 'vendor/autoload.php';
// disable Dompdf autoloader
define('DOMPDF_ENABLE_AUTOLOAD', false);
// require dompdf config file
require_once "vendor/dompdf/dompdf/dompdf_config.inc.php";
//
$pathToPdfs = array();
for ($i = 0; $i < 10; $i++) {
    // create the barcode
    $code = randomstring();
    $pathToBarcode = generate_barcode($code);
    // create html for dompdf
    $barcode_html = "\n\t\t    <img src='" . $pathToBarcode . "' \n\t\t    \t\t\tstyle='position: absolute; \n\t\t    \t\t\ttop: -40px; \n\t\t    \t\t\tleft: -40px; \n\t\t    \t\t\twidth:280px; \n\t\t    \t\t\theight: 70px;' >\n\t\t    <div style='position: absolute; top: 11px; left: 30px; width: 80px; height: 20px; text-align: center; background-color:white; text-transform: uppercase;'>\n\t\t    \t\t" . $code . "\n\t\t    </div>";
    // init dompdf and set paper size
    $dompdf = new DOMPDF();
    $customPaper = array(0, 0, 175, 60);
    $dompdf->set_paper($customPaper);
    // load html to dompdf
    $dompdf->load_html($barcode_html);
    // render the pdf
    $dompdf->render();
    // cleanup barcode png
    if (file_exists($pathToBarcode)) {
        unlink($pathToBarcode);
    }
    // save pdf to temp dir
    $output = $dompdf->output();
    $pdfName = $code . '.pdf';
开发者ID:Robertbaelde,项目名称:barcodepdf_demo,代码行数:31,代码来源:index.php

示例14: require_once

<html>
<head>
<script type="text/javascript" src="http://localhost/take/jquery/jquery.tools.min.js">
</script>
<?php
require_once("/var/www/take/files/functions/randomstring.php");

?>

<script type="text/javascript" >
$(document).ready(function(){$('#butt').click(function(){location.reload()});});
</script>
</head>
<body>
<div>
<?php var_dump(randomstring());?>
</div>

<button id="butt">click</button>
</body>
</html>
开发者ID:rubulh,项目名称:delta_music,代码行数:21,代码来源:location_load.php

示例15: session_start

<?php


session_start();





$connection_common_rdm=mysqli_connect($_SERVER['HTTP_HOST'],$sqlusername,$sqlpassword,$common_database);
//common connection
$authkey_timestamp=time();
$authkey_session_id=session_id();
$salt1=randomstring();
$salt2=randomstring();
$total_authkey=$salt1.$authkey_session_id.$salt2.$authkey_timestamp;
$standardauthkey=md5($total_authkey);
//just confirming that any other value of huh does not get through
//and that the session variables does not get set for any other huh value;;;



if(!(($_POST['huh']=='users')||($_POST['huh']=='register')))
	{
	header("Location:$FILE/error_message.php?down=25");
	$close_connection=mysqli_close($connection_common_dm);
	exit();
	//whisks to error message.php  where error is shown that something went wrong ;;as the huh variable was set to neither users nor guests nor register
	}
开发者ID:rubulh,项目名称:delta_music,代码行数:29,代码来源:r_d_m.php


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