lambada
New Member
- Messages
- 2,444
- Reaction score
- 0
- Points
- 0
The aim of this piece of work under construction is to use a users phpBB login to see if they are an admin and if so give them certain actions (I haven't coded the actions yet)
But, I have a problem - it displays the login form when it should, but when it displays the page afterwards it shows the submitted username and password, but not the user and pass gatherd from the db and yet I can't see where I've gone wrong. I think it's a db retrieval problem. For those who don't know i'm using the PEARL DB module which was recently installed on the free server per my request.
Any help pertaining to this or otherwise is greatly appreciated.
[/COLOR]
But, I have a problem - it displays the login form when it should, but when it displays the page afterwards it shows the submitted username and password, but not the user and pass gatherd from the db and yet I can't see where I've gone wrong. I think it's a db retrieval problem. For those who don't know i'm using the PEARL DB module which was recently installed on the free server per my request.
Any help pertaining to this or otherwise is greatly appreciated.
Code:
[COLOR=#000000] <?php
function auth_check($UserName, $UserPass) {
//Connect to database
require 'DB.php';
$db = DB::connect('mysql://lambada_admin:****@localhost/lambada_main');
//Check db connection
if (DB::isError($db)) {die("Can't connect:" . $db->getMessage()); }
//Connection Ended, Data Retrieval Started
$q = $db->query('SELECT username, user_password FROM phpbb_users WHERE username LIKE ?',
array($UserName));
return $q;
}
//Check for Action requested
switch ($_GET[Action] ) {
//If User is Logging In - denoted by ?Action=LoginProcess
case "LoginProcess":
echo "Processing Login...";
echo "<br />";
auth_check($_GET[UserName], $_GET[UserPass]);
$dbUserName = $q[username];
$dbUserPass = $q[user_password];
echo "submited username =" . $_GET[UserName];
echo "<br />";
echo "submitted userpass = " . $_GET[UserPass];
echo "<br />";
echo "<br />";
echo "dbUserName =" . $q[username];
echo "<br />";
echo "dbUserPass =" . $q[user_password];
break;
//If Invalid or Missing Action then display login form
default:
?>
<html>
<head><title>Ministerial Login BETA</title></head>
<body>
<form method="GET" action="<?php $_SERVER['PHP_SELF']; ?>">
Forum User Name: <input type="text" name="UserName" />
<br />
Forum Password: <input type="password" name="UserPass" />
<input type="hidden" name="Action" value="LoginProcess" />
<br />
<input type="submit" value="Login" />
</form>
<?php include('http://staff.x10hosting.com/adCode.php?ad=advanced'); ?>
</body>
</html>
<?php
break;
}
?>