本文整理汇总了PHP中error_out函数的典型用法代码示例。如果您正苦于以下问题:PHP error_out函数的具体用法?PHP error_out怎么用?PHP error_out使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error_out函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
function view()
{
$user_id = $this->params[0];
if (empty($user_id)) {
error_out('Check user ID in address bar');
}
$this->user = get_first("SELECT * FROM user WHERE user_id = '{$user_id}'");
}
示例2: exec_query
function exec_query($sql)
{
static $conn = null;
if ($conn == null) {
$conn = get_db_connection();
}
if (mysql_query($sql, $conn) === FALSE) {
error_out(500, "MySQL Error: " . mysql_error($conn) . "; running query: {$sql}");
}
}
示例3: checkPostRedirect
function checkPostRedirect($client)
{
global $passed;
line_out("Checking to see if there was a POST redirect to a GET");
$method = $client->getRequest()->getMethod();
if ($method == "get") {
$passed++;
} else {
error_out('Expecting POST to Redirect to GET - found ' . $method);
}
}
示例4: main
function main($server_cfg)
{
$game = "";
if (isset($_GET["game"])) {
$game = $_GET["game"];
$candidate_path = sprintf($server_cfg["xhprof_ip_list"], $game);
error_log($candidate_path . "\n");
if (file_exists($candidate_path)) {
header($_SERVER["SERVER_PROTOCOL"] . " 200 Ok");
header("Content-type: text/plain");
echo file_get_contents($candidate_path);
return;
} else {
error_out("{$game} maybe invalid, path {$candidate_path} does not exist.");
}
} else {
error_out("No game name passed");
}
}
示例5: connect_db
function connect_db()
{
global $con;
@($con = new mysqli(DATABASE_HOSTNAME, DATABASE_USERNAME, DATABASE_PASSWORD));
if ($connection_error = mysqli_connect_error()) {
$errors[] = 'There was an error trying to connect to database at ' . DATABASE_HOSTNAME . ':<br><b>' . $connection_error . '</b>';
require 'templates/error_template.php';
die;
}
mysqli_select_db($con, DATABASE_DATABASE) or error_out('<b>Error:</b><i> ' . mysqli_error($con) . '</i><br>
This usually means that MySQL does not have a database called <b>' . DATABASE_DATABASE . '</b>.<br><br>
Create that database and import some structure into it from <b>doc/database.sql</b> file:<br>
<ol>
<li>Open database.sql</li>
<li>Copy all the SQL code</li>
<li>Go to phpMyAdmin</li>
<li>Create a database called <b>' . DATABASE_DATABASE . '</b></li>
<li>Open it and go to <b>SQL</b> tab</li>
<li>Paste the copied SQL code</li>
<li>Hit <b>Go</b></li>
</ol>');
mysqli_query($con, "SET NAMES utf8");
mysqli_query($con, "SET CHARACTER utf8");
}
示例6: error_out
} else {
error_out("Not found");
}
// Good guess
$u = $url . "?guess=42";
line_out("Retrieving " . htmlent_utf8($u));
$crawler = $client->request('GET', $u);
$html = $crawler->html();
$OUTPUT->togglePre("Show retrieved page", $html);
line_out("Looking for 'Congratulations - You are right'");
if (stripos($html, 'congratulations') > 0) {
$passed++;
} else {
error_out("Not found");
}
} catch (Exception $ex) {
error_out("The autograder did not find something it was looking for in your HTML - test ended.");
error_log($ex->getMessage());
error_log($ex->getTraceAsString());
$detail = "This indicates the source code line where the test stopped.\n" . "It may not make any sense without looking at the source code for the test.\n" . 'Caught exception: ' . $ex->getMessage() . "\n" . $ex->getTraceAsString() . "\n";
$OUTPUT->togglePre("Internal error detail.", $detail);
}
$perfect = 10;
$score = webauto_compute_effective_score($perfect, $passed, $penalty);
if (!$titlefound) {
error_out("These pages do not have proper titles so this grade was not sent");
return;
}
if ($score > 0.0) {
webauto_test_passed($score, $url);
}
示例7: error_out
*/
function error_out($reason = '')
{
$error = array('status' => 'failure');
if ($reason !== '') {
$error['reason'] = $reason;
}
print $error;
die;
}
if (!empty($LoggedUser['DisableForums'])) {
error_out('You do not have access to the forums!');
}
$UserID = empty($_GET['userid']) ? $LoggedUser['ID'] : $_GET['userid'];
if (!is_number($UserID)) {
error_out('User does not exist!');
}
if (isset($LoggedUser['PostsPerPage'])) {
$PerPage = $LoggedUser['PostsPerPage'];
} else {
$PerPage = POSTS_PER_PAGE;
}
list($Page, $Limit) = Format::page_limit($PerPage);
$UserInfo = Users::user_info($UserID);
extract(array_intersect_key($UserInfo, array_flip(array('Username', 'Enabled', 'Title', 'Avatar', 'Donor', 'Warned'))));
$ViewingOwn = $UserID === $LoggedUser['ID'];
$ShowUnread = $ViewingOwn && (!isset($_GET['showunread']) || !!$_GET['showunread']);
$ShowGrouped = $ViewingOwn && (!isset($_GET['group']) || !!$_GET['group']);
if ($ShowGrouped) {
$SQL = '
SELECT
示例8: load_config
private function load_config()
{
// Load config file or bail out
if (file_exists('config.php')) {
require 'config.php';
} else {
error_out('No config.php. Please make a copy of config.sample.php and name it config.php and configure it.');
}
}
示例9: error_out
require_once "config.inc.php";
// 2. check _POST
$_inp = $_POST;
if (!isset($_inp['mid'])) {
error_out(print_r($_POST, true) . " requires mid");
}
// 3. 檢查 user 是否能刪除此檔
$map = map_get_single($_inp['mid']);
if ($map == null) {
error_out("no such map" . $_inp['mid']);
}
if ($map['uid'] != $_SESSION['uid']) {
error_out("you are not the owner");
}
// 3.1 正在搬移資料結構, 或重新整理
$block_msg = map_blocked($out_root, $_SESSION['uid']);
if ($block_msg != null) {
error_out($block_msg);
}
// 4. 真的刪除/回收
if ($_inp['op'] && $_inp['op'] == 'recycle') {
$ok = map_expire($_inp['mid']);
} else {
$ok = map_del($_inp['mid']);
}
if ($ok === FALSE) {
error_out("delete/expire fail");
}
sleep(1);
$mid = $_inp['mid'];
ok_out("{$mid} deleted", $mid);
示例10: if
<li <?php
echo $controller == 'users' ? 'class="active"' : '';
?>
><a href="users">Users</a></li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
<div class="container">
<!-- Main component for a primary marketing message or call to action -->
<? if (!file_exists("views/$controller/{$controller}_$action.php")) error_out('The view <i>views/' . $controller . '/' . $controller . '_' . $action . '.php</i> does not exist. Create that file.'); ?>
<? @require "views/$controller/{$controller}_$action.php"; ?>
</div>
<!-- /container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="vendor/components/jquery/jquery.min.js"></script>
<script src="vendor/components/bootstrap/js/bootstrap.min.js"></script>
<script src="https://mottie.github.io/tablesorter/js/jquery.tablesorter.js"></script>
</body>
</html>
示例11: line_out
$passed = 0;
$titlefound = false;
try {
$h1 = $crawler->filter('h1')->text();
line_out("Found h1 tag...");
} catch (Exception $ex) {
error_out("Did not find h1 tag");
$h1 = "";
}
if (stripos($h1, 'Hello') !== false) {
success_out("Found 'Hello' in the h1 tag");
$passed += 1;
} else {
error_out("Did not find 'Hello' in the h1 tag");
}
if ($USER->displayname && stripos($h1, $USER->displayname) !== false) {
success_out("Found ({$USER->displayname}) in the h1 tag");
$passed += 1;
} else {
if ($USER->displayname) {
error_out("Did not find {$USER->displayname} in the h1 tag");
error_out("No score sent");
return;
}
}
$perfect = 2;
$score = webauto_compute_effective_score($perfect, $passed, $penalty);
// Send grade
if ($score > 0.0) {
webauto_test_passed($score, $url);
}
示例12: exec
exec($cmd, $output, $ret);
if ($ret != 0) {
foreach ($output as $line) {
if (strstr($line, "err:")) {
$errline .= substr($line, 4) . "\n";
}
}
error_out($errline);
}
// before register, check count again
if (map_full($_SESSION['uid'], $user['limit'], $recreate_flag)) {
$files = map_files($outimage);
foreach ($files as $f) {
@unlink($f);
}
error_out("已經達到數量限制" . $user['limit']);
}
$type = determine_type($shiftx, $shifty);
$outx = ceil($shiftx / $tiles[$type]['x']);
$outy = ceil($shifty / $tiles[$type]['y']);
if (file_exists(str_replace(".tag.png", ".gpx", $outimage))) {
$save_gpx = 1;
}
$mid = map_add($_SESSION['uid'], $title, $xx, $yy, $shiftx, $shifty, $outx, $outy, $_SERVER['REMOTE_ADDR'], $outimage, map_size($outimage), $version, $save_gpx);
// 最後搬移到正確目錄
map_migrate($out_root, $_SESSION['uid'], $mid);
// 如果有 gpx 就 import 到 gis 的 database 中
//if ($svg_params != "") {
// import_gpx($mid);
//}
$okmsg = msglog("done");
示例13: load_config
private function load_config()
{
// Load config file or bail out
if (file_exists(dirname(__FILE__) . '/../../config.php')) {
include dirname(__FILE__) . '/../../config.php';
} else {
error_out('No config.php. Please make a copy of config.sample.php and name it config.php and configure it.');
}
}
示例14: line_out
$url = false;
line_out("Looking for Logout Anchor Tag.");
$link = $crawler->selectLink('Logout')->link();
$url = $link->getURI();
}
line_out("Retrieving " . htmlent_utf8($url) . "...");
$crawler = $client->request('GET', $url);
$html = $crawler->html();
$OUTPUT->togglePre("Show retrieved page", $html);
$passed++;
line_out("Looking for login link.");
$link = $crawler->selectLink('Log In')->link();
$url = $link->getURI();
$passed++;
} catch (Exception $ex) {
error_out("The autograder did not find something it was looking for in your HTML - test ended.");
error_log($ex->getMessage());
error_log($ex->getTraceAsString());
$detail = "This indicates the source code line where the test stopped.\n" . "It may not make any sense without looking at the source code for the test.\n" . 'Caught exception: ' . $ex->getMessage() . "\n" . $ex->getTraceAsString() . "\n";
$OUTPUT->togglePre("Internal error detail.", $detail);
}
// There is a maximum of 20 passes for this test
$perfect = 20;
$score = webauto_compute_effective_score($perfect, $passed, $penalty);
if (!$titlefound) {
error_out("These pages do not have proper titles so this grade is not official");
return;
}
if ($score > 0.0) {
webauto_test_passed($score, $url);
}
示例15: success_out
$grade = 0.0;
if (strpos($h1, "Dr. Chuck") !== false) {
$failure = "You need to put your own name in the h1 tag - assignment not complete!";
} else {
if (strpos($h1, 'Hello') !== false) {
$success = "Found 'Hello' in the h1 tag - assignment correct!";
$grade = 1.0;
} else {
$failure = "Did not find 'Hello' in the h1 tag - assignment not complete!";
}
}
if (strlen($success) > 0) {
success_out($success);
error_log($success);
} else {
if (strlen($failure) > 0) {
error_out($failure);
error_log($failure);
exit;
} else {
error_log("No status");
exit;
}
}
// Send grade
if ($penalty !== false) {
$grade = $grade * (1.0 - $penalty);
}
if ($grade > 0.0) {
webauto_test_passed($grade, $url);
}