################################################################ # RandomURL 0,12 # Released under the terms of the GNU General Public License. # Please refer to the README file for more information. ################################################################ $version = "0,12"; $settings = file("settings"); $settings[11] = str_replace("\n", "", $settings[11]); $settings[11] = str_replace("\r", "", $settings[11]); require("language_files/$settings[11]"); ########################################################### # Checking for a valid user name and password # when the user tries to enter the administration areas ########################################################### $badlogin = "You need a valid user name and password to access this page."; $settings[12] = str_replace("\n", "", $settings[12]); $settings[12] = str_replace("\r", "", $settings[12]); $settings[13] = str_replace("\n", "", $settings[13]); $settings[13] = str_replace("\r", "", $settings[13]); if ($page == "admin" || $page == "password" || $page == "language") { if (!$PHP_AUTH_USER) { header("WWW-Authenticate: Basic realm=\"RandomURL\""); header("HTTP/1.0 401 Unauthorized"); echo $badlogin; exit; } else { if ($PHP_AUTH_USER != $settings[12] || crypt($PHP_AUTH_PW, "sa") != $settings[13]) { echo $badlogin; exit; } } } ############################################ # Redirection ############################################ if (!$QUERY_STRING) { if (!file_exists("urls")) { echo "RandomURL error! The file \"urls\" could not be found."; exit; } if (filesize("urls") < 1) { echo "RandomURL error! The file \"urls\" is empty. You should insert at least two URLs into it."; exit; } if (!is_readable("urls") || !is_writeable("urls")) { echo "RandomURL error! The file permissions for the file \"urls\" has not been set correctly."; exit; } $urls = file("urls"); srand((double)microtime()*1000000); $urlnumber = rand(0, sizeof($urls) - 1); header("Location: $urls[$urlnumber]"); exit; } ############################################# # The
part of the administration pages ############################################# ?>$closebrowser"; } } if ($submitpass) { if ($newpass != $renewpass) { echo "
$closebrowser"; } } } ############################################ # Adding/removing URLs ############################################ if ($page == "admin") { if (!$newurl && !$deletethisurl) { echo "
\n"; echo "