I am having trouble with this code. I've tried a few different things. I have put in an echo to see where the code stops, but when I try and the script, it is a blank page.
I am trying to have a section where my members log in and it uses the same database as phpbb for the users. I removed the user/password for my server for security of course. Any help anyone can provide would be great. Thanks
Here is the code:
<?php
//check for required fields from the form
if ((!$_POST[username]=="") and (!$_POST[user_password]=="")) {
header("Location: listing23.7.php");
exit;
echo "point1";
//connect to server and select database
$conn = mysql_connect("localhost", "XXXXXX", "XXXXXXXX") or die(mysql_error());
mysql_select_db("db_new1",$conn) or die(mysql_error());
echo "point2";
//create and issue the query
$sql = "select username, user_password from phpbb_users where username = '$_POST[username]' AND user_password = password('$_POST[user_password]')";
$result = mysql_query($sql,$conn) or die(mysql_error());
echo"point3";
//get the number of rows in the result set; should be 1 if a match
if (mysql_num_rows($result) == 1) {
echo"point4";
//if authorized, get the values of username
$username = mysql_result($result, 0, 'username');
echo"point5";
//set authorization cookie
setcookie("auth", "1", 0, "/", "goldcountrymini.com", 0);
echo"point6";
//prepare message for printing, and user menu
$msg = "<P>$username is authorized!</p>";
$msg .= "<P>Authorized Users' Menu:";
$msg .= "<ul><li><a href=http://www.goldcountrymini.com>secret page</a></ul>";
echo"point7";
?>
<HTML>
<HEAD>
<TITLE>Listing 23.8</TITLE>
</HEAD>
<BODY>
<? print "$msg"; ?>
</BODY>
</HTML>