function email_post($to, $subject = false, $from = false) { global $_POST; if (!$subject) { $subject = "Form Submission from " . $_josh["domainname"]; } email($to, draw_page($subject, draw_array($_POST), false, true), $subject, $from); }
function error_handle($type, $message, $run_trace = true) { global $_josh; if ($run_trace) { $backtrace = debug_backtrace(); $level = count($backtrace) - 1; $message .= " on line " . $backtrace[$level]["line"] . " of file " . $backtrace[$level]["file"]; } if (function_exists("error_email")) { $email = $message; $email .= "<br><br>Of page: <a href='" . $_josh["request"]["uri"] . "'>" . $_josh["request"]["uri"] . "</a>"; $email .= "<br><br>Encountered by user: <!--user-->"; error_email(draw_page($type, $email, true, true)); } if (isset($_josh["mode"]) && $_josh["mode"] == "dev") { draw_page($type, $message, true); } }
function __on_err($errtype, $errmsg, $errfile, $errline) { global $DEBUG, $title, $body; switch ($errtype) { case E_USER_ERROR: case E_USER_WARNING: $title = 'RPG Web Profiler Error'; if ($DEBUG) { $errmsg .= "\n\nThis error occurred at line {$errline} of file {$errfile}."; } $body = nl2br(htmlspecialchars($errmsg)); draw_page('error.php'); exit; break; case E_USER_NOTICE: default: // Smarty can generate alot of NOTICE errors, so we ignore them. } }
<?php // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include_once "config.php"; include_once "{$INCLUDE_PATH}/system.php"; include_once "{$INCLUDE_PATH}/engine/sid.class.php"; include_once "{$INCLUDE_PATH}/engine/templates.php"; include_once "{$INCLUDE_PATH}/userstats.php"; global $URI_BASE, $URI_HOME, $LOGO; $title = 'Index - News'; // Attempt to respawn a session. $sid = new SId(); if ($sid->IsSessionValid()) { draw_page('login_forward.php'); } else { draw_page('index.php'); }
<?php include_once "config.php"; include_once "{$INCLUDE_PATH}/system.php"; include_once "{$INCLUDE_PATH}/error.php"; include_once "{$INCLUDE_PATH}/engine/sid.php"; include_once "{$INCLUDE_PATH}/engine/validation.php"; include_once "{$INCLUDE_PATH}/engine/campaign.class.php"; include_once "{$INCLUDE_PATH}/engine/character.class.php"; include_once "{$INCLUDE_PATH}/engine/templates.php"; include_once "{$INCLUDE_PATH}/engine/serialization.php"; // Try to respawn a session to keep the menu nav in context. $sid = new SId(); if ($REQUIRE_LOGIN && !$sid->IsSessionValid()) { draw_page('login_required.php'); exit; } // Validate permission for the requested character. $id = (int) $_POST['id']; if (!$id) { $id = (int) $_GET['id']; } $campaign = new Campaign($id); if ($sid->GetUserName() != $campaign->owner) { draw_page('view_campaign_error.php'); exit; } $title = $campaign->cname; draw_page('campaign_summary.php');
echo include_stylesheet_dir("stylesheets", $debug); check_validated(); //Any pre-page logic should go here! if (isset($_POST['addpoints-submit'])) { add_points(strtolower($_POST['note']), $_POST['value'], $_GET['user_id']); } if (isset($_POST['removepoints-submit'])) { remove_points($_POST['point_id']); } if (count($_SESSION['notifications']) != 0) { draw_notification(); } if (isset($_GET['user_id'])) { $userinfo = get_user_info($_GET['user_id']); } draw_page($userinfo); close_page(); ob_end_flush(); // Flush the buffer out to client document_footer(); mysql_end(); function draw_page($userinfo) { ?> <div class="container"> <?php //Fetch the points total for this user $points = get_points_total($userinfo['user_id']); echo '<h3>'; echo $userinfo['fname'] . ' ' . $userinfo['lname']; echo ' <small>' . $points . ' points</small>';
function print_upload_success($sid) { global $title; $title = 'Data Upload'; draw_page('upload_success.php'); exit; }
draw_page('del_confirm.php'); } else { // Confirmation received, delete the user's permission for the character. $_r = $rpgDB->query(sprintf("DELETE FROM %s WHERE cid = %d AND pname = '%s' LIMIT 1", $TABLE_OWNERS, (int) $id, addslashes($sid->GetUserName()))); if (!$_r) { __printFatalErr("Failed to update database.", __LINE__, __FILE__); } // If the user is the owner of the character remove the character data. $removed = false; $_r = $rpgDB->query(sprintf("select owner from %s where id = %d", $TABLE_CHARS, (int) $id)); if (!$_r) { __printFatalErr("Failed to query database.", __LINE__, __FILE__); } $row = $rpgDB->fetch_row($_r); if ($row['owner'] == $sid->GetUserName()) { // Remove the character. $_r = $rpgDB->query(sprintf("DELETE FROM %s WHERE id = %d LIMIT 1", $TABLE_CHARS, (int) $id)); if (!$_r) { __printFatalErr("Failed to query database.", __LINE__, __FILE__); } // Delete all editors $_r = $rpgDB->query(sprintf("DELETE FROM %s WHERE cid = %d", $TABLE_OWNERS, (int) $id)); if (!$_r) { __printFatalErr("Failed to query database.", __LINE__, __FILE__); } $removed = true; } // Draw the result screen. $title = 'Remove Character'; draw_page('del.php'); }
if ($pending_campaign != null) { $campaign = new Campaign((int) $pending_campaign['campaign_id']); } } // Draw the page. $title = 'Character Permissions'; $cname = $character->cname; $is_public = $character->public == 'y'; $is_inactive = $character->inactive == 'y'; $is_owner = $character->owner == $sid->GetUserName(); $profiles = $character->GetProfiles(); $templates = generate_template_array(); $current_template = get_sheet_name($character->template_id); $exp_formats = get_export_scripts(); $imp_formats = get_import_scripts(); draw_page('char.php'); //////////////////////////////////////////////////////////////////////// // Helper functions. // Remove a character from the current campaign they are in. function apply_leave_campaign(&$character) { return $character->SetCampaign(null); } // Apply to Join the specified campaign function apply_join_campaign(&$character, $campaign_id) { $campaign = new Campaign($campaign_id); if (!$campaign->open) { return "Campaign " . $campaign->cname . " not open for registration!"; } if ($character->JoinCampaign($campaign_id, "RJ")) {
function format_image_resize($source, $max_width = false, $max_height = false) { if (!function_exists('imagecreatefromjpeg')) { error_handle('library missing', 'the GD library needs to be installed to run format_image_resize', __FILE__, __LINE__); } if (empty($source)) { return null; } if (!function_exists('resize')) { function resize($new_width, $new_height, $source_name, $target_name, $width, $height) { //resize an image and save to the $target_name $tmp = imagecreatetruecolor($new_width, $new_height); if (!($image = imagecreatefromjpeg(DIRECTORY_ROOT . $source_name))) { error_handle('could not create image', 'the system could not create an image from ' . $source_name, __FILE__, __LINE__); } imagecopyresampled($tmp, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); imagejpeg($tmp, DIRECTORY_ROOT . $target_name, 100); imagedestroy($tmp); imagedestroy($image); } function crop($new_width, $new_height, $target_name) { //crop an image and save to the $target_name list($width, $height) = getimagesize(DIRECTORY_ROOT . $target_name); //by default, crop from center $offsetx = ($width - $new_width) / 2; $offsety = ($height - $new_height) / 2; if ($offsetx < 0) { $offsetx = 0; } if ($offsety < 0) { $offsety = 0; } //this crops from top-left //$offsetx = $offsety = 0; $tmp = imagecreatetruecolor($new_width, $new_height); if (!($image = @imagecreatefromjpeg(DIRECTORY_ROOT . $target_name))) { error_handle('could not create image', 'the system could not create an image from ' . $source_name, __FILE__, __LINE__); } imagecopyresized($tmp, $image, 0, 0, $offsetx, $offsety, $new_width, $new_height, $new_width, $new_height); imagejpeg($tmp, DIRECTORY_ROOT . $target_name, 100); imagedestroy($tmp); imagedestroy($image); } } //save to file, is file-based operation, unfortunately $source_name = DIRECTORY_WRITE . '/temp-source.jpg'; $target_name = DIRECTORY_WRITE . '/temp-target.jpg'; file_put($source_name, $source); //get source image dimensions list($width, $height) = getimagesize(DIRECTORY_ROOT . $source_name); if (!$width || !$height) { // image is probably corrupt echo draw_page('image corrupt', 'the uploaded image cannot be read, try opening the image in photo editing software, re-saving it, and then try again'); exit; } //execute differently depending on target parameters if ($max_width && $max_height) { //resizing both if ($width == $max_width && $height == $max_height) { //already exact width and height, skip resizing copy(DIRECTORY_ROOT . $source_name, DIRECTORY_ROOT . $target_name); } else { //this was for the scenario where your target was a long landscape and you got a squarish image. //this doesn't work if your target is squarish and you get a long landscape //maybe we need a ratio function? //square to long scenario: input 400 x 300 (actual 1.3 ratio), target 400 x 100 (target 4) need to resize width then crop target > actual //long to square scenario: input 400 x 100 (actual 4 ratio), target 400 x 300 (target 1.3) need to resize height then crop target < actual $target_ratio = $max_width / $max_height; $actual_ratio = $width / $height; //if ($max_width >= $max_height) { if ($target_ratio >= $actual_ratio) { //landscape or square. resize width, then crop height $new_height = $height / $width * $max_width; resize($max_width, $new_height, $source_name, $target_name, $width, $height); } else { //portrait. resize height, then crop width $new_width = $width / $height * $max_height; resize($new_width, $max_height, $source_name, $target_name, $width, $height); } crop($max_width, $max_height, $target_name); } } elseif ($max_width) { //only resizing width if ($width == $max_width) { //already exact width, skip resizing copy(DIRECTORY_ROOT . $source_name, DIRECTORY_ROOT . $target_name); } else { //resize width $new_height = $height / $width * $max_width; resize($max_width, $new_height, $source_name, $target_name, $width, $height); } } elseif ($max_height) { //only resizing height if ($height == $max_height) { //already exact height, skip resizing copy(DIRECTORY_ROOT . $source_name, DIRECTORY_ROOT . $target_name); } else { //resize height $new_width = $width / $height * $max_height; resize($new_width, $max_height, $source_name, $target_name, $width, $height); } } $return = file_get($target_name); //clean up file_delete($source_name); file_delete($target_name); return $return; }
$website = $_POST['website']; $err = array(); if (!is_valid_cname($name, $err)) { $title = 'Error'; $success = false; draw_page('new_campaign.php'); exit; } // Add the campaign to the database $_r = $rpgDB->query(sprintf("INSERT INTO %s SET name = '%s', owner = '%s', website = '%s'", $TABLE_CAMPAIGNS, addslashes($name), addslashes($sid->GetUserName()), addslashes($website))); if (!$_r) { __printFatalErr("Failed to update database.", __LINE__, __FILE__); } if ($rpgDB->num_rows() != 1) { __printFatalErr("Failed to update campaign list.", __LINE__, __FILE__); } // Get the character's id (the character should be the most recent character // edited by this profile, and just to be sure, we restrict the select by // cname as well). $_r = $rpgDB->query(sprintf("select last_insert_id() as id from %s where owner='%s'", $TABLE_CAMPAIGNS, addslashes($sid->GetUserName()))); if (!$_r) { __printFatalErr("Failed to query database for new campaign id.", __LINE__, __FILE__); } $r = $rpgDB->fetch_row($_r); $campaignID = $r['id']; // Everything should be fine, generate the success message. $title = 'New Campaign'; $id = $campaignID; $success = true; draw_page('new_campaign.php');
draw_page('new_badname.php'); exit; } // Verify we got a proper template for the character. $template = (int) $_POST['chartemplate']; if (!is_valid_template_id($template)) { __printFatalErr("Invalid template id."); } // Add the character to the master list. $sql = sprintf("INSERT INTO %s SET cname = '%s', editedby = '%s', template_id = %d, owner = '%s'", $TABLE_CHARS, addslashes($name), addslashes($sid->GetUserName()), (int) $template, addslashes($sid->GetUserName())); $_r = $rpgDB->query($sql); if (!$_r) { __printFatalErr("Failed to update database: {$sql}", __LINE__, __FILE__); } if ($rpgDB->num_rows() != 1) { __printFatalErr("Failed to update character list.", __LINE__, __FILE__); } // Get the character's id (the character should be the most recent character // edited by this profile, and just to be sure, we restrict the select by // cname as well). $_r = $rpgDB->query(sprintf("SELECT id FROM %s WHERE editedby = '%s' AND cname = '%s' ORDER BY lastedited DESC LIMIT 1", $TABLE_CHARS, addslashes($sid->GetUserName()), addslashes($name))); if (!$_r) { __printFatalErr("Failed to query database for new character id.", __LINE__, __FILE__); } $r = $rpgDB->fetch_row($_r); $charID = $r['id']; // Everything should be fine, generate the success message. $title = 'New Character'; $id = $charID; draw_page('new_success.php');
</tr> </table> </body> </html> </form> <?php echo " "; } session_start(); if (isset($_POST["hit"])) { $d = count($_SESSION); draw_page($_SESSION["ar"]); $hh = $_SESSION["ar"][array_rand($_SESSION["ar"])]->GenerateDamage(); if ($hh == "End") { kill_all($_SESSION["ar"]); } else { die; } } $BeesArray = array(); $BeesArray[] = new QueenBee(); for ($i = 0; $i < 5; $i++) { $BeesArray[] = new WorkerBee(); } for ($i = 0; $i < 8; $i++) { $BeesArray[] = new DroneBee(); }
<?php // faq.php include_once "config.php"; include_once "{$INCLUDE_PATH}/engine/sid.class.php"; include_once "{$INCLUDE_PATH}/engine/templates.php"; // Try to respawn a session, only for the sake of the main nav bar // showing the proper buttons. $sid = new SId(); $title = 'Frequently Asked Questions'; draw_page('faq.php');
$pg_out = ""; $pg_out .= "<div align='center'> Page:"; $pg_out .= pagelist($pagenum, $pagelimit, $ttl_imgs); $pg_out .= "</div>\n"; $pg_out .= "<div align='center'><table border='1' cellspacing='10' cellpadding='10' bordercolor='#666666' bordercolordark='#FFFFFF'>\n"; $ln = 1; for ($l = $pg_st; $l < $pg_ed; $l++) { if ($ln == '1') { $pg_out .= "<tr><td align='center'><img src='" . $url . $mylist[$l] . "' width='125' height='193' border='0'><br>"; $pg_out .= "<div id='foot'>" . $url . $mylist[$l] . "</div></td>\n"; $ln = 0; } else { if ($ln == '2') { $pg_out .= "<td align='center'><img src='" . $url . $mylist[$l] . "' width='125' height='193' border='0'><br>"; $pg_out .= "<div id='foot'>" . $url . $mylist[$l] . "</div></td>\n"; $ln = 0; } else { $pg_out .= "<td align='center'><img src='" . $url . $mylist[$l] . "' width='125' height='193' border='0'><br>"; $pg_out .= "<div id='foot'>" . $url . $mylist[$l] . "</div></td></tr>\n"; $ln = 1; } } } $pg_out .= "</table></div>\n"; $pg_out .= "<div align='center'> Page:"; $pg_out .= pagelist($pagenum, $pagelimit, $ttl_imgs); $pg_out .= "</div>\n"; $title = 'Character Images'; $output = $pg_out; draw_page('charimg.php');
if (isset($_POST['editqual-submit']) && isset($_GET['qual_id'])) { $qualinfo = array(); $qualinfo = $_POST; $qualinfo['qual_id'] = $_GET['qual_id']; edit_qual($qualinfo); } if (isset($_POST['togglequal-submit'])) { toggle_qual($_GET['qual_id']); } if (count($_SESSION['notifications']) != 0) { draw_notification(); } if (isset($_GET['qual_id'])) { $qualinfo = get_qual_info($_GET['qual_id']); } draw_page($qualinfo); close_page(); ob_end_flush(); // Flush the buffer out to client document_footer(); mysql_end(); function draw_page($qualinfo) { if ($qualinfo['inactive'] == 1) { draw_undelqual($qualinfo); } else { draw_delqual($qualinfo); } //Are you page, squire or specialist $qualinfo['levelname'] = qual_level_to_levelname($qualinfo['level']); ?>
$err = array(); if ($pwd1 != $pwd2) { array_push($err, "Your passswords do not match."); } is_valid_password($pwd1, $err); is_valid_password($pwd2, $err); // Verify against the db. $_r = $rpgDB->query(sprintf("SELECT pname FROM %s WHERE pname = '%s' AND pwd_key = '%s'", $TABLE_USERS, addslashes($pname), addslashes($key))); if (!$_r) { __printFatalErr("Failed to query database.", __LINE__, __FILE__); } if ($rpgDB->num_rows($_r) != 1) { array_push($err, "The supplied key for the specified profile is not valid."); } if (sizeof($err)) { // Something's wrong with the passwords, print an error message. $title = 'Error'; $messages = $err; draw_page('changepwd_error.php'); } else { // Change the passwords. $_r = $rpgDB->query(sprintf("UPDATE %s SET pwd = PASSWORD('%s'), pwd_key = NULL WHERE pname = '%s' LIMIT 1", $TABLE_USERS, addslashes($pwd1), addslashes($pname))); if (!$_r) { __printFatalErr("Failed to query database.", __LINE__, __FILE__); } if ($rpgDB->num_rows() != 1) { __printFatalErr("Failed to update database.", __LINE__, __FILE__); } $title = 'New Password'; draw_page('changepwd.php'); }
</tr> </table> <input type="submit" title="לחץ להרשמה" value="הירשם"></form> <?php } Validate_Request(); if (isset($persistent)) { if (empty($errors)) { /*INSERT NEW USER INTO USERS TABLE*/ $sql = "INSERT INTO users(UserName,FirstName,LastName,ID,City,Street,HouseNumber,CellPhone,Phone,Email,Password,Approved,YearOfBirth,MonthOfBirth,DayOfBirth,FatherName,FatherPhone,MotherName,MotherPhone)"; $sql .= " values('" . $persistent["user_name"] . "','" . $persistent["first_name"] . "','" . $persistent["last_name"] . "','" . $persistent["ID"] . "','" . $persistent["city"] . "','" . $persistent["street"] . "','" . $persistent["house_number"] . "','" . $persistent["cell_phone"] . "','" . $persistent["phone"] . "','" . $persistent["email"] . "','" . md5($persistent["pass1"]) . "'," . "'0'" . ",'" . $persistent["year_of_birth"] . "','" . $persistent["month_of_birth"] . "','" . $persistent["day_of_birth"] . "','" . $persistent["father_name"] . "','" . $persistent["father_phone"] . "','" . $persistent["mother_name"] . "','" . $persistent["mother_phone"] . "')"; //printSqlQuary($sql); $result = executeQuary($sql); /*INSERT NEW USER INTO USERS-GROUPS TABLE*/ $sql = "INSERT INTO users_activitygroups(UserName,SiD)"; $sql .= " values('" . $persistent["user_name"] . "','" . $persistent["memberOfGroup"] . "')"; $result = executeQuary($sql); echo "<center><b><hr>*** רישום הסתיים בהצלחה ***<hr> <a href=" . $index_page . ">חזרה לעמוד הבית</a></b></center>"; } else { draw_page($persistent); echo_errors(); } } else { draw_page($persistent); } ?> </body>
if (!is_valid_email($email, $err_dummy)) { __printFatalErr("An invalid or non-existent email address was found in your profile."); } // Generate a key and put it in the db. $keygen = new Id(); $id = $keygen->GenerateId(); $_r = $rpgDB->query(sprintf("UPDATE %s SET pwd_key = '%s' WHERE pname = '%s' LIMIT 1", $TABLE_USERS, addslashes($id), addslashes($pname)), $rpgDB); if (!$_r) { __printFatalErr("Failed to update database.", __LINE__, __FILE__); } if ($rpgDB->num_rows() != 1) { __printFatalErr("Failed to update profile.", __LINE__, __FILE__); } // Send off the message. $to = $email; $from = "From: {$EMAIL_WEBMASTER}"; $subject = "RPG Web Profiler password reset."; $body = "{$pname},\n\nYour RPG Web Profiler password at {$URI_HOME} was recently requested to be reset. To complete the process, visit the link below and follow the directions that 3EProfiler asks.\n\n{$URI_BASE}/resetpwd.php?p={$pname}&k={$id}\n\nIf you never requested your password to be reset, please disregard this message. No information was given to the person requesting your password."; if (!mail($to, $subject, $body, $from)) { __printFatalErr("Failed to send email to address listed in profile."); } // Send a success message. $title = 'Reset Password'; draw_page('resetpwd_checkmail.php'); } else { // No proper query received: show a form allowing the user to give // their profile name. $title = 'Reset Password'; draw_page('resetpwd.php'); } }
if (!$char->IsValid()) { draw_page($error_page); exit; } if ($sid->IsSessionValid()) { // User is logged in, check to see if they have permission to access // character. if ($sid->HasAccessTo($char->id)) { draw_sheet_editable($char); } } // We aren't in editable mode, check for public access. if ($char->public == 'y') { draw_sheet_public($char); } else { draw_page($error_page); exit; } //////////////////////////////////////////////////////////////////////// // Helper functions. // Note the drawing functions work by extracting a reference to the // data hash for the character. I'm unsure, but suspect that this will // save some time since we'll be working directly with the data hash, // and can avoid several hundred function calls which would be needed // if using the object (serval calls to Character::Get). Also note that // further performance may be gained by bypassing the functions defined // in the sheet_globals.php file, and manually extracting data from the // $DATA array. This can lead to rather messy templates though, so it // wasn't done for the official 3EProfiler release. function draw_sheet_editable(&$char) {
// save.php // Saves character data after checking if user has permission to. include_once "config.php"; include_once "{$INCLUDE_PATH}/system.php"; include_once "{$INCLUDE_PATH}/engine/sid.php"; include_once "{$INCLUDE_PATH}/error.php"; include_once "{$INCLUDE_PATH}/engine/templates.php"; include_once "{$INCLUDE_PATH}/engine/character.class.php"; // Respawn the session. $sid = RespawnSession(__LINE__, __FILE__); // Validate and clear the id from the data. // Don't bother creating a Character object since we don't actually need // to obtain any information about the character (saves a db query). $id = (int) $_POST['id']; unset($_POST['id']); // Verify permission. if (!$sid->HasAccessTo($id)) { __printFatalErr("Access denied."); } // Package the data. $char = new Character($id); if (!$char->IsValid()) { __printFatalErr("Failed to retrieve existing data."); } $char->SetData($_POST); if (!$char->Save($sid)) { __printFatalErr("Failed to update database.", __LINE__, __FILE__); } $title = 'Character Updated'; draw_page('save.php');
<?php // legal.php include_once "config.php"; include_once "{$INCLUDE_PATH}/system.php"; include_once "{$INCLUDE_PATH}/engine/sid.class.php"; include_once "{$INCLUDE_PATH}/engine/templates.php"; // Try to respawn a session, only for the sake of the main nav bar // showing the proper buttons. $sid = new SId(); $title = 'Legal Information'; draw_page('legal.php');
<?php if (!path()) { draw_page('Поваренная книга программиста', dview('index_content', main_categories())); } elseif (is_category_path(path()) && is_category_exists(path())) { is_need_cache(true); $category = new Category(path()); keywords($category->keywords()); draw_page($category->getTitle(), dview('one_category', $category)); } elseif (is_example_path(path()) && is_example_exists(path())) { is_need_cache(true); $example = new Example(path()); keywords($example->keywords()); draw_page($example->prop('desc'), view('path_block', ['id' => $example->id()]) . view('one_example', ['data' => $example, 'show_link' => true])); } else { show_404(); }
<?php // logout.php // Clears the session cookie and session data in the database. include_once "config.php"; include_once "{$INCLUDE_PATH}/engine/sid.class.php"; include_once "{$INCLUDE_PATH}/engine/templates.php"; // Clear the session cookie. $sid = new SId(); $sid->ClearSession(); $sid = null; $title = 'Logged Out'; // Show the logged out page. draw_page('logout.php');
$messages = $err; draw_page($error_page); exit; } // Check to see if the profile name already exists. $_r = $rpgDB->query(sprintf("SELECT COUNT(pname) as cnt FROM %s WHERE pname = '%s'", $TABLE_USERS, addslashes($user))); if (!$_r) { __printFatalErr("Failed to query database.", __LINE__, __FILE__); } $r = $rpgDB->fetch_row($_r); if ($r['cnt'] != 0) { array_push($err, "The selected username ({$user}) has already been registered by another user."); $messages = $err; draw_page($error_page); } // Attempt to add the new user. $_r = $rpgDB->query(sprintf("INSERT INTO %s SET pname = '%s', pwd = PASSWORD('%s'), email = '%s'", $TABLE_USERS, addslashes($user), addslashes($pwd1), addslashes($email))); if (!$_r) { __printFatalErr("Failed to update database.", __LINE__, __FILE__); } // Show the user a success message. $title = 'Registration Complete'; $pname = $user; draw_page('register_success.php'); } else { // No data was sent: // Display the registration page. $title = 'Registration'; $pname = $user; draw_page('register.php'); }
<?php include_once "config.php"; include_once "{$INCLUDE_PATH}/engine/sid.php"; include_once "{$INCLUDE_PATH}/engine/db.php"; include_once "{$INCLUDE_PATH}/error.php"; include_once "{$INCLUDE_PATH}/engine/templates.php"; // The session object that will be used through the script. $sid = null; $sid = RespawnSession(__LINE__, __FILE__); if (!$sid || !$sid->IsSessionValid()) { draw_page('login_required.php'); exit; } $title = 'Campaign Options'; $campaigns = $sid->GetCampaigns(); $icampaigns = $sid->GetInactiveCampaigns(); draw_page('campaigns.php');
mysql_init(); handle_ajax(); document_header(); echo include_javascript_dir("js", $debug); echo include_stylesheet_dir("stylesheets", $debug); check_validated(); //If a new user was submitted! if (isset($_POST['newuser-submit'])) { $userinfo = array("username" => $_POST['username'], "fname" => $_POST['fname'], "lname" => $_POST['lname'], "emplid" => $_POST['emplid'], "password" => $_POST['password'], "email" => $_POST['email'], "phone" => $_POST['phone'], "address" => $_POST['address'], "pwconfirm" => $_POST['pwconfirm']); adduser($userinfo); } if (!check_app_admin()) { header('Location: index.php'); } open_page("Not User Management"); draw_page(); close_page(); ob_end_flush(); // Flush the buffer out to client document_footer(); mysql_end(); //The actual page. function draw_page() { ?> <div class="container"> <?php open_panel("userlist", "User List", false); ?>
} } } // Limit $sql .= "LIMIT " . $recordsPerPage . " "; // Offset if ($page) { $start = 1 + ((int) $page - 1) * $recordsPerPage; $sql .= "OFFSET " . $start . " "; } else { $page = 1; } $res = $rpgDB->query($sql); if (!$res) { __printFatalErr("Failed to query database: {$sql}", __LINE__, __FILE__); } $characters = array(); while ($row = $rpgDB->fetch_row($res)) { array_push($characters, array("id" => $row['id'], "name" => $row['cname'], "lastedited" => $row['lastedited'], "owner" => $row['owner'], "template" => $row['tname'], "campaign" => $row['caname'])); } if (count($characters) == $recordsPerPage) { $nextpage = $page + 1; } if ($page > 1) { $prevpage = $page - 1; } draw_page('search_results.php'); } else { // No query string, show the search page. draw_page('search.php'); }
<?php def_alias('bu::layout', 'l'); def_accessor('title'); def_accessor('keywords'); def_accessor('description'); def('show_404', function () { write_log("404", RAW_HTTP_STRING); header("Status: 404 Not Found"); draw_page('Страница не найдена', view('404')); }); def('draw_page', function ($title, $content) { title($title); echo dview('layout/default', $content); });
} if (sizeof($err)) { $title = 'Error'; $messages = $err; draw_page('details_error.php'); } else { if (!$FORUM) { if ($_POST['pwd1'] && $_POST['pwd2']) { update_password(addslashes($_POST['pwd1']), $sid); } update_email(addslashes($_POST['email']), $sid); update_slength(addslashes($_POST['slength']), $sid); } update_dm($_POST['dm'], $sid); $title = 'Profile Updated'; draw_page('details.php'); } //////////////////////////////////////////////////////////////////////// // Supporting functions. // Updates the db with the user's new password. function update_password($pwd, &$sid) { global $TABLE_USERS, $rpgDB; $_r = $rpgDB->query(sprintf("UPDATE %s SET pwd = PASSWORD('%s') WHERE pname = '%s' LIMIT 1", $TABLE_USERS, addslashes($pwd), addslashes($sid->GetUserName()))); if (!$_r) { __printFatalErr("Failed to update database.", __LINE__, __FILE__); } } // Updates the db with the user's new email address. function update_email($email, &$sid) {