giris.php
<?php
if (!$hata =="") {
echo "<font face=\"verdana\" size=\"2\" color=\"#800000\"><b>Giriş Sırasında Hata Oluştu</b><br>";
echo "Şifre veya Kullanıcı Adı Yanlış. Tekrar Deneyin<br>";
}
?>
<form action="giris_tamamla.php" method="post">
<table width="100%">
<tr>
<td width="35%" bordercolor="#99CCFF">Kullanıcı Adı :</td>
<td width="65%" bordercolor="#99CCFF"><span style="color: navy; border-style: none; background-color: silver">
<input type="text" name="user" id="user" size="20">
</span></td>
</tr>
<tr>
<td bordercolor="#99CCFF">Şifre :</td>
<td bordercolor="#99CCFF"><span style="color: navy; border-style: none; background-color: silver">
<input type="password" name="sifre" is="sifre" size="20">
</span></td>
</tr>
<tr>
<td bordercolor="#99CCFF"> </td>
<td bordercolor="#99CCFF"><label>
<input type="submit" name="submit" id="submit" value="Giriş">
</label></td>
</tr>
</table>
</form>giris_tamamla.php<?php
$user = $_POST['user'];
$sifre = $_POST['sifre'];
if ((!$user =="") and (!$sifre =="")) {
include("ayar.php");
$sql = "select * from yonetici where user='$user' and sifre='$sifre' ";
$kontrol = mysql_query($sql);
$kayitsayisi = mysql_num_rows($kontrol);
if ($kayitsayisi == "0") {
header ("Location: giris.php?hata=yes");
} else {
$kontrol_ok = mysql_fetch_array($kontrol);
setcookie ("kullanici", "$kontrol_ok[user]");
header ("Location: yonetici.php");
}
}
else {
header ("Location: giris.php?hata=yes");
}
?>