Sayfaya güvenlik için şu şekilde bi giriş koydum çalışıyor fakat sürekli hata veriyor
error_log
[18-Dec-2010 18:32:14] PHP Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/xxxxx/public_html/rehber/index.php on line 145
index.php içeriği
<?php
$ourLogin = "altan";
$ourPassword = "101010";
session_start();
if ($_SESSION['login']!=$ourLogin && $_SESSION['password']!=$ourPassword) {
if ($_POST['login']==$ourLogin && $_POST['password']==$ourPassword) {
$_SESSION['login'] = $_POST['login'];
$_SESSION['password'] = $_POST['password'];
header("Location: index.php");
}
else {
echo "
<form action=index.php method=post>
Login:<br>
<input type=text name=login value=''><br>
Password:<br>
<input type=password name=password value=''><br>
<input type=submit value=Giriş >
</form>
";
exit;
}
}
?> <?php include("ayar.php");?>
<?php
$ara = $_POST['veri'];
$secim = $_POST['select'];
if($secim == "no") {
$anahtar = "OgrNo";
}elseif($secim == "sinif"){
$anahtar = "SinifNo";
}elseif($secim == "adi"){
$anahtar = "Ad";
}elseif($secim == "soyadi"){
$anahtar = "Soyad";
}
$sorgu = mysql_query("select * from deneme2 WHERE ".$anahtar." LIKE '%".$ara."%'");
?>
<!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=iso-8859-9" />
<title>Telefon Rehberi</title>
<style type="text/css">
<!--
.style1 {font-weight: bold}
.style2 {font-weight: bold}
body {
background-image: url(arka2.png);
}
a:link {
color: #FFFFFF;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #FFFFFF;
}
a:hover {
text-decoration: none;
color: #FFFFFF;
}
a:active {
text-decoration: none;
color: #FFFFFF;
}
-->
</style>
</head>
<body><table align="center">
<form id="form1" name="form1" method="post" action="#">
<table width="1278" border="0" align="center">
<tr align="center">
<th width="346" scope="col"><div align="center">
<div align="right">
<input type="text" name="veri" />
<select name="select">
<option value="adi" selected="selected">Adı</option>
<option value="soyadi">Soyadı</option>
<option value="sinif">Sınıf</option>
<option value="no">No</option>
</select>
<input type="submit" name="Submit" value="Ara" />
</div>
</form><?php
$get = $_GET["id"];
?><a href="javascript:print('sayfa.php?id<?= $get; ?>' )">Yazdır</a>
</th>
<th width="922" scope="col"></th>
</tr>
</table>
<table width="1070" border="1" align="center">
<tr>
<th width="44" bgcolor="#CCCCCC" scope="col"> No </th>
<th width="47" bgcolor="#CCCCCC" scope="col">Sınıf </th>
<th width="143" bgcolor="#CCCCCC" scope="col"> Adı </th>
<th width="95" bgcolor="#CCCCCC" scope="col">Soyadı</th>
<th width="120" bgcolor="#CCCCCC" scope="col">Telefon No </th>
<th width="120" bgcolor="#CCCCCC" scope="col">Mobil No </th>
<th width="119" bgcolor="#CCCCCC" scope="col">Anne Mobil </th>
<th width="91" bgcolor="#CCCCCC" scope="col">Anne Adı </th>
<th width="120" bgcolor="#CCCCCC" scope="col">Baba Mobil </th>
<th width="107" bgcolor="#CCCCCC" scope="col">Baba Adı </th>
</tr>
<?php
while($veri = mysql_fetch_assoc($sorgu)){?>
<tr>
<th height="2" bgcolor="#FFFFFF" scope="row"><?php echo $veri[OgrNo]; ?></th>
<td bgcolor="#FFFFFF"><?php echo $veri[SinifNo]; ?></td>
<td bgcolor="#FFFFFF"><?php echo $veri[Ad]; ?></td>
<td bgcolor="#FFFFFF"><?php echo $veri[Soyad]; ?></td>
<td bgcolor="#FFFFFF"><?php echo $veri[Tel]; ?></td>
<td bgcolor="#FFFFFF"><?php echo $veri[Mobil]; ?></td>
<td bgcolor="#FFFFFF"><?php echo $veri[AnneMobil]; ?></td>
<td bgcolor="#FFFFFF"><?php echo $veri[AnneAd]; ?></td>
<td bgcolor="#FFFFFF"><?php echo $veri[BabaMobil]; ?></td>
<td bgcolor="#FFFFFF"><?php echo $veri[BabaAd]; ?></td>
</tr>
<?php } ?>
</table>
</body>
</html>
hata olduğunu bildirilen satır
while($veri = mysql_fetch_assoc($sorgu)){?>