PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?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>
Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
If you think this is a server error, please contact the webmaster.
Error 404
(and the php return error and page not found) when i hit submit
Notice: Trying to get property of non-object in /home/unn_p921847/public_html/index.php on line 24
404 is an error the webserver sends: there is no document/object at the requested url. Notice: Trying to get property.... that's a message sent by php.
edit: just tried your link
garry27 wrote:and removing the css style functions:
When I press "login" the url http://www.nl-webspace.co.uk/~unn_p9218 ... 50230i8u15 is requested.
there's no ? between index.php and PHPSESSID=
Therefore the brwser requests the document index.phpPHPSESSID=jup2lmb0d3hb9hua50230i8u15
not the document index.php, sending the GET parameter PHPSESSID=jup2lmb0d3hb9hua50230i8u15
Last edited by volka on Mon Oct 16, 2006 11:45 am, edited 1 time in total.
In the future, can you please not post information related to the login creentials of your database? This is more for your security than anything. Thanks.