Page 1 of 1

URL Redirection with login credentials

Posted: Mon May 10, 2010 10:35 pm
by riasudeen
Hi,

I am new to php and need your advise on URL Redirection with login credentials

I have following code for URL direction
<?php
header( 'Location: http://www.test.com' ) ;
?>

when i redirect to http://www.test.com, "test.com will ask for username, password and port number"
I need to know how to do redirection including this informations in php code to pass login page. Kindly advise?

Thank You

Re: URL Redirection with login credentials

Posted: Mon May 10, 2010 10:42 pm
by yacahuma

Code: Select all

header( 'Location: http://www.test.com?user=' . $user . '&pwd=' . $pwd ) ;
But I dont think you really want to do that. You should save the information in a session

Re: URL Redirection with login credentials

Posted: Mon May 10, 2010 11:20 pm
by riasudeen
Thanks for your reply

what suppose to be the right syntax for
username: test
password: test123

Re: URL Redirection with login credentials

Posted: Tue May 11, 2010 3:55 am
by Apollo
That would be "http://test:test123@www.test.com/" (which is clearly a bad idea because with http, your credentials are sent out in the open for everyone to sniff).

Re: URL Redirection with login credentials

Posted: Tue May 11, 2010 6:44 am
by riasudeen
I do understand its bad idea but currently user have to cross 2 levels of authendication and this method will help to pass first level
btw, provided answer dosn't work for my requirment ... could you provide me php code icluding username, password and port number?