...

View Full Version : Help: undefined variables



1BJK903
11-12-2011, 01:07 PM
Notice: Undefined variable: verified_user in C:\xampp\htdocs\besiktas\besiktas.php on line 6

Notice: Undefined index: verified_user in C:\xampp\htdocs\besiktas\besiktas.php on line 32

Notice: Undefined index: verified_kat in C:\xampp\htdocs\besiktas\besiktas.php on line 33

Notice: Undefined index: durum in C:\xampp\htdocs\besiktas\besiktas.php on line 34

Notice: Undefined index: kat in C:\xampp\htdocs\besiktas\besiktas.php on line 35

Notice: Use of undefined constant process - assumed 'process' in C:\xampp\htdocs\besiktas\besiktas.php on line 100

Notice: Undefined index: sayfa in C:\xampp\htdocs\besiktas\inc\today.php on line 39

Notice: Undefined variable: verified_user in C:\xampp\htdocs\besiktas\besiktas.php on line 6

Notice: Undefined variable: verified_user in C:\xampp\htdocs\besiktas\besiktas.php on line 6

Notice: Undefined index: verified_user in C:\xampp\htdocs\besiktas\besiktas.php on line 32

Notice: Undefined index: verified_kat in C:\xampp\htdocs\besiktas\besiktas.php on line 33

Notice: Undefined index: durum in C:\xampp\htdocs\besiktas\besiktas.php on line 34

Notice: Undefined index: kat in C:\xampp\htdocs\besiktas\besiktas.php on line 35

Notice: Use of undefined constant process - assumed 'process' in C:\xampp\htdocs\besiktas\besiktas.php on line 100

Notice: Undefined variable: q in C:\xampp\htdocs\besiktas\inc\word.php on line 8

Notice: Undefined variable: baslik in C:\xampp\htdocs\besiktas\inc\word.php on line 78

Deprecated: Function ereg_replace() is deprecated in C:\xampp\htdocs\besiktas\inc\word.php on line 78

Notice: Undefined variable: gid in C:\xampp\htdocs\besiktas\inc\word.php on line 82

These are the errors I get and it is very frustrating because I have tried everything to get it working. Posting this here is my last (and I guess my best) chance to get it to work.

This is besiktas.php


<?php
session_start();
ob_start();
include "inc/connect.php";

if ($verified_user) {
$sorgu1 = "SELECT * FROM user WHERE `nick` = '$verified_user'";
$sorgu2 = mysql_query($sorgu1);
$kayit2=mysql_fetch_array($sorgu2);
$tema=$kayit2["tema"];
if (!$tema)
$tema = "default";
}
else {
$tema = "default";
}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1254">
<SCRIPT src="images/top.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="images/sozluk.js"></SCRIPT>
<LINK href="favicon.ico" rel="shortcut Icon"><LINK href="favicon.ico" rel=icon>
<LINK href="images/sozluk.css" type=text/css rel=stylesheet>
<LINK href="images/<? echo $tema ?>.css" type=text/css rel=stylesheet>
</head>
<?php

$verified_user = $_SESSION['verified_user'];
$verified_kat = $_SESSION['verified_kat'];
$verified_durum = $_SESSION['durum'];
$kat = $_SESSION['kat'];

$user_ip = getenv('REMOTE_ADDR');
$sorgu1 = "SELECT ip FROM ipban WHERE `ip` = '$user_ip'";
$sorgu2 = mysql_query($sorgu1);
$kayit2=mysql_fetch_array($sorgu2);
$ip=$kayit2["ip"];
if ($ip and $verified_user != "yalowa")
header("Location: bakim.php");

$sorgu1 = "SELECT nick,durum FROM user WHERE `nick` = '$verified_user'";
$sorgu2 = mysql_query($sorgu1);
$kayit2=mysql_fetch_array($sorgu2);
$durum=$kayit2["durum"];
$nick=$kayit2["nick"];
if ($durum == "sus")
header ("Location: logout.php");

$sorgu1 = "SELECT * FROM ayar";
$sorgu2 = mysql_query($sorgu1);
mysql_num_rows($sorgu2);
$kayit2=mysql_fetch_array($sorgu2);
$site=$kayit2["site"];
$reg=$kayit2["reg"];
if ($site == "off" and $verified_kat == "admin" and $process != "top") {
echo "<font color=red>Uyarı!: Site şuan kapalı konumda.</font>";
}
if ($site == "tech" and $verified_kat == "admin" and $process != "top") {
echo "<font color=red>Uyarı!: Site şuan bakım konumunda.</font>";
}
if ($site == "off" and $verified_kat != "admin" and $process != "top") {
include "kapali";
die;
}
if ($site == "tech" and $verified_kat != "admin" and $process != "top") {
include "bakim.php";
die;
}

if ($verified_user) { // kontrol
$son_zaman = time() - 1800;
$sorgu = "DELETE FROM online WHERE islem_zamani < $son_zaman";
mysql_query($sorgu);
$simdikizaman = time();
if ($verified_kat == "admin") {
$gnick = "&$verified_user";
$sorgu = "UPDATE online SET islem_zamani=$simdikizaman WHERE nick='$gnick'";
mysql_query($sorgu);
}
else if ($verified_kat == "mod") {
$gnick = "+$verified_user";
$sorgu = "UPDATE online SET islem_zamani=$simdikizaman WHERE nick='$gnick'";
mysql_query($sorgu);
}
else if ($verified_kat == "gammaz") {
$gnick = "$verified_user*";
$sorgu = "UPDATE online SET islem_zamani=$simdikizaman WHERE nick='$gnick'";
mysql_query($sorgu);
}
else {
$sorgu = "UPDATE online SET islem_zamani=$simdikizaman WHERE nick='$verified_user'";
mysql_query($sorgu);
}
} // kayitli online kont

