Topic: How to verify username/password against punBB
This is how you would verify in your own scripts against the punBB userbase, for shared userbase throughout your site for example.
This example is for PGSQL (I'm running 7.3.4)
$DBString = "host=localhost port=5432 dbname=punbb user=pun password=pun";
$DBConn = pg_connect($DBString);
$username = trim($_POST['username']);
$password = md5(trim($_POST['password']));
$pun_users = "users";
$pun_prefix = "";
$SQL = "SELECT * FROM " . $pun_prefix . $pun_users . " WHERE username = '" . $username . "' AND password = '" . $password . "'";
$Q = pg_query($SQL);
$ROW = pg_fetch_array($DBConn, $Q);
$NUM = pg_num_rows($ROW);
pg_close();
if ($NUM == "1")
{
print("Username & Password Verified");
}
else
{
print("Username/Password Combo not found.");
}
This example is for MySQL (Haven't been tested live)
$DBConn = mysql_connect("localhost", "pun", "pun");
mysql_select_db("punbb");
$username = trim($_POST['username']);
$password = md5(trim($_POST['password']));
$pun_users = "users";
$pun_prefix = "";
$SQL = "SELECT * FROM " . $pun_prefix . $pun_users . " WHERE username = '" . $username . "' AND password = '" . $password . "'";
$Q = mysql_query($SQL);
$ROW = mysql_fetch_array($Q);
$NUM = mysql_num_rows($ROW);
mysql_close();
if ($NUM == "1")
{
print("Username & Password Verified");
}
else
{
print("Username/Password Combo not found.");
}
It assumes you get username and password from a form using post-method.
You all get the idea, and you could haxxor it up as you like...