Re: Need help: PHP4 not parsing authentication



Wow, I was cracking my head last time figuring out the problem.
This what happend, back in 2002 I was fooling around with php3 wiht all those code from php and mysql books, well they did parse perfectly.
Now fast forward to 2005 WITHOUT TOUCHING PHP for 3 years, I got into this problem. WHAT A FITFALL!!!, Yes because I dont program much for a living.



Kim André Akerø wrote:
passat91@xxxxxxxxxxxx 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.

.



Relevant Pages

  • Re: Using NET SEND for a pop-up box
    ... Why not use a batch file and some ECHO commands instead? ... I've done a bit of testing and found that NET SEND <username> ... Sc.exe config "messenger" start= auto ... The first part is using the SC command Microsoft released to make sure ...
    (microsoft.public.win2000.networking)
  • RE: Help for Windows Vista.
    ... just add a username and password to your command. ... Echo Loggin into our company ... REM *** drev w ... Did you run the Script as Administrator? ...
    (microsoft.public.windows.vista.general)
  • Re: Hiding last logon, all MS platforms, why or why not to do
    ... As Alun mentions, identity is public. ... This is a fundamental concept of computer science. ... > You have a tendency to think of the username as "half the key". ... > secret, and with the assumption that the username is public. ...
    (microsoft.public.security)
  • Re: Make
    ... echo "UserId: $" ... echo "enter username (type end to exit)" ...
    (comp.unix.questions)
  • Re: to add username & password into my login.cmd - login script
    ... echo You are now logged into %computername% ... echo Now setting up your computer for network access. ... The above is a logon script that we r using in our network. ... When we run this script it keeps asking for username & password. ...
    (microsoft.public.windows.server.scripting)