PHP with Apache authentication
Moderator: General Moderators
PHP with Apache authentication
Hi Guys,
I need little bit help. I have webportal in php. User normally logins under this portal through Php+Mysql
authentication module. There is a link inside this webserver1 which points to other websitewhich has simple a
apache authentication module. I want when user click webserver2 from webserver1 php should take session user
name and password and open webserver2 without prompting user name and password? I can create same user
name and password on both
webservers. Is it doable ?
I need little bit help. I have webportal in php. User normally logins under this portal through Php+Mysql
authentication module. There is a link inside this webserver1 which points to other websitewhich has simple a
apache authentication module. I want when user click webserver2 from webserver1 php should take session user
name and password and open webserver2 without prompting user name and password? I can create same user
name and password on both
webservers. Is it doable ?
Since cookies cannot be shared between domains your script will have to pass the sessionID in the URL (you will have to explicitly pass this to a script that will assign the id to the user's session), you'd then have to have webserver 2 read the session data off webserver 1. Is this what you meant by "session" or did you mean http authentication? Does your PHP script maintain any other session data besides login and password?
hi jspro2,
Thanks for prompt reply. My main concern is "http authentication". I want when user login on webserver1 they dont need to give same user name
and password for webserver2. In php is there any method or function when user click webserver2 it gets session user name and password from
webserver1 and use this user name and password for webserver2 authentication.
Thanks for prompt reply. My main concern is "http authentication". I want when user login on webserver1 they dont need to give same user name
and password for webserver2. In php is there any method or function when user click webserver2 it gets session user name and password from
webserver1 and use this user name and password for webserver2 authentication.
If you have a database of users you can check against on both machines, just send the username and password as a hash through the get string
.
Then grab that data through $_GET on the other server
Code: Select all
http://server1.example/page.php?user=<?php echo $user; ?>&pass=<?php echo sha1($pass) ?>Then grab that data through $_GET on the other server
Hi jshpro2,
I have url like http://server1/index.php which is .htpasswrd protected.
And i have user admin and password 789 for this
I tried to open this link according to your method but could not
http://server1/index.php?user=admin&pass=789
Am I doing right?
I have url like http://server1/index.php which is .htpasswrd protected.
And i have user admin and password 789 for this
I tried to open this link according to your method but could not
http://server1/index.php?user=admin&pass=789
Am I doing right?