$process=$_REQUEST[process];
if ($process) {
if ($process == "privmsg" and !$verified_user) {
Header ("Location: logout.php");
die;
}

if ($process == "cp" and !$verified_user) {
Header ("Location: logout.php");
die;
}

if ($process == "add" and !$verified_user) {
Header ("Location: logout.php");
die;
}
if ($process == "adm" and !$verified_user) {
Header ("Location: logout.php");
die;
}

if ($process == "msjoku" and !$verified_user) {
Header ("Location: logout.php");
die;
}

if ($process == "msjana" and !$verified_user) {
Header ("Location: logout.php");
die;
}

if ($process == "yenimsj" and !$verified_user) {
Header ("Location: logout.php");
die;
}
if ($process == "adm" and !$verified_user) {
Header ("Location: logout.php");
die;
}

if ($process == "onlines" and !$verified_user) {
Header ("Location: logout.php");
die;
}

// echo $process;
if (file_exists("inc/$process.php"))
include "inc/$process.php";
else if (file_exists("adm/$process.php"))
include "adm/$process.php";
else
echo "
<LINK href=\"images/$tema.css\" type=text/css rel=stylesheet>
Bu bölüm geçici olarak servis dışı.";


if ($process == "word") {
echo "
<hr>
<div align=center>
<font size=1><a href='http://forum.olgarverim.com' target='_blank'>hazir sozluk v1.2.1</A><br>
caesar</div>
";
}

}
ob_end_flush();
?>

</html>

1BJK903
11-12-2011, 01:07 PM
This is word.php:



<?php

// getting id

// echo "baslik: $q";


$q = strtolower($q);

$kac = count($q);

$q = substr($q, 0, 80);

if ($verified_user) {
$listele = mysql_query("SELECT okundu,id FROM privmsg WHERE `kime`='$verified_user'");
while ($kayit=mysql_fetch_array($listele)) {
$okundu=$kayit["okundu"];
$id=$kayit["id"];
if ($okundu != 0) {
$okunmayan++;
}
if ($okundu == 2) {
$notice++;
$sorgu = "UPDATE privmsg SET okundu = '1' WHERE id= '$id'";
mysql_query($sorgu);
}

}
if ($okunmayan)
echo "<p align=right><a title=\"$okunmayan okunmayan hede var\" href=sozluk.php?process=privmsg><img src=images/new.gif alt=\"$okunmayan okunmayan hede var\"> ($okunmayan)</a></p>";
if ($notice)
echo "<SCRIPT>alert('$notice okunmayan mesajınız var.postahane bölümünden kontrol edebilirsiniz.');</SCRIPT>";
}

$sorgu = "SELECT * FROM konular WHERE `baslik`='$q'";
$sorgulama = mysql_query($sorgu);
if (mysql_num_rows($sorgulama)>0){
while ($kayit=mysql_fetch_array($sorgulama)){
###################### var ##############################################
$gid=$kayit["id"];
$tasi=$kayit["tasi"];
$baslik=$kayit["baslik"];
$statu=$kayit["statu"];
$baslik = ereg_replace("ş","s",$baslik);
$baslik = ereg_replace("Ş","S",$baslik);
$baslik = ereg_replace("ç","c",$baslik);
$baslik = ereg_replace("Ç","C",$baslik);
$baslik = ereg_replace("ı","i",$baslik);
$baslik = ereg_replace("İ","I",$baslik);
$baslik = ereg_replace("ğ","g",$baslik);
$baslik = ereg_replace("Ğ","G",$baslik);
$baslik = ereg_replace("ö","o",$baslik);
$baslik = ereg_replace("Ö","O",$baslik);
$baslik = ereg_replace("ü","u",$baslik);
$baslik = ereg_replace("Ü","U",$baslik);
$baslik = ereg_replace("Ö","O",$baslik);

$baslik = strtolower($baslik);

if ($statu == "silindi") {

if ($verified_kat != "admin" and $verified_kat != "mod") {
echo "<div class=dash><center><b><img src=images/unlem.gif> Bu baslik ucurulmus!";
die;
}

echo "<div class=dash><center><b><img src=images/unlem.gif> Bu baslik ucurulmus! Yönetici olduğunuz için bu başlığı görüyorsunuz.</a></center>";
}

}
}
$yazar = $verified_user;
// echo $gid;
// echo "<font size=6 face=Verdana>$yazar</font>";
// yakaladik


$link = ereg_replace(" ","+",$baslik);



