Hello all,
I have 2 files. index.php which is a log in page and a search page. After the user logs in they are taken to the search page by way of a checklogin script that verifies the user.
My index page has two fields:
customer
password
Here are the contents of both of my files. I'm sure I am missing something here but 4 hours later and I am stll in the same place.
index.php
[PHP]
<?php session_start(); ?>
</head>
<body>
<form method="post" action="CheckLogin.php">
<div style="text-align: left;">
<table style="margin: 0 auto;">
<tr>
<td><!-- start of dfar body -->
<table class="table">
<tr>
<td><img src="images/logo.gif" alt="" /></td>
</tr>
<tr>
<td><hr /></td>
</tr>
<tr>
<td align="center"><h4>Client Login</h4></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td class="searchReports">
<table cellpadding="5" cellspacing="5">
<tr>
<td>Customer Number:</td>
<td colspan="3"><input class="taskedit_tf" size="20" name="customer" /></td>
</tr>
<tr>
<td>Password:</td>
<td colspan="3"><input class="taskedit_tf" size="20" name="password" /></td>
</tr>
<tr>
<td colspan="3"><input type="image" src="images/query.gif" /></td>
<td><?php echo @$_SESSION['loginerr']; ?></td>
</tr>
</table>
</td>[/PHP]
search.php
[PHP]
<?php session_start(); ?>
<?php echo $customer; ?>
[/PHP]
checklogin.php
[PHP]
<?php
session_start();
ob_start();
include "Persist.php";
$customer=$_POST['customer'];
$password=$_POST['password'];
$sql = "SELECT * from customer where bla bla....";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $employee and $password, table row must be 1 row
if($count==1){
// Register $employee, $password and redirect to file "Search.php"
session_register("customer");
session_register("password");
header("location:Search.php?");
}
else {
if(!session_is_registered("customer")){
header("location:index.php");
}
$_SESSION['loginerr'] = "Incorrect Password";
}
ob_end_flush();
?>
[/PHP]
Can someone please shed some light as to what I need to do to pass the customer number from the checklogin script to the search page?
Thanks!!
Frank