Merhaba arkadaslar ben yeni php baslangictayim ve yardim istedigim konu ise buradaki hata bir turlu log in olamiyorum . Yardiminiz icin tesekkurler simdiden .yanlis nedir cozemiyorum sadece admin login e gelince tekrardan ana sayfa gibi gosteriyor. hic bir farki olmuyor onceden cok tesekkurler
admin login <?php session_start(); if(!isset($_SESSION["manager"])){ header("location:index.php"); exit(); } ?> <?php //be sure the check that this manager SESSION value is in fact in the database if(isset($_POST["username"])&& isset($_POST["password"])){
<?php session_start(); if(!isset($_SESSION["manager"])){ header("location:admin_login.php"); exit(); } //be sure the check that this manager SESSION value is in fact in the database $managerID = preg_replace('#[^0-9]#i','', $_SESSION["id"]); $manager = preg_replace('#[^A-Za-z0-9]#i','', $_SESSION["manager"]); $password = preg_replace('#(^A-Za-z0-9]#i','', $_SESSION["password"]);
include "../storescripts/connect_to_mysql.php"; $sql = mysql_query("SELECT*FROM admin WHERE id = '$managerID' AND username ='$manager' AND password='$password' LIMIT 1"); $existCount = mysql_num_rows($sql); if($existCount==0) { header("location:../index.php"); echo "Your login session data is not on record in the database", exit(); }
admin login
<?php
session_start();
if(!isset($_SESSION["manager"])){
header("location:index.php");
exit();
}
?>
<?php
//be sure the check that this manager SESSION value is in fact in the database
if(isset($_POST["username"])&& isset($_POST["password"])){
$manager = preg_replace('#[^A-Za-z0-9]#i','',$_POST["username"]);
$password = preg_replace('#[^A-Za-z0-9]#i','',$_POST["password"]);
include "../storescripts/connect_to_mysql.php";
$sql = mysql_query("SELECT id FROM admin WHERE username ='$manager' AND password = '$password' LIMIT 1");
$existCount = mysql_num_rows($sql);
if($existCount==1) {
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
}
$_SESSION["id"] = $id;
$_SESSION["manager"] = $manager;
$_SESSION["password"] = $password;
header("location:index.php");
exit();
}else{
echo 'That informaton is incorrect,try again <a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=59141184&url=index.php" data-href="index.php">Click Here</a>';
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>Admin Log In</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")?>
<div id="pageContent">
<div align="left"style="margin-left:24 px;">
<h2> Please Log In To Manage the Store</h2>
<form id = "form1" name= "form1" method = "post" action="admin_login.php">
User Name <br />
<input name = "username" type = "text" id = "username" size = "40"/>
<br/><br/>
Password:<br/>
<input name ="password" type = "password" id = "password" size = "40" />
<br/>
<br/>
<br/>
<label>
<input type ="submit" name = "button" id = "button" value="Log In"/>
</label>
</form>
<p> </p>
</div>
<br/>
<br/>
<br/>
</div>
)
<?php include_once("../template_footer.php");?>
</div>
</body>
</html>
index.php
<?php
session_start();
if(!isset($_SESSION["manager"])){
header("location:admin_login.php");
exit();
}
//be sure the check that this manager SESSION value is in fact in the database
$managerID = preg_replace('#[^0-9]#i','', $_SESSION["id"]);
$manager = preg_replace('#[^A-Za-z0-9]#i','', $_SESSION["manager"]);
$password = preg_replace('#(^A-Za-z0-9]#i','', $_SESSION["password"]);
include "../storescripts/connect_to_mysql.php";
$sql = mysql_query("SELECT*FROM admin WHERE id = '$managerID' AND username ='$manager' AND password='$password' LIMIT 1");
$existCount = mysql_num_rows($sql);
if($existCount==0) {
header("location:../index.php");
echo "Your login session data is not on record in the database",
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>Store Admin Page</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")?>
<div id="pageContent">
<div align="left"style="margin-left:24 px;">
<h2> Hello Store Manager What would you like to do today?</h2>
<p><a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=59141184&url=inventory_list.php" data-href="inventory_list.php">Manage Inventory</a></p>
<p><a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=59141184&url=#" data-href="#">Manage Blah Blah</a></p>
</div>
<br/>
<br/>
<br/>
</div>
Copyright
</div>
</body>
</html>