本文整理汇总了PHP中message_error函数的典型用法代码示例。如果您正苦于以下问题:PHP message_error函数的具体用法?PHP message_error怎么用?PHP message_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了message_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate_submission_token
function validate_submission_token($token)
{
if ($token != $_SESSION[CONST_SUBMISSION_TOKEN_KEY]) {
message_error('Submission token has expired, please resubmit form');
}
regenerate_submission_token();
}
示例2: validate_xsrf_token
function validate_xsrf_token($token)
{
if ($_SESSION[CONST_XSRF_TOKEN_KEY] != $token) {
log_exception(new Exception('Invalid XSRF token. Was: "' . $token . '". Wanted: "' . $_SESSION[CONST_XSRF_TOKEN_KEY] . '"'));
message_error('XSRF token mismatch');
exit;
}
}
示例3: validate_captcha
function validate_captcha()
{
$captcha = new Captcha\Captcha();
$captcha->setPublicKey(CONFIG_RECAPTCHA_PUBLIC_KEY);
$captcha->setPrivateKey(CONFIG_RECAPTCHA_PRIVATE_KEY);
$response = $captcha->check();
if (!$response->isValid()) {
message_error("The reCAPTCHA wasn't entered correctly. Go back and try it again.");
}
}
示例4: delete_file
function delete_file($id)
{
if (!is_valid_id($id)) {
message_error('Invalid ID.');
}
db_delete('files', array('id' => $id));
if (file_exists(CONST_PATH_FILE_UPLOAD . $id)) {
unlink(CONST_PATH_FILE_UPLOAD . $id);
}
}
示例5: validate_two_factor_auth_code
function validate_two_factor_auth_code($code)
{
require_once CONFIG_PATH_THIRDPARTY . 'Google2FA/Google2FA.php';
$valid = false;
$secret = db_select_one('two_factor_auth', array('secret'), array('user_id' => $_SESSION['id']));
try {
$valid = Google2FA::verify_key($secret['secret'], $code);
} catch (Exception $e) {
message_error('Could not verify key.');
}
return $valid;
}
示例6: validate_captcha
function validate_captcha()
{
try {
$captcha = new \ReCaptcha\ReCaptcha(CONFIG_RECAPTCHA_PRIVATE_KEY, new \ReCaptcha\RequestMethod\CurlPost());
$response = $captcha->verify($_POST['g-recaptcha-response'], get_ip());
if (!$response->isSuccess()) {
message_error("Captcha error: " . print_r($response->getErrorCodes(), true));
}
} catch (Exception $e) {
log_exception($e);
message_error('Caught exception processing captcha. Please contact ' . (CONFIG_EMAIL_REPLYTO_EMAIL ? CONFIG_EMAIL_REPLYTO_EMAIL : CONFIG_EMAIL_FROM_EMAIL));
}
}
示例7: download_file
function download_file($file)
{
validate_id(array_get($file, 'id'));
// do we read the file off AWS S3?
if (CONFIG_AWS_S3_KEY_ID && CONFIG_AWS_S3_SECRET && CONFIG_AWS_S3_BUCKET) {
try {
// Instantiate the S3 client with your AWS credentials
$client = S3Client::factory(array('key' => CONFIG_AWS_S3_KEY_ID, 'secret' => CONFIG_AWS_S3_SECRET));
$file_key = '/challenges/' . $file['id'];
$client->registerStreamWrapper();
// Send a HEAD request to the object to get headers
$command = $client->getCommand('HeadObject', array('Bucket' => CONFIG_AWS_S3_BUCKET, 'Key' => $file_key));
$filePath = 's3://' . CONFIG_AWS_S3_BUCKET . $file_key;
} catch (Exception $e) {
message_error('Caught exception uploading file to S3: ' . $e->getMessage());
}
} else {
$filePath = CONFIG_PATH_FILE_UPLOAD . $file['id'];
if (!is_readable($filePath)) {
log_exception(new Exception("Could not read the requested file: " . $filePath));
message_error("Could not read the requested file. An error report has been lodged.");
}
}
// required for IE, otherwise Content-disposition is ignored
if (ini_get('zlib.output_compression')) {
ini_set('zlib.output_compression', 'Off');
}
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private', false);
// required for certain browsers
header('Content-Type: application/force-download');
header('Content-Disposition: attachment; filename="' . $file['title'] . '";');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . $file['size']);
// Stop output buffering
if (ob_get_level()) {
ob_end_flush();
}
flush();
readfile($filePath);
}
示例8: enforce_authentication
<?php
require '../../../include/ctf.inc.php';
enforce_authentication(CONST_USER_CLASS_MODERATOR);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
validate_id($_POST['id']);
validate_xsrf_token($_POST[CONST_XSRF_TOKEN_KEY]);
if ($_POST['action'] == 'edit') {
db_update('categories', array('title' => $_POST['title'], 'description' => $_POST['description'], 'exposed' => $_POST['exposed'], 'available_from' => strtotime($_POST['available_from']), 'available_until' => strtotime($_POST['available_until'])), array('id' => $_POST['id']));
redirect(CONFIG_SITE_ADMIN_RELPATH . 'edit_category.php?id=' . $_POST['id'] . '&generic_success=1');
} else {
if ($_POST['action'] == 'delete') {
if (!$_POST['delete_confirmation']) {
message_error('Please confirm delete');
}
db_delete('categories', array('id' => $_POST['id']));
$challenges = db_select_all('challenges', array('id'), array('category' => $_POST['id']));
foreach ($challenges as $challenge) {
delete_challenge_cascading($challenge['id']);
}
redirect(CONFIG_SITE_ADMIN_RELPATH . '?generic_success=1');
}
}
}
示例9: login_session_refresh
<?php
require '../include/mellivora.inc.php';
login_session_refresh();
if (strlen(array_get($_GET, 'code')) != 2) {
message_error('Please supply a valid country code');
}
$country = db_select_one('countries', array('id', 'country_name', 'country_code'), array('country_code' => $_GET['code']));
if (!$country) {
message_error('No country found with that code');
}
head($country['country_name']);
if (cache_start('country_' . $_GET['code'], CONFIG_CACHE_TIME_COUNTRIES)) {
section_head(htmlspecialchars($country['country_name']) . country_flag_link($country['country_name'], $country['country_code'], true), '', false);
$scores = db_query_fetch_all('
SELECT
u.id AS user_id,
u.team_name,
u.competing,
co.id AS country_id,
co.country_name,
co.country_code,
SUM(c.points) AS score,
MAX(s.added) AS tiebreaker
FROM users AS u
LEFT JOIN countries AS co ON co.id = u.country_id
LEFT JOIN submissions AS s ON u.id = s.user_id AND s.correct = 1
LEFT JOIN challenges AS c ON c.id = s.challenge
WHERE u.competing = 1 AND co.id = :country_id
GROUP BY u.id
ORDER BY score DESC, tiebreaker ASC', array('country_id' => $country['id']));
示例10: message_ok
ModelSeoLink::newInstance()->insertRec(null, $new_href_to, $new_href_from, $new_contact);
message_ok(__('Reciprocal Link was successfully created', 'all_in_one'));
} else {
message_error(__('Error when creating reciprocal link', 'all_in_one') . ': ' . __('Your referral URL and URL with your link cannot be empty!', 'all_in_one'));
}
}
}
if (Params::getParam('link_rec_add_update') == 'email') {
foreach (osc_has_links_rec_seo() as $links) {
if (Params::getParam('seo_email_send' . $links['seo_link_id']) == 'on' or Params::getParam('seo_email_send' . $links['seo_link_id']) == 1) {
$detail = ModelSeoLink::newInstance()->getRecLinkById($links['seo_link_id']);
if (filter_var($detail['seo_contact'], FILTER_VALIDATE_EMAIL) and $detail['seo_contact'] != '') {
email_link_problem($detail['seo_href_from'], $detail['seo_href_to'], $detail['seo_contact']);
message_ok(__('Owner of website', 'all_in_one') . ' ' . $detail['seo_href_from'] . ' ' . __('was successfully informed that backlink was not found', 'all_in_one'));
} else {
message_error(__('Error when sending email to reciprocal link', 'all_in_one') . ' #' . $links['seo_link_id'] . ': ' . __('Contact email is not valid or is empty!', 'all_in_one'));
}
}
}
}
}
?>
<div id="settings_form">
<?php
echo config_menu();
?>
<form name="promo_form" id="promo_form" action="<?php
echo osc_admin_base_url(true);
?>
示例11: sql_exception
function sql_exception(PDOException $e)
{
log_exception($e);
message_error('An SQL exception occurred. Please check the exceptions log.');
}
示例12: enforce_authentication
<?php
require '../../../include/mellivora.inc.php';
enforce_authentication(CONFIG_UC_MODERATOR);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
validate_xsrf_token($_POST['xsrf_token']);
if ($_POST['action'] == 'new') {
$id = db_insert('hints', array('added' => time(), 'added_by' => $_SESSION['id'], 'challenge' => $_POST['challenge'], 'visible' => $_POST['visible'], 'body' => $_POST['body']));
if ($id) {
invalidate_cache('hints');
redirect(CONFIG_SITE_ADMIN_RELPATH . 'edit_hint.php?id=' . $id);
} else {
message_error('Could not insert new hint.');
}
}
}
示例13: register_account
function register_account($email, $password, $team_name, $country, $type = null, $phoneNo, $age, $eduI, $eduLevel, $fullName, $instanceID)
{
if (!CONFIG_ACCOUNTS_SIGNUP_ALLOWED) {
message_error('Registration is currently closed.');
}
if (empty($email) || empty($password) || empty($team_name)) {
message_error('Please fill in all the details correctly.');
}
if (isset($type) && !is_valid_id($type)) {
message_error('That does not look like a valid team type.');
}
if (strlen($team_name) > CONFIG_MAX_TEAM_NAME_LENGTH || strlen($team_name) < CONFIG_MIN_TEAM_NAME_LENGTH) {
message_error('Your team name was too long or too short.');
}
validate_email($email);
if (!allowed_email($email)) {
message_error('Email not on whitelist. Please choose a whitelisted email or contact organizers.');
}
$num_countries = db_select_one('countries', array('COUNT(*) AS num'));
if (!isset($country) || !is_valid_id($country) || $country > $num_countries['num']) {
message_error('Please select a valid country.');
}
$user = db_select_one('users', array('id'), array('team_name' => $team_name, 'email' => $email), null, 'OR');
if ($user['id']) {
message_error('An account with this team name or email already exists.');
}
$user_id = db_insert('users', array('email' => $email, 'passhash' => make_passhash($password), 'team_name' => $team_name, 'added' => time(), 'enabled' => CONFIG_ACCOUNTS_DEFAULT_ENABLED ? '1' : '0', 'user_type' => isset($type) ? $type : 0, 'country_id' => $country, 'DOB' => $age, 'mobileNo' => $phoneNo, 'eduInstitution' => $eduI, 'eduLevel' => $eduLevel, 'fullName' => $fullName, 'instanceID' => $instanceID));
// insertion was successful
if ($user_id) {
// log signup IP
log_user_ip($user_id);
// if account isn't enabled by default, display message and die
if (!CONFIG_ACCOUNTS_DEFAULT_ENABLED) {
message_generic('Signup successful', 'Thank you for registering!
Your chosen email is: ' . htmlspecialchars($email) . '.
Make sure to check your spam folder as emails from us may be placed into it.
Please stay tuned for updates!');
} else {
return true;
}
}
// no rows were inserted
return false;
}
示例14: login_session_refresh
<?php
require '../include/mellivora.inc.php';
login_session_refresh();
if (strlen(array_get($_GET, 'code')) != 2) {
message_error(lang_get('please_supply_country_code'));
}
$country = db_select_one('countries', array('id', 'country_name', 'country_code'), array('country_code' => $_GET['code']));
if (!$country) {
message_error(lang_get('please_supply_country_code'));
}
head($country['country_name']);
if (cache_start(CONST_CACHE_NAME_COUNTRY . $_GET['code'], CONFIG_CACHE_TIME_COUNTRIES)) {
section_head(htmlspecialchars($country['country_name']) . country_flag_link($country['country_name'], $country['country_code'], true), '', false);
$scores = db_query_fetch_all('
SELECT
u.id AS user_id,
u.team_name,
u.competing,
co.id AS country_id,
co.country_name,
co.country_code,
SUM(c.points) AS score,
MAX(s.added) AS tiebreaker
FROM users AS u
LEFT JOIN countries AS co ON co.id = u.country_id
LEFT JOIN submissions AS s ON u.id = s.user_id AND s.correct = 1
LEFT JOIN challenges AS c ON c.id = s.challenge
WHERE u.competing = 1 AND co.id = :country_id
GROUP BY u.id
ORDER BY score DESC, tiebreaker ASC', array('country_id' => $country['id']));
示例15: validate_email
function validate_email($email)
{
if (!valid_email($email)) {
log_exception(new Exception('Invalid Email'));
message_error('That doesn\'t look like an email. Please go back and double check the form.');
}
}