Jump to content

Recommended Posts

I have a script that checks to see if an email address is already in the database before a user can register, for some reason it isn't working right, but I don't know why. Here is what I have so far:

 

<?php
include("../admin/function/db.php");
include("JsHttpRequest.php");

$JsHttpRequest =& new JsHttpRequest($mtg);

$email=result3($_REQUEST['email']);

if($_REQUEST['email']=="" or !preg_match("/[\.\-_A-Za-z0-9]+?@[\.\-A-Za-z0-9]+?[\.A-Za-z0-9]{2,}/",$_REQUEST['email']))
{
echo("<span class='error'>".word_lang("incorrect")."</span>");
}
else
{
$sql="select email from users where email='".$email."'";
$rs->open($sql);
if(!$rs->eof)
{
echo("<span class='error'>".word_lang("serror2")."</span>");
}
else
{
echo("<span class='ok'>".word_lang("ok2")."</span>");
}
}
?>

I think the problem lies in the preg_match section, but I haven't a clue how it should be formatted.

Link to comment
https://forums.phpfreaks.com/topic/190182-simple-regex-email-check/
Share on other sites

I replaced the original with this:

if($_REQUEST['email']=="" or filter_input(INPUT_REQUEST, 'email', FILTER_VALIDATE_EMAIL) != $_REQUEST['email'])

 

But I get this error now:

Warning:  filter_input() [function.filter-input]: INPUT_REQUEST is not yet implemented in check_email.php on line 9

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.