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


PHP generateKey函数代码示例

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


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

示例1: init

 public function init($user, $pass, $host)
 {
     $this->_host = $host;
     $this->_user = $user;
     $this->_password = $pass;
     $this->_resource = 'moxl' . \generateKey(6);
     $this->_start = date(DATE_ISO8601);
     $sd = new \Modl\SessionxDAO();
     $s = $this->inject();
     $sd->init($s);
 }
开发者ID:Anon215,项目名称:movim,代码行数:11,代码来源:Sessionx.php

示例2: foursquareEncrypt

function foursquareEncrypt($plaintext)
{
    $key1 = generateKey();
    $key2 = generateKey();
    $upperLeft = "abcdefghiklmnopqrstuvwxyz";
    $upperRight = $key1;
    $lowerLeft = $key2;
    $lowerRight = "abcdefghiklmnopqrstuvwxyz";
    $_SESSION["key"] = $key1 . " " . $key2;
    return encode($plaintext, $upperLeft, $upperRight, $lowerLeft, $lowerRight);
}
开发者ID:WilliamRADFunk,项目名称:encryptor,代码行数:11,代码来源:foursquare.php

示例3: store

 public final function store()
 {
     $sess = \Session::start();
     // Generating the iq key.
     $id = \generateKey(6);
     $sess->set('id', $id);
     // We serialize the current object
     $obj = new \StdClass();
     $obj->type = get_class($this);
     $obj->object = serialize($this);
     $obj->time = time();
     //$_instances = $this->clean($_instances);
     $sess->set($id, $obj);
 }
开发者ID:movim,项目名称:moxl,代码行数:14,代码来源:Action.php

示例4: store

 public final function store()
 {
     $sess = \Session::start();
     //$_instances = $sess->get('xecinstances');
     // Set a new Id for the Iq request
     $session = \Sessionx::start();
     // Generating the iq key.
     $id = $session->id = \generateKey(6);
     // We serialize the current object
     $obj = new \StdClass();
     $obj->type = get_class($this);
     $obj->object = serialize($this);
     $obj->time = time();
     //$_instances = $this->clean($_instances);
     $sess->set($id, $obj);
 }
开发者ID:Hywan,项目名称:moxl,代码行数:16,代码来源:Action.php

示例5: playfairEncrypt

function playfairEncrypt($plaintext)
{
    $_SESSION["key"] = generateKey();
    return encode($plaintext, $_SESSION["key"]);
}
开发者ID:WilliamRADFunk,项目名称:encryptor,代码行数:5,代码来源:playfair.php

示例6: init

 public function init($user, $pass, $host, $domain)
 {
     $this->_port = 5222;
     $this->_host = $host;
     $this->_domain = $domain;
     $this->_user = $user;
     $this->_password = $pass;
     $this->_resource = 'moxl' . \generateKey(6);
     $this->_start = date(DATE_ISO8601);
     $this->_rid = rand(1, 2048);
     $this->_id = 0;
     $sd = new modl\SessionxDAO();
     $s = $this->inject();
     $sd->init($s);
 }
开发者ID:Nyco,项目名称:movim,代码行数:15,代码来源:Sessionx.php

示例7: checkCredentials

function checkCredentials($username, $password)
{
    global $db;
    $query = $db->prepare("SELECT * FROM users WHERE username = :username AND password = SHA1(:password)");
    $query->execute(array(":username" => $username, ":password" => $password));
    if ($query->fetchObject()) {
        return true;
    } else {
        return false;
    }
}
function clearPrevious($username)
{
    global $db;
    $db->prepare("DELETE FROM keystbl WHERE user = :username")->execute(array(":username" => $username));
}
if (!isset($_POST["username"]) || !isset($_POST["password"])) {
    echo json_encode(array("text" => "INVALID_LOGIN"));
} else {
    $username = $_POST["username"];
    $password = $_POST["password"];
    if (!checkCredentials($username, $password)) {
        echo json_encode(array("text" => "INVALID_LOGIN"));
    } else {
        clearPrevious($username);
        $token = generateKey();
        echo json_encode(array("text" => "LOGIN_SUCCESSFUL", "token" => $token));
        $query = $db->prepare("INSERT INTO keystbl(user, token) VALUES (:user, :token)");
        $query->execute(array(":user" => $username, ":token" => $token));
    }
}
开发者ID:TheMemSet,项目名称:HaberRipoff,代码行数:31,代码来源:login.php

