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


PHP generateCode函数代码示例

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


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

示例1: SetToken

 function SetToken($id)
 {
     $mysql = new MySQL();
     $token = generateCode();
     $mysql->UpdateString($this->NameBase, 'User', "token='" . $token . "'", "id='" . $id . "'");
     return $token;
 }
开发者ID:egozza,项目名称:SVGmaps,代码行数:7,代码来源:user.php

示例2: generateStyles

function generateStyles(array $styles)
{
    debug(count($styles) . " styles found");
    foreach ($styles as $style) {
        if (property_exists($style, 'styles') && count($style->styles) == 1 && property_exists($style, 'substyles') && count($style->substyles) > 0) {
            $sourceCode = generateCode($style->styles[0], $style->substyles, true);
            writeClass(filterKeyword($style->styles[0]), $sourceCode);
        } elseif (property_exists($style, 'styles') && count($style->styles) > 0 && !property_exists($style, 'substyles') && count($style->elements) == 1) {
            switch ($style->elements[0]) {
                case 'label':
                    $_style = 'LabelStyles';
                    break;
                case 'frame3d':
                    $_style = 'Frame3dStyles';
                    break;
                default:
                    throw new UnexpectedValueException('Woot');
            }
            $sourceCode = generateCode($_style, $style->styles, false);
            writeClass($_style, $sourceCode);
        } else {
            debug("Cannot process element");
        }
    }
}
开发者ID:manialib,项目名称:manialink,代码行数:25,代码来源:generate_style_classes.php

示例3: generateCookie

function generateCookie($user, $extended)
{
    $code = generateCode(32, $user);
    $code2 = grHash($code, $user);
    $monthLater = time() + 30 * 24 * 60 * 60;
    $dbh = ConnectToDB();
    $stmt = $dbh->prepare("UPDATE active_users SET last_session_code=?,session_expiration=? WHERE email=?");
    $stmt->execute(array($code2, date("Y-m-d H:i:s", $monthLater), $user));
    return $code;
}
开发者ID:scott-m-sarsfield,项目名称:throne-of-games,代码行数:10,代码来源:utils.php

示例4: submit_details

 public function submit_details()
 {
     $alphabet = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ';
     function generateCode($length = 2)
     {
         $az = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
         $azr = rand(0, 25);
         $azs = substr($az, $azr, 10);
         $stamp = hash('sha256', time());
         $mt = hash('sha256', mt_rand(5, 20));
         $alpha = hash('sha256', $azs);
         $hash = str_shuffle($stamp . $mt . $alpha);
         $code = ucfirst(substr($hash, $azr, $length));
         return $code;
     }
     function generateCode1($length = 3)
     {
         $az = '1234567890';
         $azr = rand(0, 9);
         $azs = substr($az, $azr, 5);
         $stamp = hash('sha256', time());
         $mt = hash('sha256', mt_rand(1, 5));
         $alpha = hash('sha256', $azs);
         $hash = str_shuffle($stamp . $mt . $alpha);
         $code1 = ucfirst(substr($hash, $azr, $length));
         return $code1;
     }
     $name = $this->input->post('txt_name');
     $mail = $this->input->post('txt_email');
     $phn = $this->input->post('txt_phn');
     $alt_phn = $this->input->post('txt_alt_phn');
     if ($alt_phn == '') {
         $alt_phn1 = 'N/A';
     } else {
         $alt_phn1 = $alt_phn;
     }
     $add = $this->input->post('txt_address');
     $country = $this->input->post('txt_country');
     $state = $this->input->post('txt_state');
     $city = $this->input->post('txt_city');
     $zip = $this->input->post('txt_pin');
     $id = generateCode() . '/' . generateCode1();
     $pass = generateCode() . '@' . generateCode1();
     $fields = array('name' => $name, 'email' => $mail, 'phone' => $phn, 'alt_phone' => $alt_phn1, 'address' => $add, 'country' => $country, 'state' => $state, 'city' => $city, 'zip' => $zip, 'emp_id' => $id, 'emp_pass' => $pass);
     $service = $this->base_model->form_post('td_employee_details', $fields);
     if ($service) {
         $category['data'] = $this->base_model->show_data('td_employee_details', '*', '')->result_array();
         $this->load->view('employee/emp_details', $category);
     } else {
         $category['msg'] = 'Sorry ! Category was not successfully Inserted';
         $this->load->view('employee/emp_details', $category);
     }
 }
