URL Redirection with login credentials

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
riasudeen
Forum Newbie
Posts: 3
Joined: Mon May 10, 2010 8:46 pm

URL Redirection with login credentials

Post 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
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: URL Redirection with login credentials

Post 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
riasudeen
Forum Newbie
Posts: 3
Joined: Mon May 10, 2010 8:46 pm

Re: URL Redirection with login credentials

Post by riasudeen »

Thanks for your reply

what suppose to be the right syntax for
username: test
password: test123
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: URL Redirection with login credentials

Post 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).
riasudeen
Forum Newbie
Posts: 3
Joined: Mon May 10, 2010 8:46 pm

Re: URL Redirection with login credentials

Post 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?
Post Reply