Jump to content

delete


Pridit

Recommended Posts

To be honest, what you say you want the code to do and what the code actually does doesn't seem to match up. According to the PHP manual (http://us2.php.net/manual/en/function.stripos.php) stripos() finds the position of first occurrence of a specified string inside another (case-insensitive) string. So:

 

$emailvalid = stripos($email,"&");

 

is looking for any instances of the string "&" inside the $email variable. Is that what you want it to do? That doesn't seem to match up with your comment "I'm trying to make the stripos find the email in the variable". In that case, shouldn't it be something more like:

 

$emailvalid = stripos($variable, $email);

 

??

 

Also, one other error: This line "if($error = 1)" needs to be "if($error == 1)". Currently, you are setting error to "1" in that line, rather than checking if it equals 1.

Link to comment
Share on other sites

Oops, didn't see your edit. Glad you fixed your problem.

 

I will comment that simply searching for "@" isn't necessarily going to be enough to check if there is a valid email address. What if the $_POST value is "sdfasdfasf@sdfsdf"? According to your code, that's a valid address, simply because it includes an "@".

 

(Perhaps you added stronger error checking later, but be aware: NEVER trust any input from a user.)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...