本文整理汇总了PHP中errorpage函数的典型用法代码示例。如果您正苦于以下问题:PHP errorpage函数的具体用法?PHP errorpage怎么用?PHP errorpage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了errorpage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: localnet_or_die
/**
* 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');
}
}
示例2: header
<?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'];
示例3: errorpage
<?php
/**
* VariableStream class
*
* @package Core
* @author Andreas Goetz <cpuidle@gmx.de>
* @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);
示例4: errorpage
<?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;
}
示例5: errorpage
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 = "=?UTF-8?B?" . 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", "noreply@lavida.us", $title, $message);
示例6: errorpage
<?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:';
示例7: set_userseen
/**
* Sets the status in userseen accordingly to the given seen value
*
* Gets username from cookie
*
* @author Andreas Goetz <cpuidle@gmx.de>
* @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='".$_COOKIE['VDBusername']."'";
$result = runSQL($SELECT);
if (empty($result[0]['id'])) {
$SELECT = "SELECT id FROM users ".
"WHERE user='".$_COOKIE['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);
*/
}
示例8: sql_native
/**
* 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;
}
示例9: errorpage
<?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>
示例10: engineGetData
/**
* Include engine file and retrieve item data
*
* @author Andreas Goetz <cpuidle@gmx.de>
* @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;
}
示例11: get_current_user_id
/**
* Profile page
*
* Handles saving of the various config options for the user.
*
* @package Setup
* @author Andreas Gohr <a.gohr@web.de>
* @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);
/*
示例12: validate_include
/**
* Include path validation to prevent remote code exploits
* @author Andreas Goetz <cpuidle@gmx.de>
* @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.");
}
}
示例13: errorpage
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>';
示例14: array
}
$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:
示例15: nl2br
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