Jump to content

trying to create a log in admin form


zeusthegreat

Recommended Posts

but as i am coding i keep getting errors in my page highlightinging the code in red

 

the editor i am using is dreamweaver

 

 

and the page that i have done 3 times now all with the same results is as follows

 

i have called the page admin_login.php

 

<?php

session_start();

if(!isset($_SESSION["manager"])){

header("location: admin_login.php");

exit();

}

// Be sure to check that this manager SESSION value is in fact in the database

 

$managerID = preg_replace('#[^0-9]#i',",$_SESSION["id"]); //filter everyhting but numbers and letters

$manager = preg_replace('#[^A_Za-z0-9]#i',",$_SESSION["manager"]); //filter everything but numbers and letters

$password = preg_replace('#[^A_Za-z0-9]#i',",$_SESSION["password"]); //filter everything but numbers and letters

//Run mySQL query to be sure that this person is an admin and that their password session varequals the database information

//Connect to the MySQL database

include "../storescripts/connect_to_mysql.php";

$sql= mysql_query("SELECT * FROM admin WHERE id='$managerID'AND username='$manager' AND password='$password' LIMIT 1"); //query the person --make sure person exists in database----

$existCount= mysql_num_rows($sql); //count the row nums

if($existCount==0){ //evaluate the count

header("location: ../index.php);

exit();

}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>astore admin area</title>

<link rel="stylesheet" href="../sytle/style.css" type="text/css" media="screen" />

 

<style type="text/css">

a:link {

text-decoration: none;

}

a:visited {

text-decoration: none;

}

a:hover {

text-decoration: none;

}

a:active {

text-decoration: none;

}

</style>

</head>

 

<body>

<div align="center" id="mainwrapper">

<?php include_once("../template-header.php"); ?>

</div>

<div id="pagesidebar">

<div align="center">TEST</div>

</div>

<div id="pagecontent">

<div align="center">

<div align="left" style="margin-left:24px;">

<h2>Hello store manager, what would you like to do today?</h2>

<p><a href="inventory_list.php">Manage Inventory</a></p>

<p><a href="#">Manage Blah Blah Blah</a></p>

</div>

TEST</div>

</div>

<div align="center">

<?php include_once("../template-footer.php"); ?>

</div>

</div>

</body>

</html>

Link to comment
Share on other sites

You do have a couple errors:

 

-- In the three preg_replace() lines, you are missing a second quote: $managerID = preg_replace('#[^0-9]#i',"",$_SESSION["id"]); (make sure you add the second quote to all three lines)

 

-- In the header() line, you are also missing a closing quote: header("location: ../index.php");

 

These are the only things I see at first glance, at least.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...