28620

liunx

Guest
if(!(preg_match ("$_POST", "@")) || !(preg_match ("$_POST[email]", "."))) {

error:
Warning: Delimiter must not be alphanumeric or backslash in c:\phpdev\www\design com21\register.php on line 12
:eek:you can't use preg_match that way

beside that is a weak way to check for email. try this

if (!preg_match('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i', $email)) {
$errmsg = "<span style=\"color:red; font-size: 12px\">Sorry your email is invalid, please try again</span>";
}it's bugged:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in c:\phpdev\www\localhost_game\bla.php on line 11

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in c:\phpdev\www\localhost_game\bla.php on line 11then you have a problem with your setup as I use that code all the time.

how are you getting the email to it? through a form? then add this

$email = $_POST['email'];

can you show me the code?this is it cropped <?php
if($_POST[submit]){

if (!preg_match('/^[-!#$%&'*+\\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i', $_POST[email])) {
echo "<span style=\"color:red; font-size: 12px\">Sorry your email is invalid, please try again</span>";
}

}
?>
<form action="" method="post">
Email <input type="text" name="email"> <input type="submit" value="check" name="submit">

I get the same error both on my localhost and on my virtual host (page (<!-- m --><a class="postlink" href="http://www.gq-guild.com/check.php">http://www.gq-guild.com/check.php</a><!-- m -->) )you can't post it in the [php] tags as tha ttakes away some of the properties of the code.

if (!preg_match('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i', $_POST['email'])) {

it has to be that one. if tha tdoesn't work then your php setup is all messed up.nope, it still ****s up, guess it's teh setup

ill use some other code that does works
I]if (!eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$", $_POST[email])){[/I]Regexs aren't exactly my strength, but there is a single quotation mark loose in there:

if (!preg_match('/^[-!#$%&here>'<here*+\\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i', $_POST['email'])) {

Escape that with a backward slash, and maybe it works better then.that solved the rror :rocker: thanks
 
Top