/** * checks if the page is accessed from within the local net. * If not, displays a simple error page and exits */ function localnet_or_die() { if (!localnet()) { errorpage('Forbidden', 'You are not allowed to access this page'); } }
<?php require 'lib/function.php'; if (!$id) { return header("Location: private.php"); } $windowtitle = "{$boardname} -- Private Messages"; $meta['noindex'] = true; $msg = $sql->fetchq("SELECT * FROM pmsgs,pmsgs_text WHERE id={$id} AND id=pid"); if (!$log) { require_once 'lib/layout.php'; errorpage("Couldn't get the private message. You are not logged in.", 'log in (then try again)', 'login.php'); } elseif (!$msg || $msg['userto'] != $loguserid && $msg['userfrom'] != $loguserid && !$isadmin) { require_once 'lib/layout.php'; errorpage("Couldn't get the private message. It either doesn't exist or was not sent to you.", 'your private message inbox', 'private.php'); } if ($isadmin && $msg['userto'] != $loguserid) { $pmlinktext = "<a href='private.php?id={$msg['userto']}'>" . $sql->resultq("SELECT name FROM users WHERE id={$msg['userto']}") . '\'s private messages</a>'; } else { $pmlinktext = "<a href=private.php>Private messages</a>"; } $user = $sql->fetchq("SELECT * FROM users WHERE id={$msg['userfrom']}"); $windowtitle = "{$boardname} -- Private Messages: {$msg['title']}"; require_once 'lib/layout.php'; $top = "<table width=100%><td align=left>{$fonttag}<a href=index.php>{$boardname}</a> - <a href=private.php>{$pmlinktext}</a> - {$msg['title']}</table>"; if ($msg['userto'] == $loguserid) { $sql->query("UPDATE pmsgs SET msgread=1 WHERE id={$id}"); } loadtlayout(); $post = $user; $post['uid'] = $user['id'];
<?php /** * VariableStream class * * @package Core * @author Andreas Goetz <*****@*****.**> * @version $Id: VariableStream.class.php,v 1.4 2004/10/30 11:48:36 andig2 Exp $ */ // stream wrappers require php > 4.3 if (version_compare(phpversion(), '4.3') < 0) { errorpage('PHP version mismatch', 'At least PHP version 4.3.0 is required to run the VariableStream, please check the documentation!'); } /** * VariableStream allows XML reading from variables * @package Core */ class VariableStream { var $position; var $varname; function stream_open($path, $mode, $options, &$opened_path) { $url = parse_url($path); $this->varname = $url['host']; $this->position = 0; return true; } function stream_read($count) { $ret = substr($GLOBALS[$this->varname], $this->position, $count);
<?php require 'lib/function.php'; $user = $sql->resultq("SELECT name FROM users WHERE id={$id}"); $windowtitle = "Listing posts by {$user}"; require 'lib/layout.php'; if (!$id) { errorpage('No user specified.', 'return to the board', 'index.php'); } if ($_GET['forum']) { $fid = intval($_GET['forum']); $forum = $sql->fetchq("SELECT title, minpower FROM forums WHERE id={$fid}"); if ($forum['minpower'] > 0 && $power < $forum['minpower']) { errorpage('You don\'t have access to view posts in this forum.', 'return to the board', 'index.php'); } $where = "in {$forum['title']}"; $forumquery = " AND t.forum = {$fid}"; } else { $forumquery = ''; $where = "on the board"; } if ($_GET['time']) { $time = intval($_GET['time']); $when = " over the past " . timeunits2($time); $timequery = ' AND p.date > ' . (ctime() - $time); } else { $timequery = $when = ''; } if (!$page) { $page = 0; }
errorpage(); } $user = $_SESSION['user_id']; $sql = "select `email`,`activated` from `users` where `user_id`='{$user}'"; $tmp = @mysql_query($sql); $res = @mysql_fetch_object($tmp); $_SESSION['email'] = $res->email; function mail_utf8($to, $from_user, $from_email, $subject = '(No subject)', $message = '') { $from_user = "******" . base64_encode($from_user) . "?="; $subject = "=?UTF-8?B?" . base64_encode($subject) . "?="; $headers = "From: {$from_user} <{$from_email}>\r\n" . "MIME-Version: 1.0" . "\r\n" . "Content-type: text/html; charset=UTF-8" . "\r\n"; return mail($to, $subject, $message, $headers); } if ($res->activated != 0) { errorpage(); } $ok = false; if (isset($_POST['send'])) { $email = $_POST['lavida_email']; if (filter_var($email, FILTER_VALIDATE_EMAIL) == "") { echo "<div class=\"alert alert-error\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">x</button><strong>Error!</strong> \"{$email}\" is not validate email.</div>"; } else { $sql = "select count(*) from `users` where `email`='{$email}' and `user_id`<>'{$user}'"; $tmp = @mysql_query($sql); $res = @mysql_fetch_row($tmp); if ($res[0] == 0) { $code = sha1(time() . " - Espresso Coffee - " . $user); $title = "Lavida Online Judge Account Activation Mail"; $message = "{$user} 님!! 안녕하세요.<br/>" . "본 메일은 Lavida Online Judge 시스템 계정 활성화를 위한 메일입니다.<br/>" . "하단의 링크를 방문하셔서 계정을 활성화 해주시길 바랍니다.<br/>" . "<a href='http://judge.lavida.us/activate/{$code}'>[인증하기]</a><br/>"; $ok = mail_utf8($email, "administrator", "*****@*****.**", $title, $message);
<?php require 'lib/function.php'; $windowtitle = "{$boardname} -- Private Messages"; require 'lib/layout.php'; if (!$log) { errorpage("You need to be logged in to read your private messages.", 'log in (then try again)', 'login.php'); } // Viewing someone else? $u = $loguserid; if ($isadmin && $id) { $u = $id; $idparam = "id={$id}&"; } // Viewing sent messages? $to = 'to'; $from = 'from'; if ($view == 'sent') { $to = 'from'; $from = 'to'; $viewparam = 'view=sent&'; } if (!$ppp) { $ppp = 50; } if (!$page) { $page = 1; } $pmin = ($page - 1) * $ppp; $msgtotal = $sql->resultq("SELECT count(*) FROM pmsgs WHERE user{$to}={$u}"); $pagelinks = 'Pages:';
/** * Sets the status in userseen accordingly to the given seen value * * Gets username from cookie * * @author Andreas Goetz <*****@*****.**> * @param integer $id video id * @param boolean $seen seen */ function set_userseen($id, $seen) { $user_id = get_current_user_id(); if (empty($user_id)) { errorpage('Security Error', "User id cookie was unexpectedly not set. Please report this problem to the developers."); } $SQL = $seen ? "REPLACE INTO " . TBL_USERSEEN . " SET user_id=" . $user_id . ", video_id='" . $id . "'" : "DELETE FROM " . TBL_USERSEEN . " WHERE user_id=" . $user_id . " AND video_id='" . $id . "'"; runSQL($SQL); /* // future code when userseen contains more user-specific data // record already exists? $SELECT = "SELECT seen, user_id FROM video_user, users ". "WHERE video_user.video_id=".$id." AND video_user.user_id = user.id AND users.user='******'VDBusername']."'"; $result = runSQL($SELECT); if (empty($result[0]['id'])) { $SELECT = "SELECT id FROM users ". "WHERE user='******'VDBusername']."'"; $result = runSQL($SELECT); $SQL = "INSERT INTO video_user SET user_id='".$result[0]['id']."', id='".$id."', seen='".$seen."'"; } else { $SQL = "UPDATE video_user SET seen='".$seen."' ". "WHERE user_id='".$result[0]['id']."', id='".$id."', "; } runSQL($SQL); */ }
/** * SQL function */ function sql_native($sql_string) { global $config, $db_native; if (!is_resource($db_native)) { $db_native = mysql_pconnect($config['db_server'], $config['db_user'], $config['db_password']) or errorpage('DB Connection Error', "<p>Edit the database settings in <code>" . CONFIG_FILE . "</code>.</p>\n <p>Alternatively, consider running the <a href='install.php'>installation script</a>.</p>"); mysql_select_db($config['db_database'], $db_native) || errorpage('DB Connection Error', "Couldn't select database: " . $config['db_database'] . "<p>Please verify your database is up and running any validate your database settings in <code>" . CONFIG_FILE . "</code>.</p>\n <p>Alternatively, consider running the <a href='install.php'>installation script</a>.</p>"); } $res = mysql_query($sql_string, $db_native); // mysql_db_query returns either positive result ressource or true/false for an insert/update statement if ($res === false) { // report DB Problem errorpage('Database Problem', mysql_error($db_native) . "\n<br />\n" . $sql_string); } elseif ($res === true) { // on insert, return id of created record $result = mysql_insert_id($db_native); } else { // return associative result array $result = array(); for ($i = 0; $i < mysql_num_rows($res); $i++) { $result[] = mysql_fetch_assoc($res); } mysql_free_result($res); } return $result; }
<?php if (defined('__FROM_INDEX__') == false) { exit; } if (!isset($_SESSION['user_id'])) { errorpage("Login Plz~!!"); } define('__FROM_MENU__', '1'); $menu = array("account" => "phps/setting_account.php", "theme" => "phps/setting_theme.php", "collections" => "phps/setting_collections.php"); ?> <div class="row-fluid"> <div class="span3"> <div class="well" style="max-width: 340px; padding: 8px 0;"> <ul class="nav nav-list"> <li class="nav-header">Settings</li> <li class="divider"></li> <li><a href="/settings/account">Account</a></li> <li><a href="/settings/theme">Theme</a></li> <li><a href="/settings/collections">Collections</a></li> </ul> </div> </div> <div class="span9" id="spage"> <?php if (isset($_GET['page'])) { include $menu[$_GET['page']]; } ?> </div> </div>
/** * Include engine file and retrieve item data * * @author Andreas Goetz <*****@*****.**> * @param string item id * @param string engine name * @return array item data */ function engineGetData($id, $engine = 'imdb') { global $lang, $cache; require_once $engine . '.php'; $func = $engine . 'Data'; $result = array(); if (function_exists($func)) { $cache = true; $result = $func($id); } // make sure all engines properly return the encoding type if (empty($result['encoding'])) { errorpage('Engine Error', 'Engine ' . $engine . ' does not properly return encoding'); } // set default encoding iso-8859-1 $source_encoding = $result['encoding'] ? $result['encoding'] : $lang['encoding']; $target_encoding = 'utf-8'; unset($result['encoding']); // convert to unicode if ($source_encoding != $target_encoding) { $result = iconv_array($source_encoding, $target_encoding, $result); } engine_clean_input($result); return $result; }
/** * Profile page * * Handles saving of the various config options for the user. * * @package Setup * @author Andreas Gohr <*****@*****.**> * @version $Id: profile.php,v 2.19 2008/04/20 17:31:20 andig2 Exp $ */ require_once './core/session.php'; require_once './core/functions.php'; require_once './core/setup.core.php'; $user_id = get_current_user_id(); // really shouldn't happen if (empty($user_id)) { errorpage('Access denied', 'You don\'t have enough permissions to access this ' . 'page. Please <a href="login.php">login</a> first. ' . '(This feature is not available in Single User Mode)'); } // save data if ($save) { // convert languages array back into string $languageflags = @join('::', $languages); // insert data foreach ($SETUP_USER as $opt) { $SQL = "REPLACE INTO " . TBL_USERCONFIG . " (user_id, opt, value) \n VALUES ('" . addslashes($user_id) . "', '{$opt}', '" . addslashes(${$opt}) . "')"; runSQL($SQL); } // update session variables update_session(); // reload config load_config(true); /*
/** * Include path validation to prevent remote code exploits * @author Andreas Goetz <*****@*****.**> * @param string $path Path to validate */ function validate_include($path) { if (preg_match('#//|:#', $path)) { errorpage('Security Error', "videoDB has detected an insecure include path ({$path}). This may be an attempt at injecting foreign code. The application has been terminated."); } }
errorpage("Thread successfully trashed.", 'return to the thread', "thread.php?id={$id}"); } elseif ($_POST['action'] == 'editthread') { $posticons[$iconid] = str_replace("\n", '', $posticons[$iconid]); $icon = $posticons[$iconid]; if ($custposticon) { $icon = $custposticon; } $sql->query("UPDATE `threads` SET `forum` = '{$forummove}', `closed` = '{$closed}', `title` = '{$subject}', `icon` = '{$icon}', `sticky` = '{$sticky}' WHERE `id` = '{$id}'"); if ($forummove != $forumid) { $numposts = $thread['replies'] + 1; $t1 = $sql->fetchq("SELECT lastpostdate,lastposter FROM threads WHERE forum={$forumid} ORDER BY lastpostdate DESC LIMIT 1"); $t2 = $sql->fetchq("SELECT lastpostdate,lastposter FROM threads WHERE forum={$forummove} ORDER BY lastpostdate DESC LIMIT 1"); $sql->query("UPDATE forums SET numposts=numposts-{$numposts},numthreads=numthreads-1,lastpostdate={$t1['lastpostdate']},lastpostuser={$t1['lastposter']} WHERE id={$forumid}"); $sql->query("UPDATE forums SET numposts=numposts+{$numposts},numthreads=numthreads+1,lastpostdate={$t2['lastpostdate']},lastpostuser={$t2['lastposter']} WHERE id={$forummove}"); } errorpage("Thank you, {$loguser['name']}, for editing the thread.", 'return to the thread', "thread.php?id={$id}"); } elseif ($_GET['action'] == 'trashthread') { print "{$header}<br>{$tblstart}\r\n\t\t\t<form action='editthread.php' name='trashcompactor' method='post'>\r\n\t\t\t\t<tr>{$tccell1}><input type='hidden' value='trashthread' name='action'>\r\n\t\t\t\tAre you sure you want to trash this thread?<br>\r\n\t\t\t\t<input type='hidden' value='{$id}' name='id'>\r\n\t\t\t\t<input type='submit' value='Trash Thread'> -- <a href='/thread.php?id={$id}'>Cancel</a></td></tr>\r\n\t\t\t</form>{$tblend}{$footer}"; } else { $thread['icon'] = str_replace("\n", "", $thread['icon']); $customicon = $thread['icon']; for ($i = 0; $posticons[$i];) { $posticons[$i] = str_replace($br, "", $posticons[$i]); if ($thread['icon'] == $posticons[$i]) { $checked = 'checked=1'; $customicon = ''; } $posticonlist .= "<INPUT type=radio class=radio name=iconid value={$i} {$checked}> <IMG SRC={$posticons[$i]} HEIGHT=15 WIDTH=15> "; $i++; if ($i % 10 == 0) { $posticonlist .= '<br>';
} $col_id = $_GET['col_id']; $sql = "select `problem_id`,`result` from solution where user_id='{$_SESSION['user_id']}'"; $tmp = @mysql_query($sql); $solved_problem = array(); $submit_problem = array(); while ($res = @mysql_fetch_object($tmp)) { $submit_problem[$res->problem_id] = true; if ($res->result == 4) { $solved_problem[$res->problem_id] = true; } } $sql = "select * from `collections` where `col_id`='{$col_id}'"; $tmp = @mysql_query($sql); if (@mysql_num_rows($tmp) != 1) { errorpage("??"); } $res = @mysql_fetch_object($tmp); ?> <script> function popCol(collection_id,problem_id) { $.get("/col_control.php",{ mode:"pop", c:collection_id, pid:problem_id },function(data){ var ret=parseInt(data); switch(ret) { case -1:
if ($response['success'] != true) { $page = 'Error: ' . $response['error']; if ($response['header']) { $page .= '<br/>Header:<br/>' . nl2br($response['header']); } } else { if (!$cache) { putHTTPcache($url . $post, $response); } $page = $response['data']; } return $page; } // make sure this is a local access if (!preg_match('/^https?:\\/\\/' . $_SERVER['SERVER_NAME'] . '/i', $_SERVER['HTTP_REFERER'])) { errorpage('Access denied', 'Access to trace.php is allowed for local scripts only. Please make sure to send a referer to allow verification!'); } /** * iframe modes * 0: "classic" mode - no use of iframes * 1: "iframe" mode * used to display template containing iframe * 2: "iframe" mode * used to display iframe contents */ if ($iframe == 1) { // mode 1: display template with url $url = request(true); } else { // mode 0 or 2: fetch data for display // fetch URL
// (fat catgirl here) require 'lib/function.php'; // Stop this insanity. Never index editpost... $meta['noindex'] = true; if (!$log) { require_once 'lib/layout.php'; errorpage("You are not logged in.", 'log in (then try again)', 'login.php'); } if ($loguser['editing_locked'] == 1) { require_once 'lib/layout.php'; errorpage("You are not allowed to edit your posts.", 'return to the board', 'index.php'); } $post = $sql->fetchq("SELECT * FROM posts,posts_text WHERE id='{$id} 'AND id=pid"); if (!$post) { require_once 'lib/layout.php'; errorpage("Post ID #{$id} doesn't exist.", 'return to the board', 'index.php'); } $threadid = $post['thread']; $thread = $sql->fetchq("SELECT forum,closed,title FROM threads WHERE id={$threadid}"); $options = explode("|", $post['options']); $thread['title'] = str_replace('<', '<', $thread['title']); $thread['title'] = str_replace('>', '>', $thread['title']); $smilies = readsmilies(); $forum = $sql->fetchq("SELECT * FROM forums WHERE id={$thread['forum']}"); $specialscheme = $forum['specialscheme']; $windowtitle = "{$boardname} -- {$forum['title']}: {$thread['title']} -- Editing Post"; require_once 'lib/layout.php'; print $header; if (@mysql_num_rows($sql->query("SELECT user FROM forummods WHERE forum={$forum['id']} and user={$loguserid}"))) { $ismod = 1; }
<?php require 'lib/function.php'; require 'lib/layout.php'; if (!$log) { errorpage('You must be logged in to edit your profile.'); } if ($_GET['lol'] || $loguserid == 1420) { errorpage('<div style="position: fixed; top: 0; left: 0; width: 100%; height: 100%;"><object width="100%" height="100%"><param name="movie" value="http://www.youtube.com/v/lSNeL0QYfqo&hl=en_US&fs=1&color1=0x2b405b&color2=0x6b8ab6&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/lSNeL0QYfqo&hl=en_US&fs=1&color1=0x2b405b&color2=0x6b8ab6&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="100%" height="100%"></embed></object></div>'); } if ($banned) { errorpage('Sorry, but banned users aren\'t allowed to edit their profile.'); } if ($loguser['profile_locked'] == 1) { errorpage("You are not allowed to edit your profile."); } if ($loguser['posts'] >= 500 or $loguser[posts] >= 250 && ctime() - $loguser[regdate] >= 100 * 86400) { $postreq = 1; } if ($loguser['titleoption'] == 0 || $banned) { $titleopt = 0; } if ($loguser['titleoption'] == 1 && ($postreq or $power > 0 or $loguser[title])) { $titleopt = 1; } if ($loguser['titleoption'] == 2) { $titleopt = 1; } if (!$action) { $birthday = getdate($loguser['birthday']); if ($loguser['birthday']) {
} else { $profiles = $_POST["profiles"]; } $status = adduser($_POST["user"], $_POST["password"], $_POST["displayname"], $_POST["email"], $_POST["ipmask"], $_POST["maxconn"], $_POST["ecmrate"], $_POST["customvalues"], $_POST["usrgroup"], $_POST["admin"], $_POST["enabled"], $_POST["mapexclude"], $_POST["debug"], $_POST["startdate"], $_POST["expiredate"], $profiles, $_POST["boxtype"], $_POST["macaddress"], $_POST["serialnumber"], $_POST["comment"]); if ($status == "0") { $notice = "toastr.success('User successfully created');"; } elseif ($status == "1") { $notice = "toastr.error('You must enter a username and a password');"; } elseif ($status == "2") { $notice = "toastr.error('Username already exists');"; } } $counters = explode(";", counter()); $mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname); if (mysqli_connect_errno()) { errorpage("MYSQL DATABASE ERROR", mysqli_connect_error(), $charset, CMUM_TITLE, $_SERVER["REQUEST_URI"], CMUM_VERSION, CMUM_BUILD, CMUM_MOD); exit; } if ($_SESSION[$secretkey . "userlvl"] == "0" || $_SESSION[$secretkey . "userlvl"] == "1") { $grpsql = $mysqli->query("SELECT id,name FROM groups ORDER BY name ASC"); } elseif ($_SESSION[$secretkey . "userlvl"] == "2" && $_SESSION[$secretkey . "usergrp"] != "0") { $grpsql = $mysqli->query("SELECT id,name FROM groups WHERE id='" . $mysqli->real_escape_string($_SESSION[$secretkey . "usergrp"]) . "' ORDER BY name ASC"); } else { $grpsql = ""; } $profsql = $mysqli->query("SELECT id,name FROM profiles ORDER BY name ASC"); $defprofsql = $mysqli->query("SELECT id,name FROM profiles ORDER BY name ASC"); $setsql = $mysqli->query("SELECT rndstring,rndstringlength,def_autoload,def_ipmask,def_profiles,def_maxconn,def_admin,def_enabled,def_mapexc,def_debug,def_custcspval,def_ecmrate FROM settings WHERE id='1'"); $setres = $setsql->fetch_array(); mysqli_close($mysqli); ?>
function notAuthorizedError() { global $log; $redir = $log ? 'index.php' : 'login.php'; $rtext = $log ? 'the index page' : 'log in (then try again)'; errorpage("Couldn't enter the forum. You don't have access to this restricted forum.", $rtext, $redir); }
function notAuthorizedError() { global $log; $rreason = $log ? 'don\'t have access to it' : 'are not logged in'; $redir = $log ? 'index.php' : 'login.php'; $rtext = $log ? 'the index page' : 'log in (then try again)'; errorpage("Couldn't enter this restricted forum, as you {$rreason}.", $rtext, $redir); }
* * @package videoDB * @author Andreas Gohr <*****@*****.**> * @version $Id: borrowask.php,v 2.13 2008/06/15 13:58:13 andig2 Exp $ */ require_once './core/functions.php'; // Auth-Checks $user_id = get_current_user_id(); $user = get_username($user_id); if (empty($user)) { errorpage('Access denied', 'You don\'t have enough permissions to access this page try to <a href="login.php">login</a> first. (This feature is not available in Single User Mode)'); } if (empty($id) || empty($diskid)) { errorpage('Error', 'No Ids given'); } $owner = get_owner($diskid, true); $result = runSQL('SELECT email FROM ' . TBL_USERS . " WHERE name = '" . addslashes($owner) . "'"); $owner_email = $result[0]['email']; $result = runSQL('SELECT email FROM ' . TBL_USERS . " WHERE id = '" . addslashes($user_id) . "'"); $user_email = $result[0]['email']; $result = runSQL('SELECT title FROM ' . TBL_DATA . " WHERE id = '" . addslashes($id) . "'"); $title = $result[0]['title']; $mail = $lang['msg_borrowaskmail']; $subject = $lang['msg_borrowasksubject']; $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']) . '/show.php?id=' . $id; // replace place holders $mail = str_replace('%id%', $id, $mail); $mail = str_replace('%diskid%', $diskid, $mail); $mail = str_replace('%owner%', $owner, $mail);
function runquery($queries){//执行sql语句 global $tablepre,$whereis; $sqlquery = splitsql(str_replace(array(' cdb_', ' {tablepre}', ' `cdb_'), array(' '.$tablepre, ' '.$tablepre, ' `'.$tablepre), $queries)); $affected_rows = 0; foreach($sqlquery as $sql) { $sql = syntablestruct(trim($sql), $my_version > '4.1', $dbcharset); if(trim($sql) != '') { mysql_query(stripslashes($sql)); if($sqlerror = mysql_error()) { break; } else { $affected_rows += intval(mysql_affected_rows()); } } } if(strpos($queries,'seccodestatus') && $whereis == 'is_dz') { dz_updatecache(); } if(strpos($queries,'bbclosed') && $whereis == 'is_dz') { dz_updatecache(); } if(strpos($queries,'template') && $whereis == 'is_uch') { uch_updatecache(); } if(strpos($queries,'seccode_login') && $whereis == 'is_uch') { uch_updatecache(); } if(strpos($queries,'close') && $whereis == 'is_uch') { uch_updatecache(); } errorpage($sqlerror? $sqlerror : "数据库升级成功,影响行数: $affected_rows",'数据库升级'); if(strpos($queries,'settings') && $whereis == 'is_dz') { require_once './include/cache.func.php'; updatecache('settings'); } }
<?php if (defined('__FROM_INDEX__') == false) { exit; } if (!isset($_SESSION['user_id'])) { errorpage('Login Plz~!!'); } $sql = "select max(problem_id) from `problem`"; $result = @mysql_query($sql) or die(mysql_error()); $row = @mysql_fetch_array($result); $maxpid = $row[0]; $solved = array(); for ($i = 1001; $i <= $maxpid; $i++) { $solved[$i] = false; } $sql = "select `problem_id` from `solution` where `user_id`='{$_SESSION['user_id']}' and `result`='4' group by `problem_id`"; $result = @mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { $solved[$row[0]] = true; } $sql = "select `problem_id` from `problem` where `defunct` = 'Y'"; $result = @mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { $solved[$row[0]] = true; } $notSolvedProblems = array(); for ($i = 1001; $i <= $maxpid; $i++) { if ($solved[$i] == false) { array_push($notSolvedProblems, $i); }