ürün tek diye düşünmemiştim o zaman bir de ürünler tablosu ekleyelim.
giriş işlemleri dosyaları aşağıdaki gibi
5 tane de dosya oluşturdum kullanıcı giriş ve sipariş verecek sayfa için
ayar.php
<?php
$host="localhost";
$db="chopper07";
$user="root";
$pass="123456";
$conn=@mysql_connect($host,$user,$pass) or die("Mysql Baglanamadi");
mysql_select_db($db,$conn) or die("Veritabanina Baglanilamadi");
mysql_set_charset('latin5',$conn);
?>index.php
<!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>Kullanıcı Giriş</title>
</head>
<body>
<form action="giris.php" method="POST">
<table align="center">
<tr>
<td>Kullanici Adi</td>
<td>:</td>
<td><input type="text" name="kadi"></td>
</tr>
<tr>
<td>Sifre</td>
<td>:</td>
<td><input type="password" name="sifre"></td>
</tr>
<tr>
<td></td>
<td></td>
<td><input type="submit" value="Giris"></td>
</tr>
</table>
</form>
</body>
</html>
giris.php
<?php
include("ayar.php");
ob_start();
session_start();
$kadi = $_POST['kadi'];
$sifre = $_POST['sifre'];
$sql_check = mysql_query("select * from uyeler where username='".$kadi."' and password='".$sifre."' ") or die(mysql_error());
if(mysql_num_rows($sql_check)) {
$_SESSION["login"] = "true";
$_SESSION["user"] = $kadi;
$_SESSION["pass"] = $sifre;
header("Location:panel.php");
}
else {
if($kadi=="" or $sifre=="") {
echo "<center>Lutfen kullanici adi ya da sifreyi bos birakmayiniz..! <a href=javascript:history.back(-1)>Geri Don</a></center>";
}
else {
echo "<center>Kullanici Adi/Sifre Yanlis.<br><a href=javascript:history.back(-1)>Geri Don</a></center>";
}
}
ob_end_flush();
?>panel.php
<!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>Kullanici Panel</title>
</head>
<body>
<?php
include("ayar.php");
ob_start();
session_start();
if(!isset($_SESSION["login"])){
header("Location:index.php");
}
else {
echo "<center>Merhabalar sayfasina hosgeldiniz..! ";
echo "<a href=cikis.php>Çıkış Yap</a></center>";
}
?>
</body>
</html>cikis.php
<?php
session_start();
ob_start();
session_destroy();
echo "<center>Cikis Yaptiniz. Ana Sayfaya Yonlendiriliyorsunuz.</center>";
header("Refresh: 2; url=index.php");
ob_end_flush();
?>