开发者ID:projukti,项目名称:dumkal,代码行数:53,代码来源:Employee_details.php

示例5: generateActivation

function generateActivation($pdo, $userId)
{
    // Create an activation code 20 characters long
    $code = generateCode(20);
    // Create the activation code listing using $userId
    $stmt = $pdo->prepare('INSERT INTO AccountActivation (UserId, ActivationCode) VALUES (:userId, :activationCode);');
    $stmt->bindParam(':userId', $userId, PDO::PARAM_INT);
    // <-- Automatically sanitized for SQL by PDO
    $stmt->bindParam(':activationCode', $code, PDO::PARAM_STR);
    // <-- Automatically sanitized for SQL by PDO
    $stmt->execute();
    // Give the $code to the rest of the program
    return $code;
}
开发者ID:Richard-CRT,项目名称:PHP-Forum-Site,代码行数:14,代码来源:register.php

示例6: create

 public function create($input)
 {
     // Set transaction instance
     $transaction = new Transaction(['code' => generateCode(), 'draw' => getDrawTime()]);
     // Create transaction
     Auth::user()->transactions()->save($transaction);
     // Set transaction for the bet
     if ($input['type'] == 'fourdigit') {
         Auth::user()->bets()->whereIn('type', ['last2', 'last3', 'fourdigit'])->where('transaction_id', '=', null)->update(['transaction_id' => $transaction->id]);
     } elseif ($input['type'] == 'swertres') {
         Auth::user()->bets()->whereIn('type', ['swertwo', 'swertres'])->where('transaction_id', '=', null)->update(['transaction_id' => $transaction->id]);
     } else {
         Auth::user()->bets()->where('type', '=', $input['type'])->where('transaction_id', '=', null)->update(['transaction_id' => $transaction->id]);
     }
     return $transaction;
 }
开发者ID:anthon-alindada,项目名称:gaming-88,代码行数:16,代码来源:TransactionRepository.php

示例7: insertSmallJob

function insertSmallJob()
{
    if (isset($_POST['agree'])) {
        include 'connection.php';
        $date = date("d/m/Y");
        $secretCode = generateCode();
        $name = $_POST['name'];
        $email = $_POST['email'];
        $phone = $_POST['phone'];
        $location = $_POST['location'];
        $region = $_POST['region'];
        $description = $_POST['description'];
        $type = $_POST['type'];
        if (!empty($name) && !empty($email) && !empty($phone) && !empty($location) && !empty($region) && !empty($description)) {
            $insert = "INSERT INTO smallJobs (name, phone, email, activation, secretCode, location, description, region, types, date) VALUES ('{$name}', '{$phone}', '{$email}', 0, '{$secretCode}' , '{$location}', '{$description}', '{$region}', '{$type}', '{$date}')";
            $insertSmallJob = mysqli_query($connect, $insert) or die(mysqli_error());
            echo "<div class='container'><h1>Skelbimas pridėtas</h1><br>Jūsų skelbimo slaptas kodas yra <h2>{$secretCode}</h2>. Prašome jį saugiai užsirašyti. Jūsų slaptas kodas taip pat išsiųstas Jūsų nurodytu el. paštu. Prašome pasitikrinti el.pašto dėžutę. Jeigu nematote, rekomenduojame patikrinti ir šiukšlių dėžutę (angl. spam). Su šiuo kodu Jūs bet kada galėsite koreguoti skelbimo turinį ar jį ištrinti.<br>Skelbimą galėsite matyti tinklapyje tuomet kai jį aktyvuos administratorius. Prašome palaukti. <br>Dėkojame, kad naudojatės mūsų paslaugomis.<br></div>";
            //================
            //   Mailing system
            //=================
            $to = $_POST['email'];
            $subject = "Jūsų smulkaus darbo registracija katalogas.no";
            $name = $_POST['name'];
            $headers = "From: Katalogas.no registracija <no-reply@katalogas.no>" . "\r\n";
            $headers .= "MIME-Version: 1.0\r\n";
            $headers .= "Content-Type: text/html; charset=UTF-8" . "\r\n";
            $message = '<html><body>';
            $message .= "Sveiki,";
            $message .= "<br><br>Jūs sėkmingai pridėjote reklamą/skelbimą " . $name . ". Norėdami jį redaguoti ar ištrinti naudokite šitą kodą: <b>" . $secretCode . "</b>.";
            $message .= "<br>Rekomenduojame šio kodo niekam neskleisti ir nesidalinti, taip siekiant užtikrinti Jūsų skelbimo saugumą.";
            $message .= "<br>Jeigu turite kokių nors klausimų ar pasiūlymų, prašome kreiptis el. paštu administracija@katalogas.no.";
            $message .= "<br><br>Taip pat prašome neatsakyti (nenaudoti reply) į šį el. laišką, nes tai yra automatinis pranešimas.";
            $message .= "<br><br>Dėkojame, kad naudojatės katalogas.no. <br><br> Pagarbiai <br> katalogas.no kolektyvas.";
            $message .= '</body></html>';
            mail($to, $subject, $message, $headers);
        } else {
            echo "<div class='container'><h1>Pažymėti laukai * yra privalomi. Prašome užpildyti pažymėtus * laukus.</h1></div>";
        }
    } else {
        echo "<div class='container'><h1>Jūs privalote susipažinti su taisyklėmis!</h1></div>";
    }
}
开发者ID:Ramunaslfs,项目名称:KatalogasNoProjektas,代码行数:42,代码来源:smallJobsModules.php

