PHP Classes

Blank user field

Recommend this page to a friend!

      PHP HTTP protocol client  >  All threads  >  Blank user field  >  (Un) Subscribe thread alerts  
Subject:Blank user field
Summary:Login using blank username
Messages:10
Author:Jason
Date:2006-12-20 23:29:52
Update:2006-12-27 05:03:05
 

  1. Blank user field   Reply   Report abuse  
Picture of Jason Jason - 2006-12-20 23:29:52
I need to be able to login to a web site which has no username
requirement only password. When I try using the test_http.php it
passes the error: the request credential user is not defined.

Jason.

  2. Re: Blank user field   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2006-12-21 00:54:38 - In reply to message 1 from Jason
That means you are not setting the authentication user. You need to set the user to an empty string.

How are you setting the authentication user in your script?

  3. Re: Blank user field   Reply   Report abuse  
Picture of Jason Jason - 2006-12-21 01:29:39 - In reply to message 2 from Manuel Lemos
If set the user to "" I get the message I mentioned before. If I set it to " " then it doesn't authorise correctly. The system I'm logging into requires a blank for the username field.

The passwd i am using is admin
The authorization key for a blank username and admin password is:
OmFkbWlu

The key I get for " " username and admin passwword is
IDphZG1pbg

  4. Re: Blank user field   Reply   Report abuse  
Picture of Jason Jason - 2006-12-21 02:48:19 - In reply to message 3 from Jason
In this case how can I set the user to an empty string? Other than using
"", which doesn't work.

  5. Re: Blank user field   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2006-12-21 03:46:31 - In reply to message 3 from Jason
I know you are setting the user to an empty string. What I need to see is how you are doing it in your script. Can you show me the relevant part of your script where you do it?

  6. Re: Blank user field   Reply   Report abuse  
Picture of Jason Jason - 2006-12-21 06:04:24 - In reply to message 5 from Manuel Lemos
The configuration for the username and password for my php script.

$user="";
$password="admin";

  7. Re: Blank user field   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2006-12-21 07:36:51 - In reply to message 6 from Jason
I mean how are you passing the user to the class?

  8. Re: Blank user field   Reply   Report abuse  
Picture of Jason Jason - 2006-12-21 08:25:51 - In reply to message 7 from Manuel Lemos
I'm simply running your test_http.php script from a dos window (ie php test_http.php) with the $user and $password variables set to "" and "admin" respectively.

  9. Re: Blank user field   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2006-12-23 19:32:18 - In reply to message 8 from Jason
It seems the problem is caused by PHP parse_url() function that does not set the user parameter even when you set a password.

I have just uploaded a new version of the class that adds a workaround to that problem. Just let me know if it works OK for you now.

  10. Re: Blank user field   Reply   Report abuse  
Picture of Jason Jason - 2006-12-27 05:03:05 - In reply to message 9 from Manuel Lemos
Thanks Manuel, this version is working great.