elite311 Posted December 4, 2011 Share Posted December 4, 2011 I have been reading a lot on this and I can't seem to find the answer, I have a protected directory with .htaccess and I'm wondering if there is a way I can have the PHP script enter the password on the url redirect? Basically I only want the directory to be able to be accessed from my site so I created and SQL database with "id", "site", "url" and then a web form. If the user enters "testsite" and it matchs the "site" in the SQL it redirects the browser to that site. The script works great but the user would have to enter the .htaccess username and password in the popup and I'd like the site to just do that automatically in the background. header('Location: ' . $project_info['url']) I thought I could do something like this header('Location: username:password ' . $project_info['url']) or header('Location: ' . $htuser . $htpass . $project_info['url']) But that doesn't work and I'm not even sure what I'm trying to do is possible. Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted December 4, 2011 Share Posted December 4, 2011 it's most likely easier to have a login system using sessions on top of the page the session would start if user is logged in continue, else redirect them somewhere else or to login the login process would check if it's a proper user and password There was a tutorial online that I edited it so it worked http://www.phpfreaks.com/forums/index.php?topic=338735.msg1596372#msg1596372 use this for the sql CREATE TABLE IF NOT EXISTS `dbusers` ( `id` int(11) NOT NULL auto_increment, `username` varchar(32) collate utf8_unicode_ci default NULL, `password` char(32) collate utf8_unicode_ci default NULL, `email` varchar(32) collate utf8_unicode_ci default NULL, PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; I myself took this code here and modified it a lot for my own use http://www.evolt.org/node/60265 Ther may have been a few errors in it, can look through the comments or ask me and maybe I'll whip up a version of my edited one. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.