Jump to content

problem in loading pages


narjis

Recommended Posts

I am opening my pages but they do not open and an error comes of problem in loading pages.

Here is the code

<?php
session_start();
if(!isset($_SESSION['manager']))
{
header("Location: admin_login.php");
exit();
}
//Be sure to check this manager session value exist in the database
$id = preg_replace('#[^0-9]#','',$_SESSION['id']);
$manager = preg_replace('#[^a-zA-Z0-9]#','',$_SESSION['manager']);
$password =preg_replace('#[^a-zA-Z0-9]#','',$_SESSION['manager']);
include'../storescripts/connect_to_database.php';
$sql = mysql_query("SELECT * FROM admin WHERE id='$id' AND username='$manager' AND password='$password' LIMIt 1");
$exist = mysql_num_rows($sql);
if($exist==0){
echo "Your login account does not exist";
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>E-Commerce website admin Area</title>
<link rel="stylesheet" type="text/css" href="../css/default.css"/>
</head>

<body>
<div id="mainWrapper">

<?php include_once('../templateHeader.php');?>
<div 
align="left"  style="margin-left:24px" id="content">
<h2> Hello manager what would you like to do today</h2>
<p><a href="inventory.php">Manage Inventory</a></p>
<p>Manage Blah blah blah</p>

</div>
<?php include_once('../templateFooter.php');?>

</div>
</body>
</html>
<?php
session_start();
if(!isset($_SESSION['manager']))
{
header("Location: admin_login.php");
exit();
}
?>
<?php
if((isset($_SESSION['username']))&&(isset($_SESSION['password'])))
{
//Be sure to check this manager session value exist in the database
$id = preg_replace('#[^0-9]#','',$_SESSION['id']);
$manager = preg_replace('#[^a-zA-Z0-9]#','',$_SESSION['username']);
$password =preg_replace('#[^a-zA-Z0-9]#','',$_SESSION['password']);
include'../storescripts/connect_to_database.php';
$sql = mysql_query("SELECT * FROM admin WHERE id='$id' AND username='$manager' AND password='$password' LIMIt 1");
$exist = mysql_num_rows($sql);
if($exist==1){
while($row=mysql_fetch_array($sql)){
$id=$row['id'];
}
$_SESSION['manager']=$username;
$_SESSION['password'] = $password;
header("Location: index.php");
exit();
}
else{
	echo "That information is incorrect, try again by clicking<a href=\"index.php\">here </a>";
} 
}
?>
<!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>E-Commerce website admin Area</title>
<link rel="stylesheet" type="text/css" href="../css/default.css"/>
</head>

<body>
<div id="mainWrapper">

<?php include_once('../templateHeader.php');?>
<div 
align="left"  style="margin-left:24px" id="content">
<h2> Login Here</h2>
<table width="529" border="1" style="margin-left:24px">
  <tr>
    <form id="form1" name="form1" method="post" action="admin_login.php">
     <td>Enter name  </td>    
    <td><input name="username" type="text" id="username" maxlength="50" /></td>
  </tr>
  <tr>
    <td>Enter password </td>
    <td><input type="password" name="password" id="password" /></td>
  </tr>
  <tr>
    <td colspan="2"><form id="form2" name="form2" method="post" action="">
      <input type="submit" name="button" id="button" value="LogIn" />
    </form></td>
    </tr>
</table>
<p> </p>
</div>
<?php include_once('../templateFooter.php');?>
</div>
</body>
</html>

I am not getting where I am going wrong

Link to comment
https://forums.phpfreaks.com/topic/239126-problem-in-loading-pages/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.