function newURL()
{
    global $db;
    if (isset($_POST['shorten']) && !empty($_POST['url']) && $_POST['URL'] != 'http://') {
        $url = $_POST['url'];
        $random = randomize();
        $exist = "SELECT short FROM " . REDIRECT . " WHERE short = '{$random}'";
        $x = $db->query_first($exist);
        if ($db->affected_rows == false) {
            $exist = "SELECT short, url FROM " . REDIRECT . " WHERE url = '{$url}'";
            $x = $db->query_first($exist);
            if ($db->affected_rows == false) {
                $data['url'] = $url;
                $data['short'] = $random;
                $data['created'] = date('Y-m-d H:i:s');
                $db->insert(REDIRECT, $data);
                $result = 'http://' . SITE_URL . '/' . $data['short'] . ' = ' . $url;
                header('Location:/admin/');
            } else {
                if ($x['active'] == '0') {
                    errors('This link has been disabled.');
                }
            }
        } else {
            errors('Please try again.');
        }
        //else:
        //	errors('Bad URL or empty URL.');
    }
}
         smn_redirect(smn_href_link(FILENAME_ADMIN_MEMBERS, 'page=' . $_GET['page'] . 'mID=' . $_GET['mID'] . '&error=email&action=new_member'));
     } else {
         function randomize()
         {
             $salt = "abchefghjkmnpqrstuvwxyz0123456789";
             srand((double) microtime() * 1000000);
             $i = 0;
             while ($i <= 7) {
                 $num = rand() % 33;
                 $tmp = substr($salt, $num, 1);
                 $pass = $pass . $tmp;
                 $i++;
             }
             return $pass;
         }
         $makePassword = randomize();
         $sql_data_array = array('admin_groups_id' => smn_db_prepare_input($_POST['admin_groups_id']), 'admin_firstname' => smn_db_prepare_input($_POST['admin_firstname']), 'admin_lastname' => smn_db_prepare_input($_POST['admin_lastname']), 'admin_email_address' => smn_db_prepare_input($_POST['admin_email_address']), 'admin_password' => smn_encrypt_password($makePassword), 'admin_created' => 'now()');
         smn_db_perform(TABLE_ADMIN, $sql_data_array);
         $admin_id = smn_db_insert_id();
         smn_mail($_POST['admin_firstname'] . ' ' . $_POST['admin_lastname'], $_POST['admin_email_address'], ADMIN_EMAIL_SUBJECT, sprintf(ADMIN_EMAIL_TEXT, $_POST['admin_firstname'], HTTP_SERVER . DIR_WS_ADMIN, $_POST['admin_email_address'], $makePassword, STORE_OWNER), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
         smn_redirect(smn_href_link(FILENAME_ADMIN_MEMBERS, 'page=' . $_GET['page'] . '&mID=' . $admin_id));
     }
     break;
 case 'member_edit':
     $admin_id = smn_db_prepare_input($_POST['admin_id']);
     $hiddenPassword = '******';
     $stored_email[] = 'NONE';
     $check_email_query = smn_db_query("select admin_email_address from " . TABLE_ADMIN . " where admin_id <> " . $admin_id . "");
     while ($check_email = smn_db_fetch_array($check_email_query)) {
         $stored_email[] = $check_email['admin_email_address'];
     }
Beispiel #3
0
echo $mylogo;
?>
" alt="a dynamic burger header logo" id="logo" />
			<a href="index.html"><img class="logo" src="images/logo.png" width="513" height="84" alt="" title=""></a>
			
			<ul class="navigation">
			<?php 
echo makelinks($nav1, '<li>', '</li>', '<li class="active">');
?>
            <?php 
//if(isset($_GET['day']))
if ($title = "ABOUT") {
    echo randomize($heros);
} else {
    if ($title = "CONTACT") {
        echo randomize($heros);
    } else {
        echo "";
    }
}
?>
    
                <!-- <li>
					<a href="index.html">Home</a>
				</li>
				<li>
					<a class="active" href="about.html">About</a>
				</li>
				<li>
					<a href="burger.html">Menu</a>
				</li>
Beispiel #4
0
function showSidebar($page, $icons, $planets)
{
    if ($page === 'Registration' || $page === 'Contact') {
        echo randomize($icons) . '<br /><br /><br />';
        echo rotate($planets);
    } else {
        echo "";
    }
}
   $widget = randomize($heros);
   
   break;*/
 case "daily.php":
     $title = "Daily Special!";
     $pageID = "Daily Special";
     //$headerImage = "Waitress2.jpg";
     $headerImage = "waitress.png";
     $widget = rotate($planets);
     break;
 case "index.php":
     $title = "Home Page";
     $pageID = "Welcome to the Retro Diner Home Page!";
     $headerImage = "waitress.png";
     //$widget = '';
     $widget = randomize($heros);
     break;
 case "contact.php":
     $title = "Contact Page";
     $pageID = "Contact Page";
     //$headerImage = "fries2.jpg";
     $headerImage = "waitress.png";
     $widget = '';
     break;
 case "links.php":
     $title = "Links Page";
     $pageID = "Links Page";
     //$headerImage = "burger.jpg";
     $headerImage = "waitress.png";
     $widget = '';
     break;
Beispiel #6
0
{
    $f = file($codes) or die("Can't open codes: {$codes}");
    return $f[$line];
}
function setIndex($index, $value)
{
    $fh = fopen($index, 'w') or die("Can't open index: {$index}");
    fwrite($fh, $value);
    fclose($fh);
}
// if either codes.txt or codes.index doesn't exist, generate new codes.
if (!file_exists($index) || !file_exists($codes)) {
    generate($codes);
    randomize($codes);
}
/* begin main program */
$i = getIndex($index);
$lines = count(file($codes));
if ($i == $lines) {
    // shuffle file and reset the count
    randomize($codes);
    setIndex($index, '0');
    $i = 0;
}
$read = file($codes);
// read all the codes into $read
echo $read[$i];
// output the $i-th line
$i++;
//incrament the counter and save it
setIndex($index, $i);
$username = $_SESSION['username'];
$sql = "select * from oe_mechatron_users where Username='******'";
$result = mysqli_query($con, $sql);
$count = mysqli_num_rows($result);
if ($count == 0) {
    $q = randomize();
    $sql = "insert into oe_mechatron_users(Username,QNo,Skip,Answered,Options,Score,Complete) values('{$username}','0','3','0','0','0','0')";
    $result = mysqli_query($con, $sql);
}
$sql1 = "select * from oe_mechatron_users where Username='******'";
$result1 = mysqli_query($con, $sql1);
$row = mysqli_fetch_array($result1, MYSQL_ASSOC);
$qno = $row['QNo'];
$answered = $row['Answered'];
if ($qno == 0 || $answered > 3) {
    $q = randomize();
    $sql = "update oe_mechatron_users set QNo='{$q}' where Username='******'";
    $result = mysqli_query($con, $sql);
    $sql = "insert into oe_mechatron_user_log(Username,QNo) values('{$username}','{$q}')";
    $result = mysqli_query($con, $sql);
    $sql = "select * from oe_mechatron_questions where Id='{$q}'";
    $result = mysqli_query($con, $sql);
    $row1 = mysqli_fetch_array($result);
    $question = $row1['Question'];
    $o1 = $row1['O1'];
    $o2 = $row1['O2'];
    $o3 = $row1['O3'];
    $o4 = $row1['O4'];
    $o5 = $row1['O5'];
    $o6 = $row1['O6'];
    $image = $row1['Image'];
Beispiel #8
0
<?php

//Declaring a function inside a function (sounds funny I know)
function randomize($array)
{
    foreach ($array as $value) {
        $value = rand();
    }
    return $value;
}
//Declaring a most complicated array in the world and test it with the function above
$test = array(1, 2, 3, 4, 5);
echo randomize($test);