Exemple #1
0
$totalRows_admin01 = mysql_num_rows($admin01);
if ($_POST['ck'] == $row_admin01['ck']) {
    ///////////////////////////////////////////////////////////////////////////
    function generatorPassword()
    {
        $password_len = 6;
        $password = '';
        // remove o,0,1,l
        $word = 'qwertyuiopasdfghjklzxcvbnm123456789';
        $len = strlen($word);
        for ($i = 0; $i < $password_len; $i++) {
            $password .= $word[rand() % $len];
        }
        return $password;
    }
    $shortlinkid = generatorPassword();
    ///////////////////////////////////////////////////////////////////////////
    // *** Redirect if username exists
    $MM_flag = "MM_insert";
    if (isset($_POST[$MM_flag])) {
        $MM_dupKeyRedirect = "index.php?no=no";
        $loginUsername = $shortlinkid;
        $LoginRS__query = "SELECT id FROM link WHERE id='" . $loginUsername . "'";
        mysql_select_db($database_link, $link);
        $LoginRS = mysql_query($LoginRS__query, $link) or die(mysql_error());
        $loginFoundUser = mysql_num_rows($LoginRS);
        //if there is a row in the database, the username was found - can not add the requested username
        if ($loginFoundUser) {
            $MM_qsChar = "?";
            //append the username to the redirect page
            if (substr_count($MM_dupKeyRedirect, "?") >= 1) {
Exemple #2
0
function getrandname($name, $len = 4)
{
    $array_name = explode(".", $name);
    $newname = $array_name[0] . generatorPassword($len) . "." . $array_name[1];
    return $newname;
}