本文整理汇总了PHP中check_email_address函数的典型用法代码示例。如果您正苦于以下问题:PHP check_email_address函数的具体用法?PHP check_email_address怎么用?PHP check_email_address使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_email_address函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updUser
public function updUser()
{
$id = $this->core->request->parameters["id"];
$login = $this->core->request->parameters["login"];
$name = $this->core->request->parameters["name"];
$pass = $this->core->request->parameters["pass"];
$conf_pass = $this->core->request->parameters["conf_pass"];
$mail = $this->core->request->parameters["mail"];
if (!empty($id)) {
$id++;
$id--;
if (!empty($name) && !empty($pass) && !empty($conf_pass) && check_email_address($mail) && $pass == $conf_pass) {
$pass = md5($pass);
$this->core->database->exec("\n\t \tupdate users set\n\t \t\tlogin='{$login}'\n\t \t\t,password='{$pass}'\n\t \t\t,fullName='{$name}'\n\t \t\t,email='{$mail}'\n\t \t\t,code=null\n\t where id={$id}\n\t \t");
$this->core->database->exec("delete from acl where userId={$id}");
foreach ($this->core->request->parameters as $k => $v) {
if (substr($k, 0, 5) == 'role_' && $v == 'ON') {
$role = substr($k, 5, strlen($k) - 5);
$this->core->database->exec("insert into acl(userId,roleId) select {$id},{$role}");
}
}
header("Location: /admin/users/listUsers");
} else {
$data = $this->core->database->fetchAll("\n\t\t \t\tselect\n\t\t \t\t users.id\n\t\t \t\t\t,users.login\n\t\t \t\t\t,users.fullName\n\t\t \t\t\t,users.email\n\t\t \t\t\t,acl.roleId\n\t\t \t\tfrom users\n\t\t \t\tleft join acl on acl.userId=users.id\n\t\t \t\twhere id={$id}\n\t\t \t\t");
$roles = $this->core->database->fetchAll("select * from roles order by id");
$tpl = new DFTemplater();
$tpl->assign("data", $data);
$tpl->assign("roles", $roles);
$tpl->setPrefix("users");
return $tpl->fetch("userupd");
}
} else {
header("Location: /admin/users/listUsers");
}
}
示例2: check_all
function check_all($mail, $cn, $homephone, $mobile)
{
$error = 0;
if ($cn == '') {
$error = 1;
echo "Debe ingrear nombre y/o apellido como mínimo para el contacto con teléfono (si tiene) {$homephone} o correo (si tiene) {$mail} <br />";
} else {
if ($mail != '' && !check_email_address($mail)) {
$error = 1;
echo "El correo electrónico ({$mail}) no es válido<br />";
} else {
if (!check_name($cn)) {
$error = 1;
echo "El nombre ({$cn}) no es válido<br />";
} else {
if ($homephone != '' && !check_phone($homephone)) {
$error = 1;
echo "El primer teléfono ({$homephone}) no es válido<br />";
} else {
if ($mobile != '' && !check_phone($mobile)) {
$error = 1;
echo "El segundo teléfono ({$mobile}) no es válido<br />";
} else {
if ($mail == '' && $homephone == '') {
$error = 1;
echo "El contacto {$cn} debe tener teléfono o correo electrónico<br />";
}
}
}
}
}
}
return $error == 0;
}
示例3: __construct1
function __construct1($email)
{
if (!is_string($email)) {
throw new Exception("A string is required here");
}
$this->e = $email;
if (!check_email_address($email)) {
throw new InvalidEmailException("Invalid email address:" . $email);
}
}
示例4: _validate_fields
function _validate_fields($real_name, $username, $userpass, $userpass2, $email, $email2, $email_updates)
{
global $testing;
// Make sure that password and confirmed password are equal.
if ($userpass != $userpass2) {
return _("The passwords you entered were not equal.");
}
// Make sure that email and confirmed email are equal.
if ($email != $email2) {
return _("The e-mail addresses you entered were not equal.");
}
// Do some validity-checks on inputted username, password, e-mail and real name
$err = check_username($username, TRUE);
if ($err != '') {
return $err;
}
// In testing mode, a fake email address is constructed using
// 'localhost' as the domain. check_email_address() incorrectly
// thinks the domain should end in a 2-4 character top level
// domain, so disable the address check for testing.
if (!$testing) {
$err = check_email_address($email);
if ($err != '') {
return $err;
}
}
if (empty($userpass) || empty($real_name)) {
return _("You did not completely fill out the form.");
}
// Make sure that the requested username is not already taken.
// Use non-strict validation, which will return TRUE if the username
// is the same as an existing one, or differs only by case or trailing
// whitespace.
if (User::is_valid_user($username, FALSE)) {
return _("That user name already exists, please try another.");
}
// TODO: The above check only validates against users in the DP database.
// It's possible that there are usernames already registered with the
// underlying forum software (like 'Anonymous') or are disallowed in the
// forum software which, if used, will cause account creation to fail in
// activate.php.
return '';
}
示例5: submit
private function submit()
{
global $db, $template, $config;
//Submit
$username_input = (isset($_POST['username_input_field'])) ? $_POST['username_input_field'] : ''; //Errorno 1
$email_input = (isset($_POST['email_input_field'])) ? $_POST['email_input_field'] : ''; //Errorno 2
$password_input = (isset($_POST['password_input_field'])) ? $_POST['password_input_field'] : ''; //Errorno 3
if(strlen($username_input) < 3)
{
return 1;
}
if(check_email_address($email_input) == false)
{
return 2;
}
if(strlen($password_input) < 8)
{
return 3;
}
if($config->user_name_exists($username_input))
{
return 4;
}
if($config->user_email_exists($email_input))
{
return 5;
}
$new_password = seed_password($username_input, $password_input);
$sql = "INSERT INTO users
(user_name, user_email, user_password, user_admin, user_approved)
VALUES ('" . $db->sql_escape($username_input) . "', '" . $db->sql_escape($email_input) . "', '" . $db->sql_escape($new_password) . "', 0, 0)";
$db->sql_query($sql);
return 0;
}
示例6: rsvp_save
function rsvp_save($event)
{
$ret = 0;
if (!captcha_check(trim($_REQUEST['captcha']))) {
return 3;
}
if (!strtolower(trim($email)) != strtolower(trim($email2))) {
return 4;
}
if (!check_email_address($email)) {
return 5;
}
$regrets = $_REQUEST['regrets'];
$regrets = is_null($regrets) ? 'FALSE' : 'TRUE';
$conn = mysql_connect('localhost', $db_user, $db_pass);
if ($conn) {
mysql_select_db($db_name);
$sql = sprintf("select count(*) from rsvps where email='%s' and event_id=1", mysql_real_escape_string($_REQUEST['email']));
$rs = mysql_query($sql);
if (mysql_result($rs, 0) == 0) {
$sql = sprintf("insert into rsvps (" + "event_id,email,firstname,lastname,adults,children" + ") values (" + "1, '%s', '%s', '%s', '%s', %d, %d, '%s'" + ")", mysql_real_escape_string($_REQUEST['email']), mysql_real_escape_string($_REQUEST['firstname']), mysql_real_escape_string($_REQUEST['lastname']), $regrets, $_REQUEST['adults'], $_REQUEST['children'], $_REQUEST['phone']);
mysql_query($sql);
$last_id = mysql_insert_id();
if ($last_id <= 0) {
$ret = 2;
}
} else {
$sql = sprintf("update rsvps set " + " firstname='%s' " + " ,lastname='%s' " + " ,regrets='%s' " + " ,adults=%d " + " ,children=%d " + " ,phone='%s' " + " ,updated=CURRENT_TIMESTAMP " + " WHERE email='%s' and event_id=1 ", mysql_real_escape_string($_REQUEST['firstname']), mysql_real_escape_string($_REQUEST['lastname']), $regrets, $_REQUEST['adults'], $_REQUEST['children'], mysql_real_escape_string($_REQUEST['phone']));
mysql_query($sql);
}
mysql_close($conn);
} else {
$ret = 1;
}
return $ret;
}
示例7: explode
}
// Split it into sections to make life easier
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if (!ereg("^(([A-Za-z0-9!#\$%&'*+/=?^_`{|}~-][A-Za-z0-9!#\$%&\n.'*+/=?^_`{|}~\\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))\$", $local_array[$i])) {
return false;
}
}
// Check if domain is IP. If not,
// it should be valid domain name
if (!ereg("^\\[?[0-9\\.]+\\]?\$", $email_array[1])) {
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
return false;
// Not enough parts to domain
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|\n.([A-Za-z0-9]+))\$", $domain_array[$i])) {
return false;
}
}
}
return true;
}
$res = check_email_address($_REQUEST['x']);
if ($res == FALSE) {
echo "false";
} else {
printf("%s\n", check_email_address($_REQUEST['x']));
}
示例8: draw_important_message
$mail->MsgHTML('Hello! This is test email.');
if (!$mail->Send()) {
$msg = draw_important_message($mail->ErrorInfo, false);
} else {
$msg = draw_success_message(_EMAIL_SUCCESSFULLY_SENT, false);
}
}
}
}
} else {
if ($submition_type == 'email') {
if ($params_tab4['admin_email'] == '') {
$msg = draw_important_message(_ADMIN_EMAIL_IS_EMPTY, false);
$focus_on_field = 'admin_email';
} else {
if (!check_email_address($params_tab4['admin_email'])) {
$msg = draw_important_message(_ADMIN_EMAIL_WRONG, false);
$focus_on_field = 'admin_email';
}
}
if ($msg == '' && $params_tab4['mailer'] == 'smtp') {
if ($params_tab4['smtp_host'] != '' || $params_tab4['smtp_port'] != '' || $params_tab4['smtp_username'] != '' || $params_tab4['smtp_password'] != '') {
if ($params_tab4['smtp_host'] == '') {
$msg = draw_important_message(str_replace('_FIELD_', '<b>SMTP Host</b>', _FIELD_CANNOT_BE_EMPTY), false);
$focus_on_field = 'smtp_host';
} else {
if ($params_tab4['smtp_port'] == '') {
$msg = draw_important_message(str_replace('_FIELD_', '<b>SMTP Port</b>', _FIELD_CANNOT_BE_EMPTY), false);
$focus_on_field = 'smtp_port';
} else {
if ($params_tab4['smtp_username'] == '') {
示例9: trim
$password1 = trim($_POST["Textpass1"]);
$address = trim($_POST["Textaddress"]);
$postcode = trim($_POST["Textpostcode"]);
if ($fullname == "" || $contact == "" || $email == "" || $password == "" || $password1 == "" || $address == "" || $postcode == "") {
header("Location: " . $host_url . "/register_migrants.php?error='Please fill all fields'");
die;
} else {
if ($password != $password1) {
header("Location: " . $host_url . "/register_migrants.php?error='Passwords are not same'");
die;
} else {
if (strlen($password) < 6) {
header("Location: " . $host_url . "/register_migrants.php?error='Password should be at least 6 characters long'");
die;
} else {
if (check_email_address($email) != true) {
header("Location: " . $host_url . "/register_migrants.php?error='Please provide valid email address'");
die;
}
}
}
}
$conn = new mysqli($servername, $db_username, $db_password, $db_name);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "select id from tbl_userinfo where (email='" . $email . "' AND usertype='migrant')";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
$conn->close();
header("Location: " . $host_url . "/register_migrants.php?error='There is a migrant account exist for this email. Please log in!'");
示例10: mysql_query
if (strlen($input_username) >= $min_username_length and strlen($input_password) >= $min_password_length) {
//check to see if the username is already taken
$query_un = "SELECT username\r\n\t\t\t\t\tFROM users\r\n\t\t\t\t\tWHERE username = '{$input_username}'\r\n\t\t\t\t\tLIMIT 1";
//run it
$result_un = mysql_query($query_un);
//if one row comes back in the result, username is taken.
if (mysql_num_rows($result_un) == 1) {
$valid = false;
$error_msg .= 'Sorry, That username is already taken. Try again<br />';
}
} else {
$valid = false;
$error_msg .= "Username must be at least {$min_username_length} characters long. Password must be at least {$min_password_length} characters long.<br /> ";
}
//check for valid email format before looking up email in the db
if (check_email_address($input_email)) {
//look for existing email in DB
$query_email = "SELECT email\r\n\t\t\t\t\t\tFROM users\r\n\t\t\t\t\t\tWHERE email = '{$input_email}'\r\n\t\t\t\t\t\tLIMIT 1";
$result_email = mysql_query($query_email);
if (mysql_num_rows($result_email) == 1) {
$valid = false;
$error_msg .= 'That email address already exists. Try logging in.<br />';
}
} else {
//bad email format
$valid = false;
$error_msg .= 'Please provide a valid email address.<br />';
}
//if the form passed all the tests, SUCCESS. add the user to the DB
if ($valid == true) {
$query_insert = "INSERT INTO users\r\n\t\t\t\t\t\t(username, email, password, join_date, is_admin)\r\n\t\t\t\t\t\tVALUES\r\n\t\t\t\t('{$input_username}', '{$input_email}', '{$sha_password}', now(), 0)";
示例11: get_parameter
echo "<input type=hidden name='newsletter' value='{$id}'>";
echo "</table></form>";
return;
}
if ($operation == "subscribe_data") {
$validation1 = get_parameter("validation1");
$validation2 = get_parameter("validation2");
$newsletter = get_parameter("newsletter");
$name = get_parameter("name");
$email = get_parameter("email");
$now = date("Y-m-d H:i:s");
echo "<h3>" . __("Thanks for your subscription. You should receive an email to confirm you have been subscribed to this newsletter") . "</h3>";
if ($validation1 == md5($config["dbpass"] . $validation2)) {
// check if already subscribed
$count = get_db_sql("SELECT COUNT(id) FROM tnewsletter_address WHERE email = '" . $email . "' AND id_newsletter = {$newsletter}");
if ($count == 0 && check_email_address(safe_output($email))) {
$sql = "INSERT INTO tnewsletter_address (id_newsletter, email, name, datetime, status) VALUES ({$newsletter}, '{$email}', '{$name}', '{$now}',0)";
$result = mysql_query($sql);
if ($result) {
$newsletter_name = get_db_sql("SELECT name FROM tnewsletter WHERE id = {$newsletter}");
$text .= __("Welcome to") . " " . $newsletter_name . " " . __("newsletter") . "\n\n";
$text .= __("Please use this URL to de-subscribe yourself from this newsletter:") . "\n\n";
$text .= $config["base_url"] . "/include/newsletter.php?operation=desubscribe&id={$newsletter}";
$text .= "\n\n" . __("Thank you");
integria_sendmail($email, "Newsletter subscription - {$newsletter_name}", $text);
}
}
}
return;
}
if ($operation == "desubscribe") {
示例12: sendmail
/**
* Send Email, DOES NOT SANITIZE FOR YOU!
*
* @since 1.0
* @uses GSFROMEMAIL
* @uses $EMAIL
*
* @param string $to
* @param string $subject
* @param string $message
* @return string
*/
function sendmail($to, $subject, $message)
{
$message = email_template($message);
if (getDef('GSFROMEMAIL')) {
$fromemail = GSFROMEMAIL;
} else {
if (!empty($_SERVER['SERVER_ADMIN']) && check_email_address($_SERVER['SERVER_ADMIN'])) {
$fromemail = $_SERVER['SERVER_ADMIN'];
} else {
$fromemail = 'noreply@' . $_SERVER['SERVER_NAME'];
}
}
global $EMAIL;
$headers = '"MIME-Version: 1.0' . PHP_EOL;
$headers .= 'Content-Type: text/html; charset=UTF-8' . PHP_EOL;
$headers .= 'From: ' . $fromemail . PHP_EOL;
$headers .= 'Reply-To: ' . $fromemail . PHP_EOL;
$headers .= 'Return-Path: ' . $fromemail . PHP_EOL;
return @mail($to, '=?UTF-8?B?' . base64_encode($subject) . '?=', "{$message}", $headers);
}
示例13: define
define(PRODUCTION, "production");
require 'vendor/autoload.php';
use RedBean_Facade as R;
R::setup(DB_DNS, DB_UNAME, DB_PASS);
$app = new \Slim\Slim();
$app->config('templates.path', './template');
if (ENV != PRODUCTION) {
$app->config('debug', true);
}
$app->get('/', function () use($app) {
$app->render('index.php');
});
$app->post('/get', function () use($app) {
$email = $app->request->post('email');
$ip = $app->request()->getIp();
if ($email == NULL || $email == '' || !check_email_address($email)) {
echo json_encode(array('success' => FALSE, 'error' => 'INVALID'));
} else {
if (R::count('email', 'ip=:ip AND time>=:time', array(':ip' => $ip, ':time' => time() + 119 * 60)) >= 20) {
echo json_encode(array('success' => FALSE, 'error' => 'LIMITATION'));
} else {
$bean = R::findOne('email', 'forwardto=:email AND time >= :time', array(':email' => $email, ':time' => time()));
if ($bean) {
$bean->time = time() + 120 * 60;
R::store($bean);
echo json_encode(array('success' => TRUE, 'email' => $bean->email . '@tempmail.ir'));
} else {
$rndmail = '';
do {
$rndmail = generateRandomString(8);
} while (R::count('email', 'email=:email AND time>=:time', array(':email' => $rndmail, ':time' => time())) > 0);
示例14: md5
if ($_POST['n_pass'] == $_POST['c_pass'] && $_POST['n_pass'] != '') {
// insert into / update tables
$sql = "UPDATE users set passwd=md5('" . $_POST['n_pass'] . "') where user_id=" . $_POST['u_id'];
$result = $db->query($sql);
$_SESSION[$_CONF['sess_name'] . '_password'] = md5($_POST['n_pass']);
$t = "Message...";
$b = "Your password has been updated.<br />\n\t\t\t\t<form action=index.php?lev=" . $_SESSION[$_CONF['sess_name'] . '_lev'] . "&cat=" . $_SESSION[$_CONF['sess_name'] . '_cat'] . " method=POST>\n\t\t\t\t<input type=submit class=submit name=finish value=Continue>\n\t\t\t\t</FORM>";
$main .= make_box($t, $b, "yellow");
} else {
$t = "ERROR...";
$b = "Your passwords did not match. Press your Browser's BACK\n\t\t\t\t\tbutton and please fix. <br />\n\t\t\t\t\tBlank Passwords are not allowed.";
$main .= make_box($t, $b, "red");
}
}
if (isset($_POST['modify_ui'])) {
$email_error = check_email_address($_POST['u_email']);
if (check_uname($_POST['u_name'], $_POST['u_id']) && !$email_error['error_value']) {
$query = "UPDATE users set email='" . $_POST['u_email'] . "', address1='" . $_POST['u_address1'] . "', address2='" . $_POST['u_address2'] . "', city='" . $_POST['u_city'] . "',state='" . strtoupper($_POST['u_state']) . "', zip='" . $_POST['u_zip'] . "', phone='" . $_POST['u_phone'] . "', send_attend_email='" . $_POST['send_attend_email'] . "', weekly_progress='" . $_POST['weekly_progress'] . "'\n\t\t\t\t\tWHERE user_id=" . $_POST['u_id'];
$result = $db->query($query);
$_SESSION[$_CONF['sess_name'] . '_username'] = $_POST['u_name'];
$t = "Message...";
$b = "User Information updated.</FONT><br />\n\t\t\t\t<form action=index.php?lev=" . $_SESSION[$_CONF['sess_name'] . '_lev'] . "&cat=" . $_SESSION[$_CONF['sess_name'] . '_cat'] . " method=POST>\n\t\t\t\t<input type=submit class=submit name=finish value=Continue>\n\t\t\t\t</FORM>";
$main .= make_box($t, $b);
} else {
if ($email_error['error_value']) {
$t = "ERROR...";
$results[result] = false;
$b .= $email_error['error_message'];
$main .= make_box($t, $b, "red");
} else {
$t = "ERROR...";
示例15: mysql_real_escape_string
<?php
include 'library/config.php';
include 'library/opendb.php';
// Retrieve data from Query String
$first_name = $_GET['first_name'];
$last_name = $_GET['last_name'];
$email = $_GET['email'];
// Escape User Input to help prevent SQL Injection
$first_name = mysql_real_escape_string(trim($first_name));
$last_name = mysql_real_escape_string(trim($last_name));
$email = mysql_real_escape_string(trim($email));
//build query
if ($email != '') {
if (check_email_address($email)) {
##check if already subscribed;
$query = mysql_query("select * from subscribers where email_address = '{$email}' ");
if (mysql_num_rows($query) > 0) {
echo "<div style='background:#ACF0AE; font-weight:bold; color:#FFFFFF;' > ... Oops, are already subscribed </div>";
} else {
$query = "INSERT INTO subscribers (first_name, last_name, email_address) VALUES ('{$first_name}', '{$last_name}', '{$email}')";
$qry_result = mysql_query($query) or die(mysql_error());
if ($qry_result) {
echo "<div style='background:#ACF0AE; font-weight:bold; color:#FFFFFF;' > Successfuly Subsribed to EJHS. </div>";
}
}
} else {
echo "<div style='background:#FF9191; font-weight:bold; color:#FFFFFF;' > Email must be valid one</div>";
}
} else {
echo "<div style='background:#FF9191; font-weight:bold; color:#FFFFFF;' > Subscription was not successful, Email is required to subscribe </div>";