示例8: insertAd

function insertAd()
{
    if (isset($_POST['agree'])) {
        include 'connection.php';
        $adsCode = generateCode();
        $name = $_POST['name'];
        $email = $_POST['email'];
        $phone = $_POST['phone'];
        $website = $_POST['website'];
        $facebook = $_POST['facebook'];
        $town = $_POST['town'];
        $region = $_POST['region'];
        $category = $_POST['category'];
        $description = $_POST['description'];
        $worksHours = $_POST['workHours'];
        $workHoursWeekend = $_POST['workHoursWeekend'];
        //==============
        // Photo upload
        //==============
        $logoRandom = imageNameGenerator();
        $logoName = $_FILES['logo']['name'];
        $logoSize = $_FILES['logo']['size'];
        $logoType = $_FILES['logo']['type'];
        $logoTemp = $_FILES['logo']['tmp_name'];
        $logoExtension = strtolower(substr(strrchr($logoName, '.'), 1));
        $newLogoName = $logoRandom . '.' . $logoExtension;
        if (!empty($name) && !empty($email) && !empty($phone) && !empty($description) && !empty($town)) {
            if (!empty($logoName)) {
                if ($logoType == "image/jpeg" || $logoType == "image/png" || $logoType == "image/bmp" || $logoType == "image/gif" || $logoType == "image/jpg" || $logoType == "image/psd" || $logoType == "image/tiff" || $logoType == "image/tga" || $logoType == "") {
                    if ($logoSize < 500000) {
                        move_uploaded_file($logoTemp, "images/catalogLogos/" . $newLogoName);
                        echo "Logotipas ikeltas!";
                    } else {
                        die("Paveikslelis per didelis.");
                    }
                } else {
                    die("Neleistinas failo formatas.");
                }
            } else {
                $newLogoName = "noLogo.png";
            }
            $insert = "INSERT INTO katalogas (name, phone, email, activation, adsCode, website, facebook, town, description, worksHours, workHoursWeekend, logoName, region, category) VALUES ('{$name}', '{$phone}', '{$email}', 0, '{$adsCode}', '{$website}', '{$facebook}', '{$town}', '{$description}', '{$worksHours}' , '{$workHoursWeekend}', '{$newLogoName}', '{$region}', '{$category}')";
            $insertAd = mysqli_query($connect, $insert) or die(mysqli_error());
            echo "<div class='container'><h1>Įmonė/paslauga pridėta</h1><br>Jūsų skelbimo slaptas kodas yra <h2> {$adsCode} </h2>. Prašome jį saugiai užsirašyti.Jūsų slaptas kodas taip pat išsiųstas Jūsų nurodytu el. paštu. Prašome pasitikrinti el.pašto dėžutę. Jeigu nematote, rekomenduojame patikrinti ir šiukšlių dėžutę (angl. spam). Su šiuo kodu Jūs bet kada galėsite koreguoti įmonės/paslaugos reklamos turinį ar ją ištrinti.<br>Skelbimą galėsite matyti tinklapyje tuomet kai jį aktyvuos administratorius. Prašome palaukti. <br>Dėkojame, kad naudojatės mūsų paslaugomis.<br></div>";
            //================
            //   Mailing system
            //=================
            $to = $_POST['email'];
            $subject = "Jūsų kompanijos registracija katalogas.no";
            $headers = "From: Katalogas.no registracija <no-reply@katalogas.no>" . "\r\n";
            $headers .= "MIME-Version: 1.0\r\n";
            $headers .= "Content-Type: text/html; charset=UTF-8" . "\r\n";
            $message = '<html><body>';
            $message .= "Sveiki,";
            $message .= "<br><br>Jūs sėkmingai pridėjote įmonę/paslaugą " . $name . ". Norėdami ją redaguoti ar ištrinti naudokite šitą kodą: <b>" . $adsCode . "</b>.";
            $message .= "<br>Rekomenduojame šio kodo niekam neskleisti ir nesidalinti, taip siekiant užtikrinti Jūsų skelbimo saugumą.";
            $message .= "<br>Jeigu turite kokių nors klausimų ar pasiūlymų, prašome kreiptis el. paštu administracija@katalogas.no.";
            $message .= "<br><br>Taip pat prašome neatsakyti (nenaudoti reply) į šį el. laišką, nes tai yra automatinis pranešimas.";
            $message .= "<br><br>Dėkojame, kad naudojatės katalogas.no. <br><br> Pagarbiai <br> katalogas.no kolektyvas.";
            $message .= '</body></html>';
            mail($to, $subject, $message, $headers);
        } else {
            echo "<div class='container'><h1>Pažymėti laukai * yra privalomi. Prašome užpildyti pažymėtus * laukus.</h1></div>";
        }
    } else {
        echo "<div class='container'>Jūs privalote susipažinti su taisyklėmis!</div>";
    }
}
开发者ID:Ramunaslfs,项目名称:KatalogasNoProjektas,代码行数:68,代码来源:adsModules.php

