newbie on IF: Why does this not work?

This is a discussion on newbie on IF: Why does this not work? within the PHP Language forums, part of the PHP Programming Forums category; Hi everyone, Please help. Why doesn't this work? If email1=email2 and be a email address (via regex) then ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-26-2004
Raj
 
Posts: n/a
Default newbie on IF: Why does this not work?

Hi everyone,

Please help.

Why doesn't this work?

If email1=email2 and be a email address (via regex) then goto
"enter_dob.php". If not or not then goto reenter_email.php.

Thanks,

Raj

<?php
if (empty($_SESSION['site_name']))
{
ob_end_clean();
header("Location: start.php");
}

if (empty($_SESSION['site_logo_location']))
{
ob_end_clean();
header("Location: start.php");
}

if (empty($_SESSION['site_admin_email']))
{
ob_end_clean();
header("Location: start.php");
}

$_SESSION['email']=$_POST['email1'];

$pattern="(\w+\.)*\w+@(\w+\.)+[A-Za-z]+";
if (!preg_match($pattern, $_SESSION['email']))
{
ob_end_clean();
header("Location: reenter_email.php");
}

if ($_POST['email1']==$_POST['email2'])
{
ob_end_clean();
header("Location: enter_dob.php");
}
else
{
ob_end_clean();
header("Location: reenter_email.php");
}
?>

Reply With Quote
  #2 (permalink)  
Old 06-26-2004
Raj
 
Posts: n/a
Default Re: newbie on IF: Why does this not work?

On Sat, 26 Jun 2004 18:37:03 +0100, Raj <raj@nospam.com> wrote:

>Hi everyone,
>
>Please help.
>
>Why doesn't this work?
>
>If email1=email2 and be a email address (via regex) then goto
>"enter_dob.php". If not or not then goto reenter_email.php.
>
>Thanks,
>
>Raj
>
><?php
>if (empty($_SESSION['site_name']))
>{
> ob_end_clean();
> header("Location: start.php");
>}
>
>if (empty($_SESSION['site_logo_location']))
>{
> ob_end_clean();
> header("Location: start.php");
>}
>
>if (empty($_SESSION['site_admin_email']))
>{
> ob_end_clean();
> header("Location: start.php");
>}
>
>$_SESSION['email']=$_POST['email1'];
>
>$pattern="(\w+\.)*\w+@(\w+\.)+[A-Za-z]+";
>if (!preg_match($pattern, $_SESSION['email']))
>{
> ob_end_clean();
> header("Location: reenter_email.php");
>}
>
>if ($_POST['email1']==$_POST['email2'])
>{
> ob_end_clean();
> header("Location: enter_dob.php");
>}
>else
>{
> ob_end_clean();
> header("Location: reenter_email.php");
>}
>?>


I mean it goes to "enter_dob.php" whatever I input.

Raj
Reply With Quote
  #3 (permalink)  
Old 06-26-2004
Tim Van Wassenhove
 
Posts: n/a
Default Re: newbie on IF: Why does this not work?

In article <06crd0l4okjrevqlml8u0t6evtbr7o2adt@4ax.com>, Raj wrote:
> Why doesn't this work?
>
> If email1=email2 and be a email address (via regex) then goto
> "enter_dob.php". If not or not then goto reenter_email.php.


where is session_start(); ?

> $pattern="(\w+\.)*\w+@(\w+\.)+[A-Za-z]+";
> if (!preg_match($pattern, $_SESSION['email']))


That regular expression is useless.
If you want it to be compliant with rfc822 it should more like the one
at http://www.ex-parrot.com/%7Epdw/Mail...2-Address.html

--
Tim Van Wassenhove <http://home.mysth.be/~timvw>
Reply With Quote
  #4 (permalink)  
Old 06-26-2004
Gary L. Burnore
 
Posts: n/a
Default Re: newbie on IF: Why does this not work?

On 26 Jun 2004 20:53:27 GMT, Tim Van Wassenhove <euki@pi.be> wrote:

>In article <06crd0l4okjrevqlml8u0t6evtbr7o2adt@4ax.com>, Raj wrote:
>> Why doesn't this work?
>>
>> If email1=email2 and be a email address (via regex) then goto
>> "enter_dob.php". If not or not then goto reenter_email.php.

>
>where is session_start(); ?
>
>> $pattern="(\w+\.)*\w+@(\w+\.)+[A-Za-z]+";
>> if (!preg_match($pattern, $_SESSION['email']))

>
>That regular expression is useless.
>If you want it to be compliant with rfc822 it should more like the one
>at http://www.ex-parrot.com/%7Epdw/Mail...2-Address.html


Can you use that expression in a sentence? Heh.
--
gburnore@databasix dot com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
DataBasix | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ 3 4 1 4 2 ݳ޳ 6 9 0 6 9 ÝÛ³
Black Helicopter Repair Svcs Division | Official Proof of Purchase
================================================== =========================
Want one? GET one! http://www.databasix.com
================================================== =========================
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:32 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0