$sorgu = "SELECT id,tarih,baslik FROM konular WHERE `id`=$gid";
$sorgulama = @mysql_query($sorgu);
if (@mysql_num_rows($sorgulama)>0){
//kayıtları listele
while ($kayit=@mysql_fetch_array($sorgulama)){
###################### var ##############################################
$id=$kayit["id"];
$konuid=$kayit["id"];
$baslik=$kayit["baslik"];
$tarih=$kayit["tarih"];

if ($verified_kat == "admin" or $verified_kat == "mod")
$baslikduzenle = "<a class=link> - </a><a class=div href=sozluk.php?process=adm&islem=baslikduzenle&id=$id><font color=green size=2 face=verdana>Düzenle</font></a>";


if ($verified_kat == "admin" or $verified_kat == "mod")
$basliksil = "<br><a class=div href=sozluk.php?process=adm&islem=baslikoldur&id=$id><font color=red size=2 face=verdana>Sil</font></a>";

if ($verified_kat == "admin" or $verified_kat == "mod")
$basliktasi = "<a class=link> - </a> <a class=div href=sozluk.php?process=adm&islem=basliktasi&id=$id><font size=2 face=verdana>Taşı</font></a>";


echo "
<meta name=\"keywords\" content=\"$baslik\">
<meta name=\"description\" content=\"$baslik\">
<title>$baslik</title>
<TABLE width=\"100%\">
<TBODY>
<TR>
<TD width=\"80%\" height=15>
<h1 class=\"title\"><A href=\"sozluk.php?process=word&q=$link\">$baslik</A></H1>$basliksil $baslikduzenle $basliktasi</FONT>
</TD>
</TR>
<tr>
<td align=right><input type='button' onclick=\"location.href='herzamanki.php';\" value='herzamanki' class='but'>
</tr>
</TBODY></TABLE>
";

if ($tasi) {
$link = ereg_replace(" ","+",$tasi);
echo "<center><a class=link><br><font color=red><b>$baslik -> $tasi</b></font><br><br>Bu başlık taşınmıştır.<br>Lütfen bekleyin.<br>Yönlendiriliyorsunuz..</a></center>
<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"2;URL=sozluk.php?process=word&q=$link\">
";
die;
}

}
}
else {
if (!$q) {
echo "<div class=dash><center><b><img src=images/unlem.gif> Müneccimmiyim ben ?";
exit;
}

if (!ereg("^([A-Za-z0-9]|[[:space:]])+$",$q)) {
echo "<p class=div1>Basliklarda;<br>sadece ingilizce harfler,<br>bosluk {space},<br>ve rakamlar bulunabilir.<br>Lütfen bu kurallara uygun bir baslik yazin.</p>";
exit;
}


echo "<div class=dash><center><font color=red size=2>$q</font><font size=2> diye bir konu yok ki?</font></div><br>";

mt_srand ((double)microtime()*1000000);
$banner = mt_rand(1, 4);


if ($verified_user) {
if ($verified_durum == "on")
echo "<form action=\"sozluk.php?process=add\" method=post>
<input type=hidden name=\"baslik\" value=\"$q\">
<input type=hidden name=\"okword\" value=\"$q\">
<input type=hidden name=okmsj value=ok>
<input type=submit class=but name=ac value=\"E madem yok ben açayım\">
</form>
";
}
exit;
}


// cevap write

if (!$ok) {
}
else {
$mesaj =@$HTTP_POST_VARS["mesaj"];
if (!$verified_user)
die;
if ($mesaj == "") {
echo "Mesaj icerigi yazman lazim ama.. :)";
exit;
}
else {

$site = $_SERVER["HTTP_REFERER"];
$site = explode("/", $site);
$site = $site[2];


if ($verified_durum == "off" or $verified_durum == "wait") {
$sorgu1 = "SELECT nick,online FROM user WHERE `nick` = '$yazar'";
$sorgu2 = mysql_query($sorgu1);
mysql_num_rows($sorgu2);
$kayit2=mysql_fetch_array($sorgu2);
$online=$kayit2["online"];
$nick=$kayit2["nick"];

if (!$online)
$online = 1;
else
$online++;

if ($online == "10") {
$sesdurum = "wait";
session_register("sesdurum");
$sorgu = "UPDATE user SET durum = 'wait' WHERE nick= '$verified_user'";
mysql_query($sorgu);
$sorgu = "UPDATE online SET ondurum = '$sesdurum' WHERE nick= '$verified_user'";
mysql_query($sorgu);
echo "<br><center>10 deneme entry girme hakkinizi doldurdunuz.Şuan entrylariniz yöneticiler tarafından inceleniyor.<br>
Uygun görülmesi halinde yazar olarak atanacaksınız sayın çaylak.<br></center>
";
$tarih = date("YmdHi");
$gun = date("d");
$ay = date("m");
$yil = date("Y");
$saat = date("H:i");

$konu = "<img src=images/unlem.gif> $verified_user onay bekliyor!";
$system = "SYSTEM";

$yazi = "$verified_user nickine ait entrylar:<br>";

$sorgu = "SELECT id,statu FROM mesajlar WHERE `statu`= 'wait' and `yazar` = '$verified_user'";
$sorgulama = @mysql_query($sorgu);
$sayyy = 0;
if (@mysql_num_rows($sorgulama)>0){
//kayıtları listele
while ($kayit=@mysql_fetch_array($sorgulama)){
###################### var ##############################################
$id=$kayit["id"];
$sayyy++;
$yazi .= "$sayyy- #$id <br>";
}
}

$kimegitcek = "yalowa";
$sorgu = "INSERT INTO privmsg ";
$sorgu .= "(kime,konu,mesaj,gonderen,tarih,okundu,gun,ay,yil,saat)";
$sorgu .= " VALUES ";
$sorgu .= "('$kimegitcek','$konu','$yazi','$system','$tarih','1','$gun','$ay','$yil','$saat')";
mysql_query($sorgu);
die;
}

if (!$online) { echo "<center><br><br>Çaylak olarak bu entry'iniz <b>ilk</b> deneme entry'iniz olarak kayitlara geçti."; }
else { echo "<center><br><br>Çaylak olarak bu entry'iniz <b>$online.</b> deneme entry'iniz olarak kayitlara geçti."; }

$sorgu = "UPDATE user SET online='$online' WHERE nick='$yazar'";
mysql_query($sorgu);
} // off

$tarih = date("YmdHi");
$gun = date("d");
$ay = date("m");
$yil = date("Y");
$saat = date("H:i");
$ip = getenv('REMOTE_ADDR');
if ($verified_durum == "off") {
$statu = "wait";
}
else {
$statu = "";
}
// db ye yaz
$mesaj = ereg_replace("<","(",$mesaj);
$mesaj = ereg_replace(">",")",$mesaj);
$mesaj = ereg_replace("\n","<br>",$mesaj);
$mesaj = strtolower($mesaj);

$sorgu = "INSERT INTO mesajlar ";
$sorgu .= "(sira,mesaj,yazar,ip,tarih,gun,ay,yil,saat,statu)";
$sorgu .= " VALUES ";
$sorgu .= "('$gid','$mesaj','$yazar','$ip','$tarih','$gun','$ay','$yil','$saat','$statu')";
mysql_query($sorgu);

if ($verified_durum != "off" and $verified_durum != "wait") {
$sorgu = "UPDATE konular SET tarih='$tarih' WHERE id='$gid'";
mysql_query($sorgu);
$sorgu = "UPDATE konular SET gun='$gun' WHERE id='$gid'";
mysql_query($sorgu);
$sorgu = "UPDATE konular SET ay='$ay' WHERE id='$gid'";
mysql_query($sorgu);
$sorgu = "UPDATE konular SET yil='$yil' WHERE id='$gid'";
mysql_query($sorgu);
}

mt_srand ((double)microtime()*1000000);
$banner = mt_rand(1, 4);


mt_srand ((double)microtime()*1000000);


mt_srand ((double)microtime()*1000000);
if ($verified_kat == "admin")
$sor = mysql_query("select id from mesajlar WHERE `sira`=$gid");
else if ($verified_durum == "wait" or $verified_durum == "off")
$sor = mysql_query("select id from mesajlar WHERE `sira`=$gid and `statu` = 'wait' or `statu` = '' ");
else
$sor = mysql_query("select id from mesajlar WHERE `sira`=$gid and `statu` = '' ");

$w = mysql_num_rows($sor);
$max = 20;
$goster = $w/$max;
$goster=ceil($goster);
if ($goster >1) {
$gostersayfa = "&sayfa=$goster";
}
echo "
<p><center><b>Entry'niz kayıt edilmiştir!</b><br>
<a href=\"sozluk.php?process=word&q=$baslik$gostersayfa\">devam!</a>
</font></a></b></center></p><br><br>
<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"7;URL=sozluk.php?process=word&q=$baslik$gostersayfa\">
<script language=\"javascript\">goUrl('sozluk.php?process=today','left');</script>";
exit;
} // if mesaj
} // else

