Hi all,
I used the above code, but made a few changes and it seems to be working for me.
$MYSQL_HOST = 'localhost'; // usually localhost
$MYSQL_USER = 'db-username'; // mysql username
$MYSQL_PASSWORD = 'db-password'; // password
$MYSQL_DB_NAME = 'db-name'; // mysql database name (on cPanel it is usually prefixed with username // and underscore, like username_dbname)
$USERNAME_FIELD = 'user_name'; // name of the field which holds username
$PASSWORD_FIELD = 'user_password'; // name of the field which holds password
// Establish DB connection
$db = @mysql_connect($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD) or die("Could not connect to database");
@mysql_select_db($MYSQL_DB_NAME, $db) or die("Could not select database");
// query to get users list from db. Replace user_table with the table name which holds users.
$query = "SELECT * FROM user_table";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)) {
$LOGIN_INFORMATION[$row[$USERNAME_FIELD]] = $row[$PASSWORD_FIELD];
}
mysql_close($db); // close db connection
Hope this helps....
