Re: Is this code right?
| From: | Radwan Aladdin | Date: | Mon, 19 Jan 2004 18:21:17 +0000 |
| Subject: | Re: Is this code right? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-175061@lists.php.net to get a copy of this message | ||
Just what I'm trying to do (Comparing the database with the GET) :) :)
Thanks alot for your help..
Regards..
----- Original Message -----
From: "Ben Ramsey" <br@benandliz.com>
Newsgroups: php.general
To: "Radwan Aladdin" <raladin@emirates.net.ae>
Sent: Monday, January 19, 2004 10:16 PM
Subject: Re: [PHP] Is this code right?
> Radwan Aladdin wrote:
> > Do you mean this is the right code :
>
>
> The code overall looks right, but you set $Serial twice... first you do:
>
> $Serial = $_GET['Serial'];
>
> Then you do:
>
> $Serial = htmlspecialchars($row[0]);
>
> Then you set $UserSerial to $row[1] (the same as the Password column).
>
> So, when you compare $Serial to $UserSerial, you are really comparing it
> like this:
>
> if (htmlspecialchars($row[0]) == $row[1])
>
> If that's what you're trying to do, then you're good. But, if you're
> trying to compare $UserSerial with the serial variable in $_GET, then
> you need to only do the following:
>
> $Serial = $_GET['Serial'];
> $UserSerial = $row[0];
> if ($Serial == $UserSerial)
>
> Then, that should at least compare the serial field from the database
> with the serial variable in $_GET.
>
> -Ben
>
>