Posted: Mon Oct 16, 2006 11:22 am
strange.
Maybe more debug output is helpful(printf/echo debuggers are awful, but anyway
)
Maybe more debug output is helpful
Code: Select all
<?php
//Initiates php script containing functions all common functions
session_start();
require_once('common.php');
$dbconnect = db_connect();
//outputs header info to brower with the following title
echo xhtmlheader('Personal Account Registration Form');
//outputs the main navigation bar to the browser
echo topnav_pa();
if (isset($_POST['email']) && isset ($_POST['pwd']))
{
//if the user has just tried to log in
$email = $_POST['email'];
$pwd = $_POST['pwd'];
$sql = "select * from Authourised_User where userEmail='$email' and userPassword='$pwd'";
echo '<div>Debug: ', date('d.M Y H:i:s'), "</div>\n"; flush();
echo '<div>Debug: ', gettype($dbconnect), "</div>\n"; flush();
echo '<div>Debug: ', htmlentities($sql), "</div>\n"; flush();
$result=$dbconnect->query($sql);
echo '<div>Debug: ', gettype($result), "</div>\n"; flush();
if ( !$result) {
echo '<div>error: ' , $dbconnect->error, "</div>\n"; flush();
}
else if ($result->num_rows >0 ) {
echo "<div>Debug: valid user $email </div>\n"; flush();
$_SESSION['valid_user'] = $email;
}
else {
echo "<div>Debug: invalid user</div>\n"; flush();
}
$dbconnect->close();
}
?>
<!-- main body of page -->
<div id="main">
<h1>My Pub Crawl Planner</h1>
<?php
if (isset($_SESSION['valid_user']))
{
echo 'You are logged in as: '.$_SESSION['valid_user'].' <br />';
echo '<a href="logout.php">Log out</a><br />';
}
else
{
if (isset($email))
{
// if they've tried and failed to log in
echo 'Could not log you in.<br />';
}
else
{
// they have not tried to log in yet or have logged out
echo 'You are not logged in.<br />';
}
}
?>
<p>Member Login </p>
<form action="index.php" method="post" class="login"> /****form action *****/
<table>
<tr>
<td>E-mail:</td>
<td class="table"> <input type="text"
name="email"
value=""
tabindex="1"/></td>
</tr>
<tr>
<td>Password:</td>
<td class="table"> <input type="text"
name="pwd"
value=""
tabindex="2"/></td>
</tr>