login page
Posted: Sun Oct 09, 2005 6:28 pm
im not sure why this one wont work
it's giving me this error
Code: Select all
<?PHP # login.php page
if(isset($_POST['submit'])) {
$dbh=mysql_connect ("localhost", "root", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("content");
function escape_data($data) {
global $dbc;
if (ini_get('magic_quotes_gpc')) {
$data = stripslashes($data);
}
return mysql_real_escape_string($data, $dbc);
}
$message = NULL;
if (empty($_POST['username'])) {
$u = FALSE;
$message .= '<p class=\'text\'>You forgot to enter your username!</p>';
} else {
$u = escape_data($_POST['username']);
}
$message = NULL;
if (empty($_POST['password'])) {
$p = FALSE;
$message .= '<p class=\'text\'>You forgot to enter your password!</p>';
} else {
$p = escape_data($_POST['password']);
}
if ($u && $p) {
$query = "SELECT * FROM users WHERE username='$u' AND password=PASSWORD('$p')";
$result = @mysql_query ($query);
$row = mysql_fetch_array($result, MYSQL_NUM);
if ($row) {
session_start();
$SESSION['name'] = $row[name];
$SESSION['userid'] = $row[userid];
header ('Location: http://www.vividgamers.com/sessions/index.php');
exit;
}
echo '<form action=\'index.php\' method=\'post\'>';
echo '<table width=\'455\' cellpadding=\'0\' cellspacing=\'0\' border=\'0\' class=\'header1\'>';
echo '<tr>';
echo '<th colspan=\'2\' height=\'20\' class=\'header2\'>User Info:</th>';
echo '</tr>';
echo '<tr>';
echo '<td valign=\'middle\' width=\'163\' class=\'header8\'>Username:</td>';
echo '<td valign=\'middle\' class=\'header8\'><input maxlength=\'50\' class=\'text3\' type=\'text\' name=\'name\'></td>';
echo '</tr>';
echo '<tr>';
echo '<td valign=\'middle\' width=\'163\' class=\'header9\'>Passwords:</td>';
echo '<td valign=\'middle\' class=\'header9\'><input maxlength=\'16\' class=\'text3\' type=\'password\' name=\'pwd\'></td>';
echo '</tr>';
echo '<tr>';
echo '<th colspan=\'2\' height=\'20\' class=\'header2\' style=\'border-bottom: 1px solid black;\'><input class=\'text3\' type=\'submit\' value=\'Login!\'></th>';
echo '</tr>';
echo '</table>';
echo '</form>';
?>there isnt even a '$' on line 56 which is the last line on there btwParse error: parse error, unexpected $ in /home/rootbee/public_html/site/sessions/login.php on line 56