Ejemplo n.º 1
0
function saveTokenInDB($conn, $token)
{
    if (!checkUnique($conn, $token)) {
        return false;
    }
    $stmt = $conn->prepare("insert into users (token, firstVisit, lastVisit) VALUES(?, NOW(), NOW())");
    if (!$stmt) {
        printError();
    }
    if ($stmt->bind_param("s", $token)) {
        if ($stmt->execute()) {
            return true;
        } else {
            printError();
        }
    } else {
        printError();
    }
}
Ejemplo n.º 2
0
 } else {
     if ($createTables) {
         echo gettext('Done with table update');
     } else {
         echo gettext('Done with table update with errors');
     }
 }
 echo "</h3>";
 checkUnique($tbl_administrators, array('valid' => 0, 'user' => 0));
 checkUnique($tbl_albums, array('folder' => 0));
 checkUnique($tbl_images, array('albumid' => 0, 'filename' => 0));
 checkUnique($tbl_options, array('name' => 0, 'ownerid' => 0, 'theme' => 0));
 checkUnique($tbl_news_categories, array('titlelink' => 0));
 checkUnique($tbl_news, array('titlelink' => 0));
 checkUnique($tbl_pages, array('titlelink' => 0));
 checkUnique($tbl_tags, array('name' => 0));
 // set defaults on any options that need it
 setupLog(gettext("Done with database creation and update"));
 if ($prevRel = getOption('zenphoto_release')) {
     setupLog(sprintf(gettext("Previous Release was %s"), $prevRel), true);
 }
 require dirname(__FILE__) . '/setup-option-defaults.php';
 if ($debug == 'base64') {
     // update zenpage codeblocks--remove the base64 encoding
     $sql = 'SELECT `id`, `codeblock` FROM ' . prefix('news') . ' WHERE `codeblock` NOT REGEXP "^a:[0-9]+:{"';
     $result = query_full_array($sql, false);
     if (is_array($result)) {
         foreach ($result as $row) {
             $codeblock = base64_decode($row['codeblock']);
             $sql = 'UPDATE ' . prefix('news') . ' SET `codeblock`=' . db_quote($codeblock) . ' WHERE `id`=' . $row['id'];
             query($sql);
Ejemplo n.º 3
0
                $str = '';
                for ($i = 0; $i < $len; $i++) {
                    $str .= substr($pool, mt_rand(0, strlen($pool) - 1), 1);
                }
                return $str;
                break;
            case 'unique':
                return md5(uniqid(mt_rand()));
                break;
        }
    }
    //create userprofile url
    $nospacename = $_POST['username'];
    // need to create singleword for user  profileurl
    $createprofileurl = str_replace(" ", "", $nospacename);
    if ($_POST['username'] != '' && $_POST['password'] != '' && $_POST['password'] == $_POST['password_confirmed'] && $_POST['email'] != '' && valid_email($_POST['email']) == TRUE && checkUnique('Username', $_POST['username']) == TRUE && checkUnique('Email', $_POST['email']) == TRUE) {
        $db->query = "INSERT INTO users (Username , Password, Email, Active, Level_access, Random_key, userprofile) VALUES ('" . mysql_real_escape_string($_POST['username']) . "', '" . mysql_real_escape_string(md5($_POST['password'])) . "', '" . mysql_real_escape_string($_POST['email']) . "', '1', '3', '" . random_string('alnum', 32) . "', '{$createprofileurl}') ";
        $resultbaseurl = mysql_query($db->query) or die(mysql_error());
    } else {
        $error = 'There is an error with the registration data.  Either the username and/or email address are already taken or the password comfirmation is different from the password entered.';
    }
    echo '<h1>Setup is complete.</h1>';
    echo 'Go to ';
    ?>
<a href="<?php 
    echo LLFOLDER;
    ?>
controlpanel/login/login.php">Control Panel Login</a><?php 
}
// closes if installed pressed
?>
Ejemplo n.º 4
0
    loadForm();
} elseif ($action == 'autoload') {
    autoloadForm();
} elseif ($action == 'mail') {
    mailForm();
} elseif ($action == 'dbmail') {
    saveToDB();
    mailForm();
} elseif ($action == 'submit') {
    saveToDB();
} elseif ($action == 'delete') {
    deleteForm();
} elseif ($action == 'updatebyid') {
    updateFormById();
} elseif ($action == 'unique') {
    checkUnique();
} else {
    echo "Action Not Recognized";
}
exit;
function autoloadForm()
{
    $dataPost = $_POST;
    printArray($dataPost);
}
function loadForm()
{
    $dataPost = $_POST;
    if (isset($dataPost["frmID"])) {
        $sForm = $dataPost["frmID"];
        unset($dataPost["frmID"]);