本文整理汇总了PHP中message_error函数的典型用法代码示例。如果您正苦于以下问题:PHP message_error函数的具体用法?PHP message_error怎么用?PHP message_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了message_error函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:dirvuk,项目名称:mellivora,代码行数:7,代码来源:raceconditions.inc.php
示例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;
}
}
开发者ID:dirvuk,项目名称:mellivora,代码行数:8,代码来源:xsrf.inc.php
示例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.");
}
}
开发者ID:ZlhlmChZ,项目名称:source-code-mell,代码行数:10,代码来源:captcha.inc.php
示例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);
}
}
开发者ID:AdaFormacion,项目名称:mellivora,代码行数:10,代码来源:files.inc.php
示例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;
}
开发者ID:ZlhlmChZ,项目名称:source-code-mell,代码行数:12,代码来源:two_factor_auth.inc.php
示例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));
}
}
开发者ID:RowdyChildren,项目名称:49sd-ctf,代码行数:13,代码来源:captcha.inc.php
示例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);
}
开发者ID:ZlhlmChZ,项目名称:source-code-mell,代码行数:43,代码来源:files.inc.php
示例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');
}
}
}
开发者ID:azizjonm,项目名称:ctf-engine,代码行数:24,代码来源:edit_category.php
示例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']));
开发者ID:ZlhlmChZ,项目名称:source-code-mell,代码行数:31,代码来源:country.php
示例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);
?>
开发者ID:michaelxizhou,项目名称:myeden69-original-backup,代码行数:31,代码来源:links.php
示例11: sql_exception
function sql_exception(PDOException $e)
{
log_exception($e);
message_error('An SQL exception occurred. Please check the exceptions log.');
}
开发者ID:jpnelson,项目名称:mellivora,代码行数:5,代码来源:db.inc.php
示例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.');
}
}
}
开发者ID:jpnelson,项目名称:mellivora,代码行数:16,代码来源:new_hint.php
示例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;
}
开发者ID:ZlhlmChZ,项目名称:source-code-mell,代码行数:44,代码来源:session.inc.php
示例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']));
开发者ID:janglapuk,项目名称:mellivora,代码行数:31,代码来源:country.php
示例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.');
}
}
开发者ID:ZlhlmChZ,项目名称:source-code-mell,代码行数:7,代码来源:email.inc.php
示例16: enforce_authentication
<?php
require '../include/mellivora.inc.php';
enforce_authentication();
validate_id($_GET['id']);
$file = db_query_fetch_one('
SELECT
f.id,
f.title,
f.size,
c.available_from
FROM files AS f
LEFT JOIN challenges AS c ON c.id = f.challenge
WHERE f.id = :id', array('id' => $_GET['id']));
if (empty($file)) {
message_error('No file found with this ID');
}
if (time() < $file['available_from'] && !user_is_staff()) {
message_error('This file is not available yet.');
}
download_file($file);
开发者ID:ZlhlmChZ,项目名称:source-code-mell,代码行数:21,代码来源:download.php
示例17: 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('restrict_email', array('added' => time(), 'added_by' => $_SESSION['id'], 'rule' => $_POST['rule'], 'white' => $_POST['whitelist'], 'priority' => $_POST['priority'], 'enabled' => $_POST['enabled']));
if ($id) {
redirect(CONFIG_SITE_ADMIN_RELPATH . 'list_restrict_email.php?generic_success=1');
} else {
message_error('Could not insert new email restriction.');
}
}
}
开发者ID:jpnelson,项目名称:mellivora,代码行数:15,代码来源:new_restrict_email.php
示例18: validate_captcha
}
}
// stage 1, part 2
if ($_POST['action'] == 'reset_password') {
if (CONFIG_RECAPTCHA_ENABLE_PUBLIC) {
validate_captcha();
}
$user = db_select_one('users', array('id', 'team_name', 'email'), array('email' => $_POST[md5(CONFIG_SITE_NAME . 'EMAIL')]));
if ($user['id']) {
$auth_key = hash('sha256', generate_random_string(128));
db_insert('reset_password', array('added' => time(), 'user_id' => $user['id'], 'ip' => get_ip(true), 'auth_key' => $auth_key));
$email_subject = 'Password recovery for team ' . htmlspecialchars($user['team_name']);
// body
$email_body = htmlspecialchars($user['team_name']) . ', please follow the link below to reset your password:' . "\r\n" . "\r\n" . CONFIG_SITE_URL . 'reset_password?action=choose_password&auth_key=' . $auth_key . '&id=' . $user['id'] . "\r\n" . "\r\n" . 'Regards,' . "\r\n" . CONFIG_SITE_NAME;
// send details to user
send_email(array($user['email']), $email_subject, $email_body);
}
message_generic('Success', 'If the email you provided was found in the database, an email has now been sent to it with further instructions!');
} else {
if ($_POST['action'] == 'choose_password' && is_valid_id($auth['user_id'])) {
$new_password = $_POST[md5(CONFIG_SITE_NAME . 'PWD')];
if (empty($new_password)) {
message_error('You can\'t have an empty password');
}
$new_passhash = make_passhash($new_password);
db_update('users', array('passhash' => $new_passhash), array('id' => $auth['user_id']));
db_delete('reset_password', array('user_id' => $auth['user_id']));
message_generic('Success', 'Your password has been reset.');
}
}
}
开发者ID:azizjonm,项目名称:ctf-engine,代码行数:31,代码来源:reset_password.php
示例19: array_get
<?php
require '../../include/ctf.inc.php';
$redirect_url = array_get($_POST, 'redirect');
if (user_is_logged_in()) {
redirect($redirect_url);
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['action'] == 'login') {
$email = $_POST[md5(CONFIG_SITE_NAME . 'USR')];
$password = $_POST[md5(CONFIG_SITE_NAME . 'PWD')];
$remember_me = isset($_POST['remember_me']);
if (login_create($email, $password, $remember_me)) {
enforce_2fa();
redirect($redirect_url);
} else {
message_error('Login failed? Helpful.');
}
}
}
开发者ID:azizjonm,项目名称:ctf-engine,代码行数:20,代码来源:login.php
示例20: delete_challenge_cascading
function delete_challenge_cascading($id)
{
if (!is_valid_id($id)) {
message_error('Invalid ID.');
}
try {
db_begin_transaction();
db_delete('challenges', array('id' => $id));
db_delete('submissions', array('challenge' => $id));
db_delete('hints', array('challenge' => $id));
$files = db_select_all('files', array('id'), array('challenge' => $id));
foreach ($files as $file) {
delete_file($file['id']);
}
db_end_transaction();
} catch (PDOException $e) {
db_rollback_transaction();
log_exception($e);
}
}
开发者ID:RowdyChildren,项目名称:49sd-ctf,代码行数:20,代码来源:general.inc.php
注:本文中的message_error函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论