MirceaLzr Posted October 5, 2011 Share Posted October 5, 2011 Hello i use mysql 5.0 and i have some problem.I make this tutorial but the code dosen't work. **Installation Instructions: 1. Copy auth.inc and htmldoc.inc to a directory *outside* of your html document tree. 2. If you have a MySQL database already created that you wish to have the ACL (access list) table created in, start the mysql client and connect to the database. Otherwise, you must create a database. See the MySQL documentation for information on doing this. Once you have the mysql client open and connected to the database you want to use, issue the following command: CREATE TABLE acl ( id int(16) DEFAULT '0' NOT NULL auto_increment, username varchar(16) DEFAULT '' NOT NULL, password varchar(16) DEFAULT '' NOT NULL, staffname varchar(32) DEFAULT '' NOT NULL, string varchar(100), PRIMARY KEY (id) ); Next, you must add a user. The command for this is: INSERT INTO acl ( username, password ) VALUES ( 'the_username', encrypt('the_password','the_username') ); alternatively, if you want to use the 'staffname' field, or some other field that you add on your own: INSERT INTO acl ( username, password, staffname ) VALUES ( 'the_username', encrypt('the_password','the_username'), 'John Soandso' ); 3. Here's where you need to make a decision. You have two ways of making this script "work" with your website. "Every single page on this server or virtual host is private and must be password protected!!" If this is your case, add a line inside your <VirtualHost> directive like this, and then restart Apache: php3_auto_prepend_file /path/to/auth.inc This is very useful. It will automatically prepend the auth script to every php document requested through this virtual host. Everything is protected. This is the way I *reccomend* doing it. "But I only need some pages to be private!" Ok.. then you have to put the following line inside of every php document you want protected. <? require('/path/to/auth.inc'); ?> 4. Next, edit the auth.inc file and change the variables near the top of the script. Then do: chmod 755 auth.inc htmldoc.inc I make all the change but the script dosen't work.The script file is attached.When i try to login i cant.Need some help.Thnks . [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/248472-authentication-problem/ 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.