示例9: dirname

//$targetPath="".WEB_PATH."";
//var $font = '/home/www/htdocs/capcha/monofont.ttf'; //╡├╟и╩═║ path р═з┴╥у╩ш╣╨д├╤║
$_SERVER['DOCUMENT_ROOT'] = dirname(dirname(__FILE__));
$targetPath = $_SERVER['DOCUMENT_ROOT'];
function generateCode($characters)
{
    $possible = '╝╗═╖┴┐╦б┤╩╟з╛├╣┬║┼└╢д╡ивк';
    //		$possible = _CAPTCHA_RAN;
    $code = '';
    $i = 0;
    while ($i < $characters) {
        $code .= substr($possible, mt_rand(0, strlen($possible) - 1), 1);
        $i++;
    }
    return $code;
}
$font = $targetPath . "/capcha/font/angsab.ttf";
$code = generateCode($_GET['characters']);
$im = imagecreate($_GET['width'], $_GET['height']);
$white = ImageColorAllocate($im, 255, 255, 255);
$black = ImageColorAllocate($im, 0, 0, 0);
$new_string = tis620_to_utf8($code);
imagefill($im, 0, 0, $black);
imageTTFText($im, 20, 0, 6, 18, $white, $font, $new_string);
if (ISO == 'utf-8') {
    $_SESSION["security_code"] = $new_string;
} else {
    $_SESSION["security_code"] = utf8_to_tis620($new_string);
}
imagepng($im);
imagedestroy($im);
开发者ID:robocon,项目名称:iopr,代码行数:31,代码来源:val_img.php

示例10: generateCode

 $SUSERID = $result->fields['USERID'];
 $SEMAIL = $result->fields['email'];
 $SUSERNAME = $result->fields['username'];
 $SVERIFIED = $result->fields['verified'];
 $SPP = $result->fields['profilepicture'];
 $SFNAME = $result->fields['fname'];
 $SLNAME = $result->fields['lname'];
 $_SESSION['USERID'] = $SUSERID;
 $_SESSION['EMAIL'] = $SEMAIL;
 $_SESSION['USERNAME'] = $SUSERNAME;
 $_SESSION['VERIFIED'] = $SVERIFIED;
 $_SESSION['PP'] = $SPP;
 $_SESSION['FNAME'] = $SFNAME;
 $_SESSION['LNAME'] = $SLNAME;
 // Generate Verify Code Begin
 $verifycode = generateCode(5) . time();
 $query = "INSERT INTO members_verifycode SET USERID='" . mysql_real_escape_string($SUSERID) . "', code='{$verifycode}'";
 $conn->execute($query);
 if (mysql_affected_rows() >= 1) {
     $proceedtoemail = true;
 } else {
     $proceedtoemail = false;
 }
 // Generate Verify Code End
 // Send Welcome E-Mail Begin
 if ($proceedtoemail) {
     $sendto = $SEMAIL;
     $sendername = $config['site_name'];
     $from = $config['site_email'];
     $subject = $lang['67'] . " " . $sendername;
     $sendmailbody = stripslashes($_SESSION['USERNAME']) . ",<br><br>";
开发者ID:reDecore,项目名称:redecore.me,代码行数:31,代码来源:signup.php

示例11: while

    while ($i < $characters) {
        $code .= substr($possible, mt_rand(0, strlen($possible) - 1), 1);
        $i++;
    }
    return $code;
}
function print_image($code, $width = 120, $height = 40, $characters = 6)
{
    $font_path = __DIR__ . '/monofont.ttf';
    $font_size = $height * 0.75;
    $image = @imagecreate($width, $height) or die('Cannot initialize new GD image stream');
    $background_color = imagecolorallocate($image, 255, 255, 255);
    $text_color = imagecolorallocate($image, 20, 40, 100);
    $noise_color = imagecolorallocate($image, 225, 160, 11);
    for ($i = 0; $i < $width * $height / 3; $i++) {
        imagefilledellipse($image, mt_rand(0, $width), mt_rand(0, $height), 1, 1, $noise_color);
    }
    $textbox = imagettfbbox($font_size, 0, $font_path, $code) or die('Error in imagettfbbox function');
    $x = ($width - $textbox[4]) / 2;
    $y = ($height - $textbox[5]) / 2;
    imagettftext($image, $font_size, 0, $x, $y, $text_color, $font_path, $code) or die('Error in imagettftext function');
    header('Content-Type: image/jpeg');
    imagejpeg($image);
    imagedestroy($image);
    exit;
}
$width = isset($_GET['width']) ? (int) $_GET['width'] : 253;
$height = isset($_GET['height']) ? (int) $_GET['height'] : 60;
$characters = isset($_GET['characters']) && $_GET['characters'] > 1 ? (int) $_GET['characters'] : 6;
$_SESSION['security_code'] = generateCode($characters);
print_image($_SESSION['security_code'], $width, $height, $characters);
开发者ID:ionutmilica,项目名称:my-archive,代码行数:31,代码来源:captcha.php

示例12: __construct

 public function __construct($app)
 {
     $this->app = $app;
     $app->group('/user', function () use($app) {
         $app->get('/autocomplete', function () {
             $userService = new \Core\Service\UserService();
             echo json_encode($userService->getAutocomplete($_GET['s']));
         });
         $app->get('/check', function () {
             $userAvailible = ECP\UserQuery::create()->filterByName($_GET['name'])->count() == 0;
             echo json_encode((object) array('isAvailible' => $userAvailible));
         });
         $app->get('/status', function () {
             $userService = new \Core\Service\UserService();
             $isLoggedIn = $userService->isLoggedIn();
             if (!$isLoggedIn) {
                 die(json_encode((object) array('isLoggedIn' => false)));
             }
             $user = $userService->getLoggedInUser();
             echo json_encode((object) array('isLoggedIn' => true, 'id' => $user->id, 'username' => $user->username));
         });
         $app->post('/login', function () {
             $p = getPost();
             $user = ECP\UserQuery::create()->filterByName($p->username)->filterByPassword(sha1($p->password))->filterByConfirmationCode('')->findOne();
             if (!$user) {
                 die(json_encode((object) array('status' => 'incorrect credentials')));
             }
             $_SESSION['ecp'] = (object) array('id' => $user->getId(), 'username' => $user->getName());
             echo $this->getBoolStatus(true);
         });
         $app->post('/register', function () {
             $userService = new \Core\Service\UserService();
             $p = getPost();
             if (strpos($p->username, '/') !== false) {
                 die_err('Slashes are not allowed in names!');
             }
             $code = generateCode();
             $user = new ECP\User();
             $user->setName($p->username);
             $user->setPassword(sha1($p->password));
             $user->setEmail($p->email);
             $user->setCreated(time());
             $user->setConfirmationCode($code);
             $user->save();
             $userService->sendRegistrationMail($user);
             echo $this->getBoolStatus(true);
         });
         $app->post('/logout', function () {
             unset($_SESSION['ecp']);
             echo '{}';
         });
         $app->post('/recover-password', function () {
             $userService = new \Core\Service\UserService();
             $p = getPost();
             $users = ECP\UserQuery::create()->filterByEmail($p->email)->filterByConfirmationCode('')->find();
             foreach ($users as $user) {
                 $code = generateCode();
                 $user->setRecoverPasswordCode($code);
                 $user->save();
                 $userService->sendRecoverPassword($user);
             }
             echo $this->getBoolStatus(true);
         });
         $app->get('/reset-password-check', function () {
             $userCount = ECP\UserQuery::create()->filterByRecoverPasswordCode($_GET['code'])->count();
             echo $this->getBoolStatus($userCount != 0);
         });
         $app->post('/reset-password', function () {
             $p = getPost();
             $users = ECP\UserQuery::create()->filterByRecoverPasswordCode($p->code)->find();
             $found = false;
             foreach ($users as $user) {
                 $user->setRecoverPasswordCode('');
                 $user->setPassword(sha1($p->password));
                 $user->save();
                 $found = true;
             }
             echo $this->getBoolStatus($found);
         });
         $app->post('/confirm-registration', function () {
             $p = getPost();
             $users = ECP\UserQuery::create()->filterByConfirmationCode($p->code)->find();
             $found = false;
             foreach ($users as $user) {
                 $user->setConfirmationCode('');
                 $user->save();
                 $found = true;
             }
             echo $this->getBoolStatus($found);
         });
     });
 }