示例8: register_first_user

function register_first_user()
{
    global $wpdb;
    //get database table prefix
    $table_prefix = mlm_core_get_table_prefix();
    $error = '';
    $chk = 'error';
    //most outer if condition
    if (isset($_POST['submit'])) {
        $username = sanitize_text_field($_POST['username']);
        $password = sanitize_text_field($_POST['password']);
        $confirm_pass = sanitize_text_field($_POST['confirm_password']);
        $email = sanitize_text_field($_POST['email']);
        $confirm_email = sanitize_text_field($_POST['confirm_email']);
        $firstname = sanitize_text_field($_POST['first_name']);
        $lastname = sanitize_text_field($_POST['last_name']);
        //Add usernames we don't want used
        $invalid_usernames = array('admin');
        //Do username validation
        $username = sanitize_user($username);
        if (!validate_username($username) || in_array($username, $invalid_usernames)) {
            $error .= "\n Username is invalid.";
        }
        if (username_exists($username)) {
            $error .= "\n Username already exists.";
        }
        if (checkInputField($username)) {
            $error .= "\n Please enter your username.";
        }
        if (checkInputField($password)) {
            $error .= "\n Please enter your password.";
        }
        if (confirmPassword($password, $confirm_pass)) {
            $error .= "\n Please confirm your password.";
        }
        //Do e-mail address validation
        if (!is_email($email)) {
            $error .= "\n E-mail address is invalid.";
        }
        if (email_exists($email)) {
            $error .= "\n E-mail address is already in use.";
        }
        if (confirmEmail($email, $confirm_email)) {
            $error .= "\n Please confirm your email address.";
        }
        //generate random numeric key for new user registration
        $user_key = generateKey();
        // outer if condition
        if (empty($error)) {
            $user = array('user_login' => $username, 'user_pass' => $password, 'user_email' => $email, 'first_name' => $firstname, 'last_name' => $lastname, 'role' => 'mlm_user');
            // return the wp_users table inserted user's ID
            $user_id = wp_insert_user($user);
            /* Send e-mail to admin and new user - 
               You could create your own e-mail instead of using this function */
            wp_new_user_notification($user_id, $password);
            //insert the data into fa_user table
            $insert = "INSERT INTO {$table_prefix}mlm_users\n\t\t\t\t\t\t   \t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tuser_id, username, user_key, parent_key, sponsor_key, leg, payment_status\n\t\t\t\t\t\t\t\t\t\t\t\t\t) \n\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $user_id . "','" . $username . "', '" . $user_key . "', '0', '0', '0','1'\n\t\t\t\t\t\t\t\t\t\t\t\t\t)";
            // if all data successfully inserted
            if ($wpdb->query($insert)) {
                $chk = '';
                //$msg = "<span style='color:green;'>Congratulations! You have successfully registered in the system.</span>";
            }
        }
        //end outer if condition
    }
    //end most outer if condition
    //if any error occoured
    if (!empty($error)) {
        $error = nl2br($error);
    }
    if ($chk != '') {
        include 'js-validation-file.html';
        ?>
        <div class='wrap'>
            <h2><?php 
        _e('Create First User in Network', 'binary-mlm-pro');
        ?>
</h2>
            <div class="notibar msginfo">
                <a class="close"></a>
                <p><?php 
        _e('In order to begin building your network you would need to register the First User of the network. All other users would be registered under this First User.', 'binary-mlm-pro');
        ?>
</p>
            </div>
            <?php 
        if ($error) {
            ?>
                <div class="notibar msgerror">
                    <a class="close"></a>
                    <p> <strong><?php 
            _e('Please Correct the following Error(s)', 'binary-mlm-pro');
            ?>
:</strong> <?php 
            _e($error);
            ?>
</p>
                </div>
            <?php 
        }
//.........这里部分代码省略.........
开发者ID:EvandroEpifanio,项目名称:binary-mlm-pro,代码行数:101,代码来源:admin-create-first-user.php

示例9: generateKey

 } else {
     $leg = $_POST['leg'];
 }
 if ($leg != '0') {
     if ($leg != '1') {
         $error .= "\n You have enter a wrong placement.";
     }
 }
 //generate random numeric key for new user registration
 $user_key = generateKey();
 //if generated key is already exist in the DB then again re-generate key
 do {
     $check = mysql_fetch_array(mysql_query("SELECT COUNT(*) ck \n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . WPMLM_TABLE_USER . " \n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `user_key` = '" . $user_key . "'"));
     $flag = 1;
     if ($check['ck'] == 1) {
         $user_key = generateKey();
         $flag = 0;
     }
 } while ($flag == 0);
 //check parent key exist or not
 if (isset($_GET['k']) && $_GET['k'] != '') {
     if (!checkKey($_GET['k'])) {
         $error .= "\n Parent key does't exist.";
     }
     // check if the user can be added at the current position
     $checkallow = checkallowed($_GET['k'], $leg);
     if ($checkallow >= 1) {
         $error .= "\n You have enter a wrong placement.";
     }
 }
 // outer if condition
开发者ID:juano2h,项目名称:binary-mlm-ecommerce,代码行数:31,代码来源:wpmlm-registration.php

示例10: HTML2PDF

     }
     $content .= "</tr>";
 }
 $content .= "</tbody>\n\t\t</table>\n\t\t<br>\n\t\t<br>\n\t\t<b><u>Proceso de revisión:</u></b> " . $_POST[TER_procesorevision] . "<br>\n\t\t<b><u>Fecha estimada de firma:</u></b> " . $_POST[TER_fechafirma] . "<br>\n\t\t<b><u>Depósito de seriedad:</u></b> " . $_POST[TER_deposito] . "<br>\n\t\t<b><u>Referencia:</u></b> Puede realizar el depósito de seriedad con la referencia: " . $_POST[TER_referencia] . ", a la cuenta de Banorte: 0806433934, CLABE: 072225008064339344, a nombre de: Préstamo Empresarial Oportuno S.A. de C.V. SOFOM ENR.<br>\n\t\t<br>\n\t\t\n\t\t<nobreak>\n\t\t<table cellspacing='0' style='width: 100%; text-align: left;'>\n\t\t\t<tr>\n\t\t\t\t<td style='width:50%;'>\n\t\t\t\t\tAtentamente<br><br>\n\t\t\t\t\t" . $_POST[TER_remitente] . "<br>\n\t\t\t\t\t" . $_POST[TER_puesto] . "<br>\n\t\t\t\t\tPréstamo Empresarial Oportuno, S.A. de C.V., SOFOM, E.N.R.<br>\n\t\t\t\t</td>\n\t\t\t\t<td style='width:50%;'>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</nobreak>\n\t\t</page>";
 // convert to PDF
 require_once '../../html2pdf/html2pdf.class.php';
 try {
     $html2pdf = new HTML2PDF('P', 'Letter', 'es');
     $html2pdf->pdf->SetDisplayMode('fullpage');
     //$html2pdf->pdf->SetProtection(array('print'), 'spipu');
     $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
     $ruta = "../../expediente/";
     $nombreoriginal = "TC" . $date . "-" . strtoupper($myroworg[organizacion]);
     $nombre = "T" . time() . "C" . rand(100, 999) . rand(10, 99) . ".pdf";
     $html2pdf->Output($ruta . $nombre, 'F');
     $clavearchivo = generateKey();
     //Verificar si ya hay archivo de TERMINOS Y CONDICIONES generado
     $sqlfile = "SELECT * FROM archivos WHERE id_tipoarchivo='10' AND id_oportunidad='" . $_POST[oportunidad] . "'";
     $rsfile = mysql_query($sqlfile, $db);
     $rwfile = mysql_fetch_array($rsfile);
     $archivoanterior = "../../expediente/" . $rwfile[nombre];
     if ($rwfile) {
         //Obtener referencia anterior
         $sqref = "SELECT * FROM `referencias` WHERE asignada=1 AND descartado=0 AND clave_oportunidad='" . $myrowopt[clave_oportunidad] . "' ORDER BY fecha_asignacion ASC LIMIT 1";
         $rsref = mysql_query($sqlref, $db);
         $rwref = mysql_fetch_array($rsref);
         unlink($archivoanterior);
         //Borrar archivo anterior
         $sqlarchivo = "UPDATE `archivos` SET `nombre`='{$nombre}', `fecha_modificacion`=NOW(), `aprobado`='0' WHERE `id_archivo` = '" . $rwfile[id_archivo] . "'";
         //Actualizar registro
         $sqlhistorial = "INSERT INTO `historialarchivos`(`id_historialarchivo`, `clave_archivo`, `id_oportunidad`, `id_expediente`, `actividad`, `motivo`, `fecha_actividad`, `usuario`) VALUES (NULL, '{$rwfile['clave_archivo']}', '{$_POST['oportunidad']}','3','Reemplazado', '', NOW(),'{$claveagente}')";
开发者ID:specimen90868,项目名称:crmprueba,代码行数:31,代码来源:insert_terminos.php

示例11: openConnection

<?php

include "DatabaseHandling.php";
$key = "";
$char = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$conn = openConnection();
$longlink = "{$_POST['urllink']}";
$key = checkForDuplicateLinks($longlink, $conn);
if ($key === NULL) {
    $key = generateKey(6);
    $finalKey = checkForDuplicateKeys($key, $conn);
    addDataToDatabase($key, $longlink, $conn);
}
$myfile = fopen("{$key}", "w") or die("Unable to open file!");
$myfileToRead = fopen("check.php", "r") or die("Unable to open file!");
$txt = fread($myfileToRead, filesize("check.php"));
fclose($myfileToRead);
fwrite($myfile, $txt);
fclose($myfile);
$conn->close();
//header( 'Location: http://kclproject.esy.es/shorten/');
开发者ID:jaredkoh,项目名称:FinalYearProject,代码行数:21,代码来源:info.php

示例12: urldecode

$realm = !array_key_exists('realm', $_GET) ? $recruit_realm : urldecode($_GET['realm']);
$region = !array_key_exists('region', $_GET) ? $recriot_region : urldecode($_GET['region']);
// connect to mysql and select the database
$conn = mysql_connect(WHP_DB_HOST, WHP_DB_USER, WHP_DB_PASS) or die(mysql_error());
mysql_select_db(WHP_DB_NAME) or die(mysql_error());
if ($name == '') {
    print 'No name provided.';
    mysql_close($conn);
    exit;
}
if ($mode == '') {
    print 'No mode provided.';
    mysql_close($conn);
    exit;
}
$key = generateKey($name, $realm, $region);
if (trim($key) == '') {
    print 'Unique key not provided.';
    mysql_close($conn);
    exit;
}
if ($mode == 'gearlist') {
    $query = mysql_query("SELECT gearlist FROM " . WHP_DB_PREFIX . "recruit WHERE uniquekey='{$key}' AND cache > UNIX_TIMESTAMP(NOW()) - {$recruit_cache} LIMIT 1");
    list($list) = @mysql_fetch_array($query);
    if (mysql_num_rows($query) == 0 || trim($list) == '') {
        // nothing in the cache, so we need to query
        $xml_data = getXML(characterURL($name, $region, $realm));
        if (!($xml = @simplexml_load_string($xml_data, 'SimpleXMLElement'))) {
            print $language->words['invalid_xml'];
            mysql_close($conn);
            exit;
开发者ID:ubick,项目名称:lorekeepers.org,代码行数:31,代码来源:recruit.php

示例13: hillEncrypt

function hillEncrypt($plaintext)
{
    $sizeOfKey = rand(2, 9);
    $_SESSION["key"] = generateKey($sizeOfKey);
    return encode($plaintext, $_SESSION["key"], $sizeOfKey);
}
开发者ID:WilliamRADFunk,项目名称:encryptor,代码行数:6,代码来源:hill.php

示例14: generateKey

<?php

function generateKey($length = 10)
{
    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $charactersLength = strlen($characters);
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[rand(0, $charactersLength - 1)];
    }
    return $randomString;
}
$rankey = generateKey();
echo $rankey;
$con = mysqli_connect("localhost", "cl10-admin-uzl", "supernova", "cl10-admin-uzl");
$sql = "INSERT INTO `user`(`emailid`,`pwd`,`key`) VALUES ('{$_POST['email']}','{$_POST['pwd']}','{$rankey}')";
if (!mysqli_query($con, $sql)) {
    echo "Could not enter data" . mysqli_error($con);
}
开发者ID:RaakeshMadana,项目名称:locshare,代码行数:19,代码来源:keygen.php

示例15: generate


//.........这里部分代码省略.........
                         $description->addAttribute('maxptime', $matches[1]);
                         break;
                         // http://xmpp.org/extensions/xep-0338.html
                     // http://xmpp.org/extensions/xep-0338.html
                     case 'group':
                         $group = $this->jingle->addChild('group');
                         $group->addAttribute('xmlns', "urn:xmpp:jingle:apps:grouping:0");
                         $group->addAttribute('semantics', $matches[1]);
                         $params = explode(' ', $matches[2]);
                         foreach ($params as $value) {
                             $content = $group->addChild('content');
                             $content->addAttribute('name', trim($value));
                         }
                         break;
                         // http://xmpp.org/extensions/xep-0320.html
                     // http://xmpp.org/extensions/xep-0320.html
                     case 'fingerprint':
                         if ($this->content == null) {
                             $this->global_fingerprint['fingerprint'] = $matches[2];
                             $this->global_fingerprint['hash'] = $matches[1];
                         } else {
                             $fingerprint = $this->transport->addChild('fingerprint', $matches[2]);
                             $fingerprint->addAttribute('xmlns', "urn:xmpp:jingle:apps:dtls:0");
                             $fingerprint->addAttribute('hash', $matches[1]);
                         }
                         break;
                         // http://xmpp.org/extensions/inbox/jingle-dtls.html
                     // http://xmpp.org/extensions/inbox/jingle-dtls.html
                     case 'sctpmap':
                         $sctpmap = $this->transport->addChild('sctpmap');
                         $sctpmap->addAttribute('xmlns', "urn:xmpp:jingle:transports:dtls-sctp:1");
                         $sctpmap->addAttribute('number', $matches[1]);
                         $sctpmap->addAttribute('protocol', $matches[2]);
                         $sctpmap->addAttribute('streams', $matches[3]);
                         break;
                     case 'setup':
                         if ($this->content != null) {
                             $fingerprint->addAttribute('setup', $matches[1]);
                         }
                         break;
                     case 'pwd':
                         if ($this->content == null) {
                             $this->global_fingerprint['pwd'] = $matches[1];
                         } else {
                             $this->transport->addAttribute('pwd', $matches[1]);
                         }
                         break;
                     case 'ufrag':
                         if ($this->content == null) {
                             $this->global_fingerprint['ufrag'] = $matches[1];
                         } else {
                             $this->transport->addAttribute('ufrag', $matches[1]);
                         }
                         break;
                     case 'candidate':
                         $generation = "0";
                         $network = "0";
                         $id = generateKey(10);
                         if ($key = array_search("generation", $matches)) {
                             $generation = $matches[$key + 1];
                         }
                         if ($key = array_search("network", $matches)) {
                             $network = $matches[$key + 1];
                         }
                         if ($key = array_search("id", $matches)) {
                             $id = $matches[$key + 1];
                         }
                         if (isset($matches[11]) && isset($matches[13])) {
                             $reladdr = $matches[11];
                             $relport = $matches[13];
                         } else {
                             $reladdr = $relport = null;
                         }
                         $candidate = $this->transport->addChild('candidate');
                         $candidate->addAttribute('component', $matches[2]);
                         $candidate->addAttribute('foundation', $matches[1]);
                         $candidate->addAttribute('generation', $generation);
                         $candidate->addAttribute('id', $id);
                         $candidate->addAttribute('ip', $matches[5]);
                         $candidate->addAttribute('network', $network);
                         $candidate->addAttribute('port', $matches[6]);
                         $candidate->addAttribute('priority', $matches[4]);
                         $candidate->addAttribute('protocol', $matches[3]);
                         $candidate->addAttribute('type', $matches[8]);
                         if ($reladdr) {
                             $candidate->addAttribute('rel-addr', $reladdr);
                             $candidate->addAttribute('rel-port', $relport);
                         }
                         break;
                 }
             }
         }
     }
     // We reindent properly the Jingle package
     $xml = $this->jingle->asXML();
     $doc = new \DOMDocument();
     $doc->loadXML($xml);
     $doc->formatOutput = true;
     return substr($doc->saveXML(), strpos($doc->saveXML(), "\n") + 1);
 }
开发者ID:christine-ho-dev,项目名称:movim,代码行数:101,代码来源:SDPtoJingle.php


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