function checkDieError() { global $myError; if ($myError) { dieError(); } }
function passwordFormSubmitted() { if ($_POST['pass1'] != $_POST['pass2']) { dieError("ERROR: Passwords do not match"); // has javascript checking, we should never hit this error. } if (!isValidUserPassword(getUsername(), $_POST['pass0'])) { echo "<h2>Incorrect Old password entered. Please try again.</h2>\n"; echo file_get_contents("html/password.html"); die(' '); } // now we insert it into the database if (setUserPassword($_POST['pass1'])) { echo "<h1>Password Changed</h1>\n"; echo "<form><input type=\"button\" name=\"continue\" value=\"Continue\" onClick=\"parent.main_popupWindowCancel()\"></form>\n"; } else { dieError("Password Change Failed. Please contact the administrator"); } }
function loginUser() { $username = $_POST['username']; // checks it against the database $query = "SELECT * FROM users WHERE username = '******'"; $check = mysql_query($query) or die(mysql_error()); if ($info = mysql_fetch_array($check)) { $sessionId = rand_string(32); // update lastLogon & session id $now = date('c'); $update = "UPDATE users SET lastLogon='{$now}', session_id='{$sessionId}' WHERE username='******'"; $result = mysql_query($update) or die(mysql_error()); $hashUsername = $info['sha256_user']; // if login is ok then we add a cookie setCookies($hashUsername, $sessionId); $sessionId = rand_string(32); logLogin($hashUsername); //then redirect them to the members area header('Location: main.php'); } else { dieError("ERROR: Cannot find user record in database. Please contact the administrator"); } }
function getSyscallNames() { if (!file_exists(SYSCALLS_H)) { dieError(SYSCALLS_H . ": No such file."); } $strfile = file_get_contents(SYSCALLS_H); $aFile = split("\n", $strfile); $aSyscallNames = array(); foreach ($aFile as $line) { if (ereg("#define[[:space:]]*SYS_", $line)) { $newline = ereg_replace("^#define[[:space:]]*SYS_([[:alnum:]_\\-]*)[[:space:]]*([0-9]*)\$", "\\1:\\2", $line); if (empty($newline)) { dieError("Regexp error while retrieving syscall name: line = [{$line}]"); } $aLine = split(":", $newline); if (count($aLine) != 2) { dieError("Error while spliting [{$newline}]"); } $aSyscallNames[$aLine[1]] = $aLine[0]; } } return $aSyscallNames; }
function connectDatabase() { require 'include/config_database.php'; if (ini_set('sql.safe_mode', TRUE)) { dieError("mySQL Safe Mode Enabled. Please notify administrator."); } $connect = mysql_connect($database_IP, $database_Username, $database_Password, FALSE, MYSQL_CLIENT_SSL) or dieError("mySQL Connect error. Please notify administrator."); $db = mysql_select_db($database_Name, $connect) or dieError("mySQL Select DB error. Please notify administrator."); return $db; }
* module after the update has been completed successfully. Also removes * the mm_forum backup copy. * * @author Martin Helmich <m.helmich@mittwald.de * @version 2008-04-20 * @return void */ function dieSuccess() { system('rm -rf ./mm_forum-backup/'); header('Location: mm_forum/mod1/index.php?update_result=success'); die; } // Make a backup copy of the extension directory if (system('cp -r ./mm_forum ./mm_forum-backup') === false) { dieError(false); } // Remove the mm_forum directory if (system('rm -rf ./mm_forum/') === false) { dieError(true); } // Unzip the tarball archive if (system('tar -xzf mm_forum_update.tar.gz') === false) { dieError(true); } // Set access rights system('chmod -R 755 ./mm_forum'); // Remove the tarball archive system('rm mm_forum_update.tar.gz'); // Return user to updater form dieSuccess();