// cevap /write


$max = 20;

if (!$_GET["sayfa"]) { $_GET["sayfa"]=1; }

$alt = ($_GET["sayfa"] - 1) * $max;

$say = 0;

if ($verified_kat == "admin")
$sor = mysql_query("select id from mesajlar WHERE `sira`=$gid");
else if ($verified_durum == "wait" or $verified_durum == "off")
$sor = mysql_query("select id from mesajlar WHERE `sira`=$gid and (`statu` = 'wait' or `statu` = '')");
else
$sor = mysql_query("select id from mesajlar WHERE `sira`=$gid and `statu` = '' ");

$w = mysql_num_rows($sor);

if ($sayfa and $sayfa != 1)
$say = ($sayfa -1) * $max;

$goster = $w/$max;
$goster=ceil($goster);

if ($goster > 1)
echo "<p align=center class=eol><font face=Verdana size=1>Sayfalar: ";

if ($goster >1) {

if ($sayfa >= 1 or !$sayfa) {
$linksayfa = $sayfa - 1;
if ($sayfa > 1 or $sayfa) {
if ($sayfa != 1)
echo "<a class=link href=\"?process=word&q=$q&sayfa=$linksayfa\"><font color=red face=verdana size=1><b><<</b></font></a> ";
}
}

echo "<SELECT class=ksel
onchange=\"jm('self',this,0);\" name=sayfa>";
for ($i=1;$i<=$goster;$i++) {
if ($sayfa == $i) echo "
<OPTION value=sozluk.php?process=word&q=$link&sayfa=$i selected>
$i</OPTION>";
else echo "
<OPTION value=sozluk.php?process=word&q=$link&sayfa=$i>
$i</OPTION>";
}
echo "</SELECT>";
}

if ($sayfa >= 1 or !$sayfa) {
if (!$sayfa)
$sayfa = 1;

$linksayfa = $sayfa + 1;

if ($linksayfa <= $goster)
echo " <a class=link href=\"?process=word&q=$q&sayfa=$linksayfa\"><font color=red face=verdana size=1><b>>></b></font></a>";
}





