146 Part II: Developing Intranet Solutions Creating the (Net web server)

146 Part II: Developing Intranet Solutions Creating the Central Authentication Database Before you can use the login and logout applications, you need to create the central authentication database and then add a user to it. The central authentication database information is stored in both login.conf and logout.conf files using the following configuration variables: $AUTH_DB_TYPE = mysql ; $AUTH_DB_HOST = localhost ; $AUTH_DB_NAME = auth ; $AUTH_DB_TBL = users ; $AUTH_DB_USERNAME = root ; $AUTH_DB_PASSWD = foobar ; In our example, the database type is mysql and the database host name is local- host, which means we re implementing the database on the same server as a MySQL database. If you want to use a different database host or a different database server such as Postgres or Oracle, you have to change these variables. For our example, I assume that you re using the given sample values for $AUTH_DB_TYPE, $AUTH_DB_HOST, $AUTH_DB_NAME, and $AUTH_DB_TBL. However, I strongly suggest that you use different $AUTH_DB_USERNAME and $AUTH_DB_PASSWD values for your database. Make sure that the user you specify in $AUTH_DB_USERNAMEhas the privilege to access (select, insert, update,and delete) $AUTH_DB_NAME on $AUTH_DB_HOST. You should test the user s ability to access this database using your standard database-access tools. For example, if you re using MySQL, you can run the command-line MySQL client as mysql -u root -p -D authto access the authentication database. Assuming that you re using the given settings, you can create a MySQL database called auth using the mysqladmin create auth command. You ll require appropriate permission to run mysqladmin or equivalent commands to create the auth database. Please consult your MySQL documentation for details. Now to create the $AUTH_DB_TBL (users) table you can run the users.sql script using mysql -u AUTH_DB_USERNAME -p -D AUTH_DB_NAME < auth.sql command. The auth.ddl script is shown in Listing 5-11. Listing 5-11: auth.sql # phpMyAdmin MySQL-Dump # version 2.2.5 # http://phpwizard.net/phpMyAdmin/

Leave a Reply