Reply to Re: Need help: PHP4 not parsing authentication

Your name:

Reply:


Posted by Kim Andrι Akerψ on 12/09/05 11:39

passat91@sympatico.ca wrote:

> Could somebody tell me.
> I installed php4 successfully, but when I do run some script like the
> following: <?
> if(!isset($name)&&!isset($password))
> {
> //Visitor needs to enter a name and password
> ?>
> <h1>Please Log In</h1>
> This page is secret.
> <form method = post action = "secret.php">
> <table border = 1>
> <tr>
> <th> Username </th>
> <td> <input type = text name = name> </td>
> </tr>
> <tr>
> <th> Password </th>
> <td> <input type = password name = password> </td>
> </tr>
> <tr>
> <td colspan =2 align = center>
> <input type = submit value = "Log In">
> </td>
> </tr>
> </form>
> <?
> }
> else if($name=="user"&&$password=="pass")
> {
> // visitor's name and password combination are correct
> echo "<h1>Here it is!</h1>";
> echo "I bet you are glad you can see this secret page.";
> }
> else
> {
> // visitor's name and password combination are not correct
> echo "<h1>Go Away!</h1>";
> echo "You are not authorized to view this resource.";
> }
> ?>
>
>
> It can only parse the html login but it doesn't authenticate the
> username and password I entered. Im getting no ouput but only the
> html login form. What the heck Im missing???

Most likely, register_globals is set to "off" in the global php.ini
settings.

I'd suggest using $_REQUEST["name"] instead of $name, and
$_REQUEST["password"] instead of $password in the above code example.

--
Kim AndrΓ© AkerΓΈ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация