<?php //include mysql settings include_once $_SERVER['DOCUMENT_ROOT'] . '/202-config/connect.php'; //check to see if this is already installed, if so dob't do anything if (upgrade_needed() == false) { _die("<h2>Already Upgraded</h2>\n\t\t\t Your Prosper202 version {$version} is already upgraded."); } if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (UPGRADE::upgrade_databases() == true) { $success = true; } else { $error = true; } } //only show install setup, if it, of course, isn't install already. if ($success != true) { info_top(); ?> <?php if ($error == true) { ?> <h2 style="color: #900;">An error occured</h2> <span style="color: #900;">An unexpected error occured while you were trying to upgrade, please try again or if you keep encountering problems please contact <a href="http://prosper202.com/forum">our support forum</a>.</span> <br/><br/> <?php } ?>
<?php //if the 202-config.php doesn't exist, we need to build one if (!file_exists($_SERVER['DOCUMENT_ROOT'] . '/202-config.php')) { require_once $_SERVER['DOCUMENT_ROOT'] . '/202-config/functions.php'; _die("There doesn't seem to be a <code>202-config.php</code> file. I need this before we can get started. Need more help? <a href=\"http://prosper202.com/apps/about/contact/\">Contact Us</a>. You can <a href='/202-config/setup-config.php'>create a <code>202-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.", "202 › Error"); } else { require_once $_SERVER['DOCUMENT_ROOT'] . '/202-config/connect.php'; if (is_installed() == false) { header('location: /202-config/install.php'); } else { if (upgrade_needed() == true) { header('location: /202-config/upgrade.php'); } else { require_once $_SERVER['DOCUMENT_ROOT'] . '/202-config.php'; header('location: /' . LOGIN_URI); } } }
//set token to prevent CSRF attacks if (!isset($_SESSION['token'])) { $_SESSION['token'] = md5(uniqid(rand(), TRUE)); } //don't run the upgrade, if regular users are being redirected through the self-hosted software if ($navigation[1] == 'tracking202' and $navigation[2] == 'static') { $skip_upgrade = true; } if ($navigation[1] == 'tracking202' and $navigation[2] == 'redirect') { $skip_upgrade = true; } if ($skip_upgrade == false) { //only check to see if upgraded, if this thing is acutally already installed if (is_installed() == true) { //if we need upgrade, and its not already on the upgrade screen, redirect to the upgrade screen if (upgrade_needed() == true and ($navigation[1] != '202-config' and $navigation[2] != 'upgrade.php')) { header('location: /202-config/upgrade.php'); die; } } } //if safe mode is turned on, and the user is trying to use offers202, stats202 or alerts202, show the error page switch ($navigation[1]) { case "offers202": case "alerts202": case "stats202": if (@ini_get('safe_mode')) { header('location: /202-account/disable-safe-mode.php'); die; } break;