I did not…thanks. Been kind of busy at work and not posting a lot. I tried a few new things and I’ll post them to update everyone.
Here is the validation form for the admin login:
[php]<?php
session_start();
include ("…login.php");
login();
$userid = $_POST[‘userid’];
$password = $_POST[‘password’];
$query = “SELECT * from admins where userid = ‘$userid’ and password = (’$password’)”;
$result = mysql_query($query);
if (mysql_num_rows($result) == 0)
{
echo “
Sorry, your account was not validated.
\n”;
echo “<a href=“admin.php”>Try again
\n”;
} else
{
$_SESSION[‘store_smalladmin’] = $userid;
//THE NEXT LINE DIRECTS SUCCESSFUL LOGINS WHERE TO GO NEXT, IN THIS CASE TO THE ADMIN PAGE
//This function must appear before any HTML code is sent to the browser.
//You can’t have any echo statements before the header() function.
header(“Location: admin.php”);
}
?>[/php]
As you can see, the cookie is set holding the userid. Here is the page that is referred to after login:
[php]<?php
session_start();
?>
<?php
if (!isset($_REQUEST['content']))
{
if (!isset($_SESSION[‘store_admin’])) |
I’m having an error that states that the ‘nextpage’ is not defined. I’ve included a page that is referenced in the above page that may or may not have something to do with it. It’s the showproducts3 page that is referenced:
[php]<?php
function showproducts3($custid, $page, $currentpage, $newpage)
{
$query = “Select count(prodid) from products where custid = $custid”;
$result = mysql_query($query);
$row = mysql_fetch_array($result);
if ($row[0] == 0)
{
echo “
Sorry, there are no entrees in this category
\n”;}
else
{
$thispage = $page;
$recordsperpage = 5;
$offset = ($thispage - 1) * $recordsperpage;
$totpages = ceil($totrecords / $recordsperpage);
echo "<table width=\"100%\" cellpadding=\"1\" border=\"1\">\n";
echo "<tr><td><h2>Image</h2></td>\n";
echo "<td><h2>Name</h2></td>\n";
echo "<td><h2>Price</h2></td>\n";
echo "<td><h2>Store </h2></td>\n";
echo "<td><h2>Phone</h2></td>\n";
echo "<td><h2>Description</h2></td>\n";
echo "<td><h2>Special</h2></td></tr>\n";
$query = "SELECT * from products WHERE custid=$custid LIMIT $offset,$recordsperpage";
$result = mysql_query($query);
while($row=mysql_fetch_array($result, MYSQL_ASSOC))
{
//not really concerned with this area right now as these below can change
$custid = $row[‘custid’];
$prodid = $row[‘prodid’];
$description = $row[‘description’];
$price = $row[‘price’];
$name = $row[‘name’];
$onsale = $row[‘onsale’];
echo "<tr><td>\n";
echo "<img src=\"showimage.php?id=$prodid\" width=\"80\" height=\"60\">";
echo "</td><td>\n";
echo "<b><a href=\"$newpage&id=$prodid\">$name\n</b>";
echo "</td><td>\n";
echo "$" . $price . "\n";
echo "</td><td>\n";
echo "<a href=\"index.php?&content=showstoreinfo&custid=$custid\">";
echo "<font size=\"2\"><u>$storename</u></font>\n";
echo "</td><td>\n";
echo $phone . "\n";
echo "</td><td>\n";
echo $description . "\n";
echo "</td><td>\n";
if ($onsale)
echo "On sale!\n";
else
echo " \n";
}
echo "</table>\n";
// Code to implement paging
if ($thispage > 1)
{
$page = $thispage - 1;
$prevpage = “<a href=”$currentpage&custid=$custid&page=$page">Previous page";
} else
{
$prevpage = " ";
}
if ($thispage < $totpages)
{
$page = $thispage + 1;
$nextpage = "<a href=\"$currentpage&custid=$custid&page=$page\">Next page</a>";
} else
{
$nextpage = " ";
}
if ($totpages > 1)
echo $prevpage . " " . $nextpage;
}
}
?>[/php]
The error says that next page is not defined…?
Thanks for any help.