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="CheckLo gin.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="searchRe ports">
<table cellpadding="5" cellspacing="5" >
<tr>
<td>Customer Number:</td>
<td colspan="3"><in put class="taskedit _tf" size="20" name="customer" /></td>
</tr>
<tr>
<td>Password: </td>
<td colspan="3"><in put class="taskedit _tf" size="20" name="password" /></td>
</tr>
<tr>
<td colspan="3"><in put 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.ph p";
$customer=$_POS T['customer'];
$password=$_POS T['password'];
$sql = "SELECT * from customer where bla bla....";
$result=mysql_q uery($sql);
// Mysql_num_row is counting table row
$count=mysql_nu m_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_registe r("customer") ;
session_registe r("password") ;
header("locatio n:Search.php?") ;
}
else {
if(!session_is_ registered("cus tomer")){
header("locatio n: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
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="CheckLo gin.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="searchRe ports">
<table cellpadding="5" cellspacing="5" >
<tr>
<td>Customer Number:</td>
<td colspan="3"><in put class="taskedit _tf" size="20" name="customer" /></td>
</tr>
<tr>
<td>Password: </td>
<td colspan="3"><in put class="taskedit _tf" size="20" name="password" /></td>
</tr>
<tr>
<td colspan="3"><in put 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.ph p";
$customer=$_POS T['customer'];
$password=$_POS T['password'];
$sql = "SELECT * from customer where bla bla....";
$result=mysql_q uery($sql);
// Mysql_num_row is counting table row
$count=mysql_nu m_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_registe r("customer") ;
session_registe r("password") ;
header("locatio n:Search.php?") ;
}
else {
if(!session_is_ registered("cus tomer")){
header("locatio n: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
Comment