echo "
<OL>
";
if ($verified_kat == "admin" or $verified_kat == "mod")
$listele = mysql_query("SELECT * FROM mesajlar WHERE `sira`=$gid ORDER BY `id` asc limit $alt,$max");
else if ($verified_durum == "off" or $verified_durum == "wait")
$listele = mysql_query("SELECT * FROM mesajlar WHERE `sira`=$gid and `statu` != 'silindi' ORDER BY `id` asc limit $alt,$max");
else
$listele = mysql_query("SELECT * FROM mesajlar WHERE `sira`=$gid and `statu` = '' ORDER BY `id` asc limit $alt,$max");
if (mysql_num_rows($listele)>0){
while ($kayit=mysql_fetch_array($listele)) {

$id=$kayit["id"];
$sira=$kayit["sira"];
$mesaj=$kayit["mesaj"];
$updater=$kayit["updater"];
$yazar=$kayit["yazar"];
$tarih=$kayit["tarih"];
$gun=$kayit["gun"];
$ay=$kayit["ay"];
$yil=$kayit["yil"];
$saat=$kayit["saat"];
$statu=$kayit["statu"];
$yazstatu=$kayit["statu"];
$update=$kayit["update2"];
$updatesebep=$kayit["updatesebep"];
$ayazar = $yazar;

$yazarlink = ereg_replace("&","",$yazar); // adminlerden ~ kaldırıyoruz
$yazartitle = ereg_replace("&","Administrator / ",$yazar); // adminlerden ~ kaldırıyoruz

$link = ereg_replace("ş","s",$link);
$link = ereg_replace("Ş","S",$link);
$link = ereg_replace("ç","c",$link);
$link = ereg_replace("Ç","C",$link);
$link = ereg_replace("ı","i",$link);
$link = ereg_replace("İ","I",$link);
$link = ereg_replace("ğ","g",$link);
$link = ereg_replace("Ğ","G",$link);
$link = ereg_replace("ö","o",$link);
$link = ereg_replace("Ö","O",$link);
$link = ereg_replace("ü","u",$link);
$link = ereg_replace("Ü","U",$link);
$link = ereg_replace("Ö","O",$link);

$mesaj = ereg_replace("Ş","ş",$mesaj);
$mesaj = ereg_replace("Ç","ç",$mesaj);
$mesaj = ereg_replace("İ","i",$mesaj);
$mesaj = ereg_replace("Ğ","ğ",$mesaj);
$mesaj = ereg_replace("Ö","ö",$mesaj);
$mesaj = ereg_replace("Ü","ü",$mesaj);

$mesaj = strtolower($mesaj);

$mesaj = preg_replace("'\(bkz: (.*)\)'Ui","(bkz: <a href=\"sozluk.php?process=word&q=\\1\"><b>\\1</b></a>)",$mesaj);
$mesaj = preg_replace("'\(gbkz: (.*)\)'Ui","<a href=\"sozluk.php?process=word&q=\\1\"><b>\\1</b></a>",$mesaj);
$mesaj = preg_replace("'\(u: (.*)\)'Ui","<a href=\"sozluk.php?process=word&q=\\1\" title=\"\\1\"><b>*</b></a>",$mesaj);
$mesaj = preg_replace( "`((http)+(s)?:(//)|(www\.))((\w|\.|\-|_)+)(/)?(\S+)?`i", "<a target=_blank href=\"http\\3://\\5\\6\\8\\9\" title=\"\\0\"><b>\\5\\6\\8\\9</b></a>", $mesaj);
$mesaj = preg_replace("'\#([0-9]{1,9})'","<a href=sozluk.php?process=eid&eid=\\1><b>#\\1</b></a>",$mesaj);


$uzunluk = 142;
if($mesaj && strlen($mesaj)>$uzunluk) {
$mesaj=preg_replace("/([^\n\r -]{".$uzunluk."})/i"," \\1\n<br />",$mesaj);
}


$say++;

if (!$ayazar)
die;



if ($verified_kat == "gammaz")
$ispit = "<a href=sozluk.php?process=ispit&id=$id><font size=1>[ispiyon et]</a>";
else
$ispit = "";

if ($ayazar == $verified_user or $verified_kat == "admin" or $verified_kat == "mod")
$sil = "<a href=sozluk.php?process=esil&id=$id&sr=$sira><font size=1>[Sil]</a>";
else
$sil = "";

if ($ayazar == $verified_user or $verified_kat == "admin" or $verified_kat == "mod")
$duzenle = "<a href='sozluk.php?process=etasi&id=$id&sr=$sira'><font size=1>[Taşı]</font></a> - <a href=sozluk.php?process=eduzenle&id=$id&sr=$sira><font size=1>[Düzenle]</a> -";
else
$duzenle = "";

if ($updatesebep)
$updatesebep = "(Sebep: $updatesebep)";


if ($yazar != $verified_user and $verified_user)
$oylama = " <A href=\"sozluk.php?process=yorum&deger=arti&id=$id\"><font size=1>hoş</A> |</font> <A href=\"sozluk.php?process=yorum&deger=eksi&id=$id\"><font size=1>boş</A></font> ";
else
$oylama = "";


// admin check
$echoyazar = $yazar;
$sorgu1 = "SELECT nick,yetki FROM user WHERE `nick` = '$yazar'";
$sorgu2 = mysql_query($sorgu1);
mysql_num_rows($sorgu2);
$kayit2=mysql_fetch_array($sorgu2);
$yetki=$kayit2["yetki"];
$nick=$kayit2["nick"];
if ($yetki == "admin") {
$yazar = "$yazar";
}
if ($yetki == "mod") {
$yazar = "$yazar";
}
if ($yetki == "gammaz") {
$yazar = "$yazar";
}
// admin check
if ($verified_user) {
if ($verified_user != $yazar)
$msg = "<A href=\"sozluk.php?process=privmsg&islem=yenimsj&gkime=$yazartitle\"><font size=1>msg</A> |</font>";
else
$msg = "";
}

if ($statu == "akillandim" or $statu == "silindi") {
if ($verified_kat == "admin" or $verified_kat == "mod") {
if ($statu == "akillandim")
$yazstatu = "Bu entry silinmiş, fakat yazar tarafından hataları tekrar giderilip aktif edilmiş.(Admin onay bekliyor.)";
else if ($statu == "silindi")
$yazstatu = "Bu entry silinmiş, mod olduğunuz için bu mesajı görüyorsunuz.";
else
$yazstatu = "";
}
}

echo "

<LI value=$say>
</font><DIV class=eol><font size=2>$mesaj<BR>
";
if ($updater == "System Administrator")
$updater = "<img src=images/unlem.gif> $updater";
if ($updater)
$bastir = "~ $update";
else
$bastir = "";
if ($updater and ($verified_kat == "admin" or $verified_kat == "mod"))
echo "------------------------------------------------------------------------------<br>
<font size=1>$updater tarafindan düzenlendi.$updatesebep</font>
";
if ($yazstatu and $yazstatu == "wait") {
echo "<br><font color=white size=1><img src=images/unlem.gif>Bu entry'i bir çaylak yazmış.Çaylak olan arkadaş yazar olunca bu entry'si halka arz edilecektir.Şuan sadece çaylaklar ve lordlar bu entry'i görüyorlar.</font>";
}
if ($yazstatu and $yazstatu != "wait") {
echo "<br><font color=white size=1><img src=images/unlem.gif>$yazstatu</font>";
}
echo "
</DIV>
<DIV align=right><font size=1>$ispit $duzenle $sil (<a href=sozluk.php?process=eid&eid=$id><font face=verdana size=1>#$id</font></a>) <B><A
href=\"sozluk.php?process=word&q=$echoyazar\" title=\"$yazartitle\"><font size=1>$yazar</A></B>|$gun/$ay/$yil $saat $bastir| $msg $oylama
</DIV><br>
</li>
</font>
";

}
}
else if ($statu != "silindi") {
/*
$sorgu = "DELETE FROM konular WHERE id = '$konuid' LIMIT 1";
mysql_query($sorgu);
echo "<center><b><img src=images/unlem.gif> Bu başlık az önce intahar etti!
<SCRIPT>alert('Bu basliga az önce admin tarafindan intahar süsü verildi.');</SCRIPT>
<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"3;URL=sozluk.php?process=refresh\">
";
*/
}

if ($goster > 1)
echo "<p align=center class=eol><font face=Verdana size=1>Sayfalar: ";

$goster = $w/$max;
$goster=ceil($goster);
if ($goster >1) {

if ($sayfa >= 1 or !$sayfa) {
$linksayfa = $sayfa - 1;
if ($sayfa > 1 or $sayfa) {
if ($sayfa != 1)
echo "<a class=link href=\"?process=word&q=$q&sayfa=$linksayfa\"><font color=red face=verdana size=1><b><<</b></font></a> ";
}
}

echo "<SELECT class=ksel
onchange=\"jm('self',this,0);\" name=sayfa>";
for ($i=1;$i<=$goster;$i++) {
if ($sayfa == $i) echo "
<OPTION value=sozluk.php?process=word&q=$link&sayfa=$i selected>
$i</OPTION>";
else echo "
<OPTION value=sozluk.php?process=word&q=$link&sayfa=$i>
$i</OPTION>";
}
echo "</SELECT>";
}

if ($sayfa >= 1 or !$sayfa) {
if (!$sayfa)
$sayfa = 1;

$linksayfa = $sayfa + 1;

if ($linksayfa <= $goster)
echo " <a class=link href=\"?process=word&q=$q&sayfa=$linksayfa\"><font color=red face=verdana size=1><b>>></b></font></a><br><br>";
}



$sorgu1 = "SELECT id,hit FROM konular WHERE `id` = '$konuid'";
$sorgu2 = mysql_query($sorgu1);
$kayit2=mysql_fetch_array($sorgu2);
$hit=$kayit2["hit"];
$hit++;
$sorgu = "UPDATE konular SET hit='$hit' WHERE id='$konuid'";
mysql_query($sorgu);

if ($verified_user) {
?>
<form method=post action=>
<table width="100%" align="left" class="dash">
<tr>
<td colspan="2">
<textarea id="aciklama" name="mesaj" rows="8" style="width:100%;"></textarea>
</td>
</tr>
<tr>
<td width="788">
<input class="but" type="button" name="bkz" value="bkz" onclick="bkzver('bkz');" accesskey=x>
<input class="but" type="button" name="bkz" value="gbkz" onclick="bkzver('gbkz');" accesskey=c>
<input class="but" type="button" name="bkz" value="*" onclick="bkzver('u');" accesskey=v>
</td>
<td width="90" align="right" valign="top">
<input id="kaydet" class=but type="submit" name="kaydet" value="kaydet">
<input type="hidden" name="ok" value="kaydet">
<input type="hidden" name="gid" value="<? echo $gid; ?>">
<input type="hidden" name="q" value="<? echo $q; ?>";
<input type="hidden" name="gonder" value="kaydet">
</td>
</tr>
<tr>

<td valign="top" colspan="2"> Bakınız: (bkz: kelime)<br>
Gizli bakınız: (gbkz: kelime)<br>
Arama: (ara: aranacak kelime)<br>
URL: http://www.terimler.net ("http://" gereklidir.)<br>
*: (u: kelime)
</td>
</tr>
</table>
</form>

<?php
} // yazar
?>
</div>
</body>
</html>

Fou-Lu
11-12-2011, 04:51 PM
You are attempting to use variables before they exist. For example, on line 6 you have if ($verified_user) {, but there is no previous creation for $verified_user. I see it created about 25 lines lower.
All of this processing code needs to be moved up. You need to extract variables first, then process them. I see you using header in here as well, which without an output buffer (which you have explicitly enabled, but...) will fail after the output.
Make sure you modify this so that every header is within a braced if branch AND you have added a die to it. Without a die/exit the script will continue processing which may or may not cause problems depending on what it does (insertion scripts could become extremely problematic). You need to use braces for this otherwise you only get the potential for the header if a condition match, but the exit is always called. In a language like PHP, there is no reason to not fully process all necessary code before beginning output; this is why we have variables (plus it makes it a lot easier to read).

1BJK903
11-12-2011, 06:26 PM
You are attempting to use variables before they exist. For example, on line 6 you have if ($verified_user) {, but there is no previous creation for $verified_user. I see it created about 25 lines lower.
All of this processing code needs to be moved up. You need to extract variables first, then process them. I see you using header in here as well, which without an output buffer (which you have explicitly enabled, but...) will fail after the output.
Make sure you modify this so that every header is within a braced if branch AND you have added a die to it. Without a die/exit the script will continue processing which may or may not cause problems depending on what it does (insertion scripts could become extremely problematic). You need to use braces for this otherwise you only get the potential for the header if a condition match, but the exit is always called. In a language like PHP, there is no reason to not fully process all necessary code before beginning output; this is why we have variables (plus it makes it a lot easier to read).

Hi there,

Thanks for your reply, it´s good to see that this forum is trying to help people out. I'm a newbie at this, so I don't understand exactly what you are trying; at least I don't know how to make it work, that's why I have came here. Can you give me a working example of my code? Die/exit is something I have never heard of before. Therefore I apologise.

Inigoesdr
11-13-2011, 03:21 AM
Read up on variables (http://php.net/language.variables.basics) and exit (http://php.net/exit).

MattClark
11-13-2011, 09:08 AM
You need to move



$verified_user = $_SESSION['verified_user'];


above



if ($verified_user) {
$sorgu1 = "SELECT * FROM user WHERE `nick` = '$verified_user'";
$sorgu2 = mysql_query($sorgu1);
$kayit2=mysql_fetch_array($sorgu2);
$tema=$kayit2["tema"];
if (!$tema)
$tema = "default";
}
else {
$tema = "default";
}


$verified_user isn't set when you're calling it...that is where the undefined variables errors are coming from. So set it as $verified_user = $_SESSION['verified_user']; if that's what you want, then you're free to use the if($verified_user) snippet.

Try to keep your variable declarations near the top of your page.

MattClark
11-13-2011, 09:14 AM
Also, ereg_replace is deprecated. Try switching to preg_replace. That'll get rid of one of those errors too!

1BJK903
11-14-2011, 11:40 PM
You need to move



$verified_user = $_SESSION['verified_user'];


above



if ($verified_user) {
$sorgu1 = "SELECT * FROM user WHERE `nick` = '$verified_user'";
$sorgu2 = mysql_query($sorgu1);
$kayit2=mysql_fetch_array($sorgu2);
$tema=$kayit2["tema"];
if (!$tema)
$tema = "default";
}
else {
$tema = "default";
}


$verified_user isn't set when you're calling it...that is where the undefined variables errors are coming from. So set it as $verified_user = $_SESSION['verified_user']; if that's what you want, then you're free to use the if($verified_user) snippet.

Try to keep your variable declarations near the top of your page.

This is index.php:


<?php
session_start();
$verified_user = $_SESSION['verified_user'];
$verified_kat = $_SESSION['verified_kat'];
$kat = $_SESSION['kat'];
include "inc/baglan.php";

if ($verified_user) {
$sorgu1 = "SELECT * FROM user WHERE `nick` = '$verified_user'";
$sorgu2 = mysql_query($sorgu1);
$kayit2=mysql_fetch_array($sorgu2);
$tema=$kayit2["tema"];
}
else {
$tema = "default";
}


echo "

<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3c.org/TR/1999/REC-html401-19991224/frameset.dtd\">
<META content=\"Sözlük TuRTa, sözlük, en tatlı sözlük, turta\" name=keywords>
<META content=\"Sözlük TuRTa | En Tatlı Sözlük\" name=description>

<SCRIPT language=javascript>
function st(){
window.status = 'Hadi Bakalim Klavyenize Kuvvet!';
return true;
}
st();
</SCRIPT>
<META http-equiv=Content-Type content=\"text/html; charset=iso-8859-9\">
<META content=\"MSHTML 6.00.2800.1106\" name=GENERATOR>
<SCRIPT language=javascript src=\"sozluk.js\"></SCRIPT>
<LINK href=\"images/$tema.css\" type=text/css rel=stylesheet>
<LINK href=\"favicon.ico\"
rel=\"shortcut Icon\"><LINK href=\"favicon.ico\" rel=icon>
<title>Sözlük TuRTa | En Tatlı Sözlük</title>
</HEAD>
<FRAMESET border=0 frameSpacing=0 rows=73,* frameborder=0 cols=*>
<FRAME name=top src=\"sozluk.php?process=top\" noResize scrolling=no>
<FRAMESET border=0 frameSpacing=0 frameborder=0 cols=225,*>
";

if (!$process)
echo "<FRAME name=left src=\"sozluk.php?process=today\" noresize=noresize>";
else
echo "<FRAME name=left src=\"sozluk.php\" noresize=noresize>";


if (!$process)
echo "<FRAME name=main src=\"sozluk.php?process=master\" noresize=noresize>";
else if ($process == "regreg")
echo "<FRAME name=main src=\"sozluk.php?process=regreg\" noresize=noresize>";

echo "
</FRAMESET></HTML>
";
?>


These are the errors I now get:

Notice: Undefined index: verified_user in C:\xampp\htdocs\besiktas\index.php on line 3

Notice: Undefined index: verified_kat in C:\xampp\htdocs\besiktas\index.php on line 4

Notice: Undefined index: kat in C:\xampp\htdocs\besiktas\index.php on line 5

Notice: Undefined variable: process in C:\xampp\htdocs\besiktas\index.php on line 45

Notice: Undefined variable: process in C:\xampp\htdocs\besiktas\index.php on line 51

How come that I get these errors if I put them above the code you mentioned? I know that there is somehting wrong with PHP, because the ?> is green instead of green. Can you check this out please?

I did that also with besiktas.php:


<?php
session_start();
ob_start();
include "inc/baglan.php";

$verified_user = $_SESSION['verified_user'];
$verified_kat = $_SESSION['verified_kat'];
$verified_durum = $_SESSION['durum'];
$kat = $_SESSION['kat'];

if ($verified_user) {
$sorgu1 = "SELECT * FROM user WHERE `nick` = '$verified_user'";
$sorgu2 = mysql_query($sorgu1);
$kayit2=mysql_fetch_array($sorgu2);
$tema=$kayit2["tema"];
if (!$tema)
$tema = "default";
}
else {
$tema = "default";
}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1254">
<SCRIPT src="images/top.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="images/sozluk.js"></SCRIPT>
<LINK href="favicon.ico" rel="shortcut Icon"><LINK href="favicon.ico" rel=icon>
<LINK href="images/sozluk.css" type=text/css rel=stylesheet>
<LINK href="images/<? echo $tema ?>.css" type=text/css rel=stylesheet>
</head>

<body>
<?php


$user_ip = getenv('REMOTE_ADDR');
$sorgu1 = "SELECT ip FROM ipban WHERE `ip` = '$user_ip'";
$sorgu2 = mysql_query($sorgu1);
$kayit2=mysql_fetch_array($sorgu2);
$ip=$kayit2["ip"];
if ($ip and $verified_user != "yalowa")
header("Location: bakim.php");

$sorgu1 = "SELECT nick,durum FROM user WHERE `nick` = '$verified_user'";
$sorgu2 = mysql_query($sorgu1);
$kayit2=mysql_fetch_array($sorgu2);
$durum=$kayit2["durum"];
$nick=$kayit2["nick"];
if ($durum == "sus")
header ("Location: logout.php");

$sorgu1 = "SELECT * FROM ayar";
$sorgu2 = mysql_query($sorgu1);
mysql_num_rows($sorgu2);
$kayit2=mysql_fetch_array($sorgu2);
$site=$kayit2["site"];
$reg=$kayit2["reg"];
if ($site == "off" and $verified_kat == "admin" and $process != "top") {
echo "<font color=red>Uyarı!: Site şuan kapalı konumda.</font>";
}
if ($site == "tech" and $verified_kat == "admin" and $process != "top") {
echo "<font color=red>Uyarı!: Site şuan bakım konumunda.</font>";
}
if ($site == "off" and $verified_kat != "admin" and $process != "top") {
include "kapali";
die;
}
if ($site == "tech" and $verified_kat != "admin" and $process != "top") {
include "bakim.php";
die;
}

if ($verified_user) { // kontrol
$son_zaman = time() - 1800;
$sorgu = "DELETE FROM online WHERE islem_zamani < $son_zaman";
mysql_query($sorgu);
$simdikizaman = time();
if ($verified_kat == "admin") {
$gnick = "&$verified_user";
$sorgu = "UPDATE online SET islem_zamani=$simdikizaman WHERE nick='$gnick'";
mysql_query($sorgu);
}
else if ($verified_kat == "mod") {
$gnick = "+$verified_user";
$sorgu = "UPDATE online SET islem_zamani=$simdikizaman WHERE nick='$gnick'";
mysql_query($sorgu);
}
else if ($verified_kat == "gammaz") {
$gnick = "$verified_user*";
$sorgu = "UPDATE online SET islem_zamani=$simdikizaman WHERE nick='$gnick'";
mysql_query($sorgu);
}
else {
$sorgu = "UPDATE online SET islem_zamani=$simdikizaman WHERE nick='$verified_user'";
mysql_query($sorgu);
}
} // kayitli online kont


if ($process) {
if ($process == "privmsg" and !$verified_user) {
Header ("Location: logout.php");
die;
}

if ($process == "cp" and !$verified_user) {
Header ("Location: logout.php");
die;
}

if ($process == "add" and !$verified_user) {
Header ("Location: logout.php");
die;
}
if ($process == "adm" and !$verified_user) {
Header ("Location: logout.php");
die;
}

if ($process == "msjoku" and !$verified_user) {
Header ("Location: logout.php");
die;
}

if ($process == "msjana" and !$verified_user) {
Header ("Location: logout.php");
die;
}

if ($process == "yenimsj" and !$verified_user) {
Header ("Location: logout.php");
die;
}
if ($process == "adm" and !$verified_user) {
Header ("Location: logout.php");
die;
}

if ($process == "onlines" and !$verified_user) {
Header ("Location: logout.php");
die;
}

// echo $process;
if (file_exists("inc/$process.php"))
include "inc/$process.php";
else if (file_exists("adm/$process.php"))
include "adm/$process.php";
else
echo "
<LINK href=\"images/$tema.css\" type=text/css rel=stylesheet>
Bu bölüm geçici olarak servis dışı.";


if ($process == "word") {
function mtime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$basla = mtime();
for ($i=0; $i < 10000; $i++){
}
$bitir = mtime();
echo "<br><br><br><center><a href=sozluk.php?process=word&q=sayfa+uretim+suresi target=main><font size=1>sayfa üretim süresi</font></a>:<a class=link><font size=1>".round($bitir-$basla,5)."</font></a>";

echo "
<hr>
<font size=1>Sözlük TuRTa - En Tatlı Sözlük<br>
Copyright by 2007 (c)
";
}

}
ob_end_flush();
?>
</body>
</html>

Fou-Lu
11-15-2011, 06:24 PM
The offsets are warning since they simply do not exist. You have no code indicating that these are ever set in _SESSION.
$process is never defined, so it will always throw an error when you check it. You can get around both variable and key checks using the isset (http://php.ca/manual/en/function.isset.php) function.
Also, avoid using the keyword 'AND' in comparisons. 'AND' has a lower priority than an assignment, which has a lower priority than both && and ||. AND, OR, and &&, || should be used only (specifically together) with great care. Use && and || for typical comparisons, not AND and OR.

1BJK903
11-17-2011, 07:25 PM
The offsets are warning since they simply do not exist. You have no code indicating that these are ever set in _SESSION.
$process is never defined, so it will always throw an error when you check it. You can get around both variable and key checks using the isset (http://php.ca/manual/en/function.isset.php) function.
Also, avoid using the keyword 'AND' in comparisons. 'AND' has a lower priority than an assignment, which has a lower priority than both && and ||. AND, OR, and &&, || should be used only (specifically together) with great care. Use && and || for typical comparisons, not AND and OR.

Can you give me a working example of it? Isset etc...

Inigoesdr
11-17-2011, 09:09 PM
Can you give me a working example of it? Isset etc...

Look at the manual page Fou-Lu linked you to: isset() (http://php.net/isset)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum