本文整理汇总了PHP中error_handler函数的典型用法代码示例。如果您正苦于以下问题:PHP error_handler函数的具体用法?PHP error_handler怎么用?PHP error_handler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error_handler函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login_theme
function login_theme()
{
global $globals, $mysql, $done, $error, $errors;
global $l;
error_handler($error);
if ($done) {
//echo $l['thanks'] . '<a href="index.php?action=login">Login</a> here';
echo $l['redirection'];
} else {
echo '<center>';
echo $l['test_login_msg'];
// for input fields, pattern attribute,
// pattern="^\(?\d{3}\)?[-\s]\d{3}[-\s]\d{4}.*?$" , pattern to check, fone pattern format, such as, (555)-555-5555
echo '
<form action="" method="post">
<table align="center">
<tr>
<td width="70%">' . $l['user_email'] . '</td>
<td><input type="text" name="email" placeholder="For eg. a@a.com" required> </td>
</tr>
<tr>
<td>' . $l['pass'] . '</td>
<td><input type="password" name="password" required></td>
</tr>
</table>
<br />
<center><input type="submit" name="sub_register" value="Login"></center>
</form>
</center>
';
}
}
示例2: compare
public function compare(PageResolver $r1, PageResolver $r2)
{
$contents1 = PageUtils::contents($r1);
$contents2 = PageUtils::contents($r2);
if ($contents2 === null) {
$fetch = app(Fetch::class);
//todo: move this to Fetch constructor & make it configurable
if (method_exists($fetch, 'cached')) {
$fetch = $fetch->cached(false);
}
$contents2 = $fetch->pull($r2->page->absoluteLink());
if (!$fetch->isOk()) {
if ($fetch->code() == 404) {
$r2->page->delete();
return new EqualCompare($contents1, $this->size($contents1));
} else {
throw new CompareFetchError($r2->page, $fetch->code());
}
}
$size = $this->size($contents2);
$contents2 = $this->cleanup($contents2);
if (!PageUtils::putContents($r2, $contents2, $this->fetchedEncoding)) {
error_handler(E_USER_ERROR, "Failed to save \"{$r2}\"", basename(__FILE__), 28);
return false;
}
$contents2 = PageUtils::contents($r2);
} else {
$size = null;
}
return new Compare($contents1, $contents2, $size);
}
示例3: listUsers_theme
function listUsers_theme()
{
global $globals, $mysql, $theme, $done, $errors;
global $user;
global $q, $l;
error_handler($errors);
echo '<center>
<h3>' . $l['list_users'] . '</h3>
<table border="1">
<tr id="disp_table">
<td><b>' . $l['listing'] . '</td>
<td><b>' . $l['uid'] . '</b></td>
<td><b>' . $l['username'] . '</b></td>
<td><b>' . $l['email'] . '</b></td>
<td><b>' . $l['url'] . '</b></td>
<td><b>' . $l['friend_uid'] . '</b></td>
</tr>';
$i = 1;
while ($row = mysql_fetch_assoc($q)) {
echo "\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{$i}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{$row['uid']}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<a href={$globals['boardurl']}{$globals['only_ind']}action=viewProfile&uid={$row['uid']}>{$row['username']}</a>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{$row['email']}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{$row['url']}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{$row['friends_list']}\n\t\t\t</td>\n\t\t</tr>\n\t\t";
$i++;
}
// setting $row as null, clearing/cleaning/emptying php memory
$row = null;
echo '</table>';
/*
echo '</table><br /><br />
<a href="index.php?action=wall&uid='.$user['uid']. '">Wall</a> |
<a href="index.php?action=modifyprofile&uid='.$user['uid']. '">Modify Profile</a> |
<a href="index.php?action=ban&uid='.$user['uid']. '">Ban him!!!</a>
</center>';
*/
}
示例4: register_theme
function register_theme()
{
global $globals, $mysql, $done, $error;
global $l;
error_handler($error);
// if exists, then 'email exists' error, etc. (still to put)
if ($done) {
echo $l['thanks'] . '<a href="index.php?action=login">' . $l['login'] . '</a> here';
} else {
echo '
<form action="" method="post">
<table align="center">
<tr>
<td width="70%">' . $l['usrnm'] . '</td>
<td><input type="text" name="username" required> </td>
</tr>
<tr>
<td>' . $l['pass'] . '</td>
<td><input type="text" name="password" required></td>
</tr>
<tr>
<td>' . $l['email'] . '</td>
<td><input type="text" name="email" required> </td>
</tr>
<tr>
<td>' . $l['web_url'] . '</td>
<td><input type="text" name="url"> </td>
</tr>
</table>
<center><input type="submit" name="sub_register" value="Register"></center>
</form>
';
}
}
示例5: shutdown
function shutdown()
{
$error = error_get_last();
if ($error['type'] === E_ERROR) {
error_handler('', '', '', '');
}
}
示例6: cobalt_password_hash_bcrypt
function cobalt_password_hash_bcrypt($password, $salt, $iteration)
{
//Deal with blowfish bug in PHP < 5.3.7
if (PHP_VERSION_ID < 50307) {
error_handler("Cobalt encountered an error during password processing.", "Cobalt Password Hash Error: Attempted to use bcrypt on onlder than PHP 5.3.7. This is a known security risk, and has been stopped. Please change preferred hashing method to an alternative. (SHA512 recommended)");
} else {
$blowfish_salt_start = '$2y$';
}
//make sure cost factor is two digit only and within the range 04-31, else crypt() will fail
if ($iteration > 31) {
$iteration = 31;
}
if ($iteration < 10) {
$iteration = '0' . $iteration;
}
if ($iteration < 4) {
$iteration = '04';
}
$blowfish_cost = $iteration;
$blowfish_key = '$' . $salt . '$';
$blowfish_key = str_replace('+', '.', $blowfish_key);
//blowfish salt doesn't support + char
$blowfish_salt = $blowfish_salt_start . $blowfish_cost . $blowfish_key;
$digest = crypt($password . $salt, $blowfish_salt);
return $digest;
}
示例7: sendMessage_theme
function sendMessage_theme()
{
global $globals, $mysql, $theme, $done, $error, $errors;
global $user;
global $par;
global $db;
global $l;
error_handler($error);
echo '
<form method="post" action="" name="form1">
<table align="center" width="90%" border="0">
<tr>
<td width="30%">' . $l['to'] . '</td>
<td><input type="text" name="to"> </td>
</tr>' . '<tr>
<td>' . $l['subj'] . '</td>
<td><input type="text" name="subject"> </td>
</tr>
<tr>
<td>' . $l['body'] . '</td>
<td><textarea rows="15" cols="60" name="body"></textarea> </td>
</tr>
</table>
<br />
<br />
<center>
<input type="submit" id="sendMess" name="sendMess" value="Send Message">
</center>
</form>
';
}
示例8: fatalErrorShutdownHandler
function fatalErrorShutdownHandler()
{
$last_error = error_get_last();
if ($last_error['type'] === E_ERROR || $last_error['type'] === E_PARSE) {
error_handler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']);
}
}
示例9: index
public function index($image_name)
{
$file_path = APP_ROOT . "/img/" . "{$image_name}";
$file_info = pathinfo($file_path);
switch ($file_info["extension"]) {
case 'bmp':
header('Content-Type: image/bmp');
break;
case 'gif':
header('Content-Type: image/gif');
break;
case 'jpg':
header('Content-Type: image/jpeg');
break;
case 'jpeg':
header('Content-Type: image/jpeg');
break;
case 'png':
header('Content-Type: image/png');
break;
default:
error_handler("Create_thumb: Unsupported picture type: " . $src . "--" . $type);
return;
}
$fp = fopen($file_path, 'r');
fpassthru($fp);
}
示例10: shutdown_error_handler
function shutdown_error_handler()
{
$error = error_get_last();
if (empty($error) === false) {
error_handler($error['type'], $error['message'], $error['file'], $error['line']);
}
}
示例11: login
function login()
{
global $error;
if (isset($_GET['error'])) {
error_handler($_GET['error']);
}
if (!isset($_POST['username']) or !isset($_POST['password'])) {
return false;
}
$username = $_POST['username'];
$password = $_POST['password'];
if (empty($username) and empty($password)) {
$error = 'You did not fill out all forms. Do so please.';
return false;
}
if (!filter_var($username, FILTER_VALIDATE_EMAIL)) {
$error = 'This is not an email, please fill in an email-address.';
return false;
}
$user = query('SELECT id FROM users WHERE email = "' . $username . '" AND password = "' . $password . '" ');
if ($_POST["vercode"] != $_SESSION["vercode"] or $_SESSION["vercode"] == '') {
echo '<strong>Wrong verification code.</strong>';
} else {
if (count($user) < 1) {
$error = 'Wrong email, password or verification code.';
return false;
}
}
$_SESSION['id'] = $user[0]['id'];
header('Location: ../views/resultpage.php');
exit;
}
示例12: ErrorHandler
function ErrorHandler($errno, $errstr, $errfile, $errline)
{
if ($errno == E_USER_NOTICE) {
$this->errors[] = $errstr;
} else {
error_handler($errno, $errstr, $errfile, $errline);
}
}
示例13: ban_theme
function ban_theme()
{
global $globals, $mysql, $theme, $done, $error, $errors, $l;
// Get all data of the user, whether to allow
// him to view or enter the board.
// user level, user permissions
global $user, $notice;
global $board, $replies;
global $qu;
// boards will be listed here, get data from DB
// Board table, having, board_id, board_name, board_desc,
// user_id who started board(admin or moderator),
// number of replies in Reply table
// who replied etc, replies to a board_id in reply table
// name of board, which username started board,
// how many posts in board
error_handler($error);
if (!empty($notice)) {
notice_handler($notice);
return;
}
if ($qu) {
echo '
<center>
<table border="1" >
<tr id="disp_table">
<td>
' . $l['ban_uid'] . '
</td>
<td>
' . $l['ban_uname'] . '
</td>
</tr>
';
for (; $i = mysql_fetch_assoc($qu);) {
echo '
<tr>
<td>
' . $i['ban_uid'] . '
</td>
<td>
' . $i['username'] . '
</td>
</tr>';
}
echo '
</table>
</center>
';
} else {
noData();
}
}
示例14: fatal_error_handler
/**
* Функция перехвата фатальных ошибок
*/
function fatal_error_handler()
{
// если была ошибка и она фатальна
if ($error = error_get_last() and $error['type'] & (E_ERROR | E_PARSE | E_COMPILE_ERROR | E_CORE_ERROR)) {
// очищаем буффер (не выводим стандартное сообщение об ошибке)
ob_end_clean();
// запускаем обработчик ошибок
error_handler($error['type'], $error['message'], $error['file'], $error['line']);
} else {
// отправка (вывод) буфера и его отключение
ob_end_flush();
}
}
示例15: check_for_fatal_error
function check_for_fatal_error()
{
$error = error_get_last();
$isError = false;
switch ($error['type']) {
case E_ERROR:
case E_CORE_ERROR:
case E_PARSE:
case E_COMPILE_ERROR:
case E_USER_ERROR:
error_handler($error["type"], $error["message"], $error["file"], $error["line"]);
}
}