开发者ID:Covert-Inferno,项目名称:EVE-Composition-Planer,代码行数:92,代码来源:user.php

示例13: sendRandomPass

function sendRandomPass($email)
{
    $query = "select name from user where email='{$email}'";
    $status = mysql_query($query);
    $row = mysql_fetch_array($status);
    $user = $row['name'];
    $pass = generateCode();
    $salt = substr("{$user}", 0, 2);
    $epass = crypt($pass, $salt);
    $email = mysql_real_escape_string($email);
    $to = "{$email}";
    $from = "From: nobody@change.this.now";
    $subject = "password";
    $body = "hi, your password is {$pass}. please login using your email address and the password.  feel free to change your password at anytime.";
    if (mail($to, $subject, $body, $from)) {
        $params = array('email' => $email, 'pass' => $epass);
        $result = query("user.sendRandomPass", $params);
        echo "<p>Your new password has been sent!  <a href='login.php'>login</a> after you receive your password.</p>";
    } else {
        echo "<p>Message delivery failed...</p>";
    }
}
开发者ID:ultramookie,项目名称:dertyn,代码行数:22,代码来源:dertyn.php

示例14: die

$HOST_NAME = '127.0.0.1';
$USER_NAME = 'root';
$PASSWORD = '';
// Parse command line
if ($argc > 1) {
    $ACTION = $argv[1];
}
if ($ACTION == 'help') {
    die("Usage:\n\tphp query_cache_triggers [<action> [<hostname> [<username> [<password>]]]]\n");
}
$ALLOWED_ACTIONS = array('create', 'remove', 'gencode');
if (!in_array($ACTION, $ALLOWED_ACTIONS)) {
    die("Error: Invalid action {$ACTION} possible actions: " . implode(', ', $ALLOWED_ACTIONS) . "\n");
}
if ($ACTION == 'gencode') {
    generateCode();
    die;
}
if ($argc > 2) {
    $HOST_NAME = $argv[2];
}
if ($argc > 3) {
    $USER_NAME = $argv[3];
}
if ($argc > 4) {
    $PASSWORD = $argv[4];
}
// Connect to database
$link = mysql_connect($HOST_NAME, $USER_NAME, $PASSWORD) or die('Error: Could not connect: ' . mysql_error() . "\n");
// Make sure 'Memcached Functions for MySQL' is installed
mysql_select_db('mysql') or die("Error: Could not select 'mysql' database\n");
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:31,代码来源:createQueryCacheTriggers.php

示例15: generateCode

}
function generateCode($characters)
{
    // list all possible characters, similar looking characters and vowels have been removed
    $possible = '23456789bcdfghjkmnpqrstvwxyz';
    $code = '';
    $i = 0;
    while ($i < $characters) {
        $code .= substr($possible, mt_rand(0, strlen($possible) - 1), 1);
        $i++;
    }
    $session =& JFactory::getSession();
    $session->set('code', $code);
    return $code;
}
generateCode(5);
?>
	<script>
function clear_ses()
{
var form=document.contactform;
my_name.value="";
email.value="";
testimonial.value="";
return false;
}
</script>

<h2><?php 
echo $menuname;
?>
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:31,代码来源:default.php


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