Jump to content

Recommended Posts

Hi, so....i have these 2 pages, but they don't show up in browser....can't find the error so will ask your help guys

 

index.php

<?php
session_start();
if(!isset($_SESSION["manager"])){
header("Location: admin_login.php");
exit();
}
//Be sure to check that manager SESSION value is in database
$managerID = preg_replace('#[^0-9]#i',",$_SESSION["id"]); // Filter everything 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 var equals the database
//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"); //search user
$existsCount = mysql_num_rows($sql); //count the row numbers
if ($existsCount == 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>MyOnlineStore | Admin Area</title>
<link rel="stylesheet" href="../style/style.css" type="text/css" media="screen"/>
</head>

<body>
<div align="center" id="mainWrapper">
  <?php include_once("../template_header.php");?>
  <p><br  />
    <br />
  </p>
  <p> </p>
  <p><br />
  </p>
  <div id="pageContent">
    <div id="admin" align="left">
      <h3>Hello what you want to do?</h3>
      <p><a href="#">Manage Inventory</a><br />
      <a href="#">Manage afggagdfag</a></p>
</div>
</div>
<?php include_once("../template_footer.php");?>
</div>
<p> </p>
<p> </p>
<p> </p>
</body>
</html>

 

 

admin_login.php

<?php
session_start();
if(!isset($_SESSION["manager"])){
header("Location: admin_login.php");
exit();
}
//Be sure to check that manager SESSION value is in database
$managerID = preg_replace('#[^0-9]#i',",$_SESSION["id"]); // Filter everything 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 var equals the database
//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"); //search user
$existsCount = mysql_num_rows($sql); //count the row numbers
if ($existsCount == 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>MyOnlineStore | Admin Area</title>
<link rel="stylesheet" href="../style/style.css" type="text/css" media="screen"/>
</head>

<body>
<div align="center" id="mainWrapper">
  <?php include_once("../template_header.php");?>
  <p><br  />
    <br />
  </p>
  <p> </p>
  <p><br />
  </p>
  <div id="pageContent">
    <div id="admin" align="left">
      <h3>Hello what you want to do?</h3>
      <p><a href="#">Manage Inventory</a><br />
      <a href="#">Manage afggagdfag</a></p>
</div>
</div>
<?php include_once("../template_footer.php");?>
</div>
<p> </p>
<p> </p>
<p> </p>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/225985-pages-dont-load/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.