/*
برمجة: أبوشهاب
© www.AbuShhab.com
*/
include_once("config.php");
include_once("functions.php");
include_once("et.php");
$tpl = new EasyTemplate;
$noleftmenu = "1";
$picfacebook = "1";
$thispagenumthing = "10";
$id = addslashes(strip_tags($_GET['id'] ?? ""));
$idcomm = addslashes(strip_tags($_GET['idcomm'] ?? ""));
$iidco = addslashes(strip_tags($_GET['i'] ?? ""));
$codecommentg = addslashes(strip_tags($_GET['c'] ?? ""));
$tb = addslashes(strip_tags($_GET['tb'] ?? ""));
$opage = addslashes(strip_tags($_GET['p'] ?? ""));
$npage = addslashes(strip_tags($_GET['p'] ?? ""));
$action = addslashes(strip_tags($_GET['action'] ?? ""));
function catree($id){
global $connect,$fwasel;
$categories = "";
$query = mysqli_query($connect,"SELECT id,cat,name FROM cat where id=$id ");
while($row = mysqli_fetch_array($query)){
if($row['cat'] > "0")
$categories = catree($row['cat']);
$categories .= "$fwasel".$row['name']."";
}
mysqli_free_result($query);
return $categories;
}
$takedcomment = "";
$querys = mysqli_query($connect,"SELECT * FROM thing where id = '$id'");
if(mysqli_num_rows($querys) == "0"){
header("Location: $urlsite");
}else{
if($action == "phone" or $action == "sms"){
while($rows = mysqli_fetch_array($querys)){
$timelast = $time-(86400*30);
if($rows[rtime] > $timelast and $rows[phone] != ""){
$phone = $rows[phone];
if(preg_match("/,/",$phone)){
$e = explode(',',$phone);
for($i=0;$i".$e[$i]."";
$add = " - ";
}
}else
$actionok = "$phone";
}else{
$actionok = "عفواً .. الإعلان قديم";
}
}
}else{
$countthisvisitor = "no";
if(!empty($_SERVER['HTTP_USER_AGENT']) and !preg_match('~(bot|crawl|search|google|yahoo|http)~i', $_SERVER['HTTP_USER_AGENT']))
$countthisvisitor = "";
if($countthisvisitor == "")
mysqli_query($connect,"UPDATE thing set views=views+1,views2=views2+1 where id = '". $id ."' ");
$pagedetails = "1";
$simpleedit = $simpleedit ?? "";
while($rows = mysqli_fetch_array($querys)){
if($rows["ok"] == "0")
header("Location: $urlsite");
if($_GET["page"] == "v")
header("Location: ".$rows[site]);
//if($rows[ok] != "1")
// header("Location: ".$urlsite);
$id = $rows['id'];
$title = $rows['title'];
$title2 = $rows['title2'];
$about = $rows['about'];
if($simpleedit != "")
$about = nl2br($rows['about']);
$pic = $rows['pic'];
$email = $rows['email'];
$site = $rows['site'];
$price = $rows['branch'];
$act = showact($rows['act']);
$date = td($rows['rtime'],1,$limittimeshow);
$ut = $rows['ut'];
$us = $rows['us'];
$dj = $rows['dj'];
$ep = $rows['ep'];
$l = $rows['l'];
$source = source($rows['l']);
if(preg_match("/
",$pa[$p]);
for($p2=0;$p2",$expi[0]);
$expio = str_replace(array("'",'"',"\\"),array("","",""),$expi[0]);
$expios = getimagesize($expio);
$expiosno = "";
if($thiscopyurl == "blogs.jowlat.com" and $etmpt == "et2"){
if($expios[0] > 300)
$expiosno = "width=\"300\"";
}else{
if($expios[0] > 730)
$expiosno = "width=\"730\"";
}
$maincook1 .= "
";
}else
$maincook1 .= $ex2[$p2].">";
}
$aboutok .= $maincook1;
}
$about = $aboutok;
}
$exc = explode("|",$rows['act']);
$acts = "";
$acts2 = "";
$oract = $oract ?? "";
for($i=1;$i<=count($exc)-2;$i++){
if($exc[$i] != ""){
if($acts != "")
$oract = " or ";
$acts .= $oract."act like '%|$exc[$i]|%'";
$acts2 .= $oract."id = '$exc[$i]'";
}
}
$np = "";
for($tree=0;$tree<=count($exc)-2;$tree++){
if($exc[$tree] != ""){
if($np != "")
$np .= "
";
$catree = catree($exc[$tree]);
$np .= "$namesite".$catree;
}
}
/*
if($ut < $time){
$randomthings = "";
$querysath = mysqli_query($connect,"SELECT * FROM thing where ok = 1 and ($acts) order by time DESC limit $thispagenumthing");
if(mysqli_num_rows($querysath) != "0"){
while($rowsath = mysqli_fetch_array($querysath)){
$samethings[] = array("id"=>$rowsath[id],"title"=>$rowsath[title],"about"=>substr(trim(strip_tags($rowsath[about])),0,$numaboutth),"pic"=>spic($rowsath[pic]),"email"=>$rowsath[email],"site"=>ssite($rowsath[id],$rowsath[site]),"block"=>showblock($rowsath[block]),"act"=>showact($rowsath[act]),"date"=>td($rowsath[time]));
if($randomthings != "")
$randomthings .= "||";
$randomthings .= "id=\"$rowsath[id]\"";
}
}
mysqli_free_result($querysath);
$newtime = $time+(3600*72);
mysqli_query($connect,"UPDATE thing set `us`='$randomthings',`ut`='$newtime' where id = '". $id ."' ");
$us = $randomthings;
}
if($us != ""){
$samethings = array();
$querysath = mysqli_query($connect,"SELECT * FROM thing where $us");
if(mysqli_num_rows($querysath) != "0"){
while($rowsath = mysqli_fetch_array($querysath)){
$samethings[] = array("id"=>$rowsath[id],"title"=>$rowsath[title],"about"=>substr(trim(strip_tags($rowsath[about])),0,$numaboutth),"pic"=>spic($rowsath[pic]),"email"=>$rowsath[email],"site"=>ssite($rowsath[id],$rowsath[site]),"block"=>showblock($rowsath[block]),"act"=>showact($rowsath[act]),"date"=>td($rowsath[time]));
}
}
mysqli_free_result($querysath);
}
$mrtbdh = "";
$querylath = mysqli_query($connect,"SELECT * FROM thing where ok = 1 and ($acts) order by time DESC limit $thispagenumthing");
if(mysqli_num_rows($querylath) != "0"){
$mrtbdh = $title;
$lastthings = array();
while($rowlath = mysqli_fetch_array($querylath)){
$lastthings[] = array("id"=>$rowlath[id],"title"=>$rowlath[title],"about"=>substr(trim(strip_tags($rowlath[about])),0,$numaboutth));
}
}
*/
}
mysqli_free_result($querys);
$querylc1 = mysqli_query($connect,"SELECT * FROM cat where $acts2");
while($rowlc1 = mysqli_fetch_array($querylc1)){
$thisthingscat = "";
$querylc2 = mysqli_query($connect,"SELECT id,title,pic,rtime,branch FROM thing where ok = 1 and act like '|".$rowlc1['id']."|' order by time DESC limit 12");
while($rowlc2 = mysqli_fetch_array($querylc2))
$thisthingscat .= "
";
mysqli_free_result($querylc2);
$lastcats[] = array("id"=>$rowlc1['id'],"name"=>$rowlc1['name'],"things"=>$thisthingscat);
}
mysqli_free_result($querylc1);
if($ep != ""){
$showep = array();
$epex = explode("|",$ep);
$numep = 0;
for($i=0;$i $numlimitoneimage)
$wthpic = " width=\"$numlimitoneimage\"";
//if($rt == "1" and $epex[$i] == $pic)
//$skip = 1;
//else
$one = "";
$wi = "";
if($pic == $epex[$i])
$one = "1";
$numep ++;
$showep[] = array("id"=>$numep,"one"=>$one,"pic"=>$epex[$i],"w"=>$wthpic);
}
}
$allshowep = count($showep);
}
/////////////////////////////// IMG
$chtime = rand(10000000000,99999999999);
$pcheck = "
";
/////////////////////////////// End IMG
////////////////////////////// Start Edit
$cname = $_POST['name'] ?? "";
$cemail = $_POST['email'] ?? "";
$cmessage = $_POST['message'] ?? "";
if ($cname != "" and $cemail != "" and $cmessage != ""){
$check = addslashes(strip_tags($_POST[check]));
$checkv = addslashes(strip_tags($_POST[checkv]));
$fcheckrand = substr( $check, 2, 1 );
$fcheckrand .= substr( $check, 5, 1 );
$fcheckrand .= substr( $check, 8, 1 );
if($checkv != $fcheckrand and $nc != "1")
$error .= "عفواً .. تأكد من كتابة الارقام الموجوده بالصورة بشكل صحيح";
if($error == ""){
$sok = 1;
mysqli_query($connect,"INSERT INTO `call`(name,email,subject,message,ip,t,time) VALUES ('".$cname."','".$cemail."','".$id."','".$cmessage."','".$_SERVER["REMOTE_ADDR"]."',1,'".$time."')");
}
}
////////////////////////////// End Edit
////////////////////////////////////// Start Comments
$msg = "";
$addcomment = addslashes(strip_tags($_REQUEST["addcomment"] ?? ""));
if ($addcomment != ""){
$namecomment = addslashes(strip_tags($_REQUEST["name"] ?? ""));
$emailcomment = addslashes(strip_tags($_REQUEST["email"] ?? ""));
$commentcomment = addslashes(strip_tags($_REQUEST["comment"] ?? ""));
$uratecomment = addslashes(strip_tags($_REQUEST["score"] ?? ""));
if($uratecomment == "")$uratecomment=0;
$o1comment = addslashes(strip_tags($_REQUEST["o1"] ?? ""));
$o2comment = addslashes(strip_tags($_REQUEST["o2"] ?? ""));
$o3comment = addslashes(strip_tags($_REQUEST["o3"] ?? ""));
$o4comment = addslashes(strip_tags($_REQUEST["o4"] ?? ""));
$o5comment = addslashes(strip_tags($_REQUEST["o5"] ?? ""));
$check = addslashes(strip_tags($_POST['check'] ?? ""));
$checkv = addslashes(strip_tags($_POST['checkv'] ?? ""));
$fcheckrand = substr( $check, 2, 1 );
$fcheckrand .= substr( $check, 5, 1 );
$fcheckrand .= substr( $check, 8, 1 );
if($namecomment == ""){
$msg = "عفواً .. لم تقم بكتابة اسمك الكريم";
}elseif($commentcomment == ""){
$msg = "عفواً .. لم تقم بكتابة ال$word1";
}elseif($checkv != $fcheckrand){
$msg = "عفواً .. تأكد من كتابة الاحرف الموجوده بالصورة بشكل صحيح";
}else{
$msg = "تم اضافة ".$word1."ك بنجــاح .. شكراً لك";
mysqli_query($connect,"INSERT INTO comment(tid,name,email,comment,rate,time) VALUES ('".$id."','".$namecomment."','".$emailcomment."','".$commentcomment."','".$uratecomment."','".$time."') ");
mysqli_query($connect,"UPDATE thing set time='$time' where id = '". $id ."' ");
$snp1 = mysqli_fetch_array(mysqli_query($connect,"select max(id) from comment"));
$picnametoid = $snp1[0];
///////// Start Email
if($sendmessage == "1"){
$subject = "تعليق جديد";
$message = "تم اضافة التالي في $namesite\r\n\r\n$namecomment\r\n$emailcomment\r\n$commentcomment\r\n\r\nهذه الإضافة في $title\r\n".$urlsite."info-$id.html\r\nللتفعيل\r\n".$urlsite."qna.php?t=$time&i=$picnametoid&a=ok&y=2\r\n\r\nللحذف\r\n".$urlsite."qna.php?t=$time&i=$picnametoid&a=de&y=2";
$message = wordwrap($message, 70, "\r\n");
mail($emailsite, $subject, $message,"From: Realknz.com");
}
///////// End Email
$addcomment = "";
$namecomment = "";
$emailcomment = "";
$commentcomment = "";
$uratecomment = "";
$o1comment = "";
$o2comment = "";
$o3comment = "";
$o4comment = "";
$o5comment = "";
}
}
$comments = "";
if ($npage == "" or $npage == "0"){
$npage = 1;
}else{
$npage = $npage;
}
$nsites_in_page_show_sites_admin = 5;
$frommaxinpage=($nsites_in_page_show_sites_admin*$npage)-$nsites_in_page_show_sites_admin;
$querytonumsites = mysqli_query($connect,"SELECT * FROM comment where tid = '$id' and o=1");
$numtonumsites = mysqli_num_rows($querytonumsites);
$query2 = mysqli_query($connect,"SELECT * FROM comment where tid = '$id' and o=1 order by id DESC limit ".$frommaxinpage.",".$nsites_in_page_show_sites_admin);
$pages = ceil($numtonumsites/$nsites_in_page_show_sites_admin);
if ($pages != "1" and $pages != "0"){
for($i=1; $i<=$pages; $i++)
$morepages .= " ($i)";
}else{
$morepages = "";
}
//$query2 = mysqli_query($connect,"SELECT * FROM comment where t = 1 and tid = '$id' and o=1 order by id DESC");
$numcomments = mysqli_num_rows($querytonumsites)-($nsites_in_page_show_sites_admin*($npage-1));
if ($numcomments != "0"){
$idcomment = $numcomments;
while($row2 = mysqli_fetch_array($query2)){
$idrco = $row2['id'];
$idco = $idcomment;
$nameco = $row2['name'];
$emailco = $row2['email'];
$commentco = nl2br($row2['comment']);
$rateco = showrate($row2['rate']);
$o1co = $row2['o1'];
$o2co = $row2['o2'];
$o3co = $row2['o3'];
$o4co = $row2['o4'];
$o5co = $row2['o5'];
$dateco = td($row2['time']);
$comments .= $tpl->display($ftemplets,"comment.html");
$idcomment --;
}
}
mysqli_free_result($query2);
////////////////////////////////////// End Comments
$exc = explode("|",$act);
$acts = "";
for($i=1;$i<=count($exc)-2;$i++){
if($exc[$i] != ""){
if($acts != "")
$oract = " or ";
$acts .= $oract."id = '$exc[$i]'";
}
}
$thiscats = "";
$allcatshow = "";
$npallcatshow = "";
$querysath = mysqli_query($connect,"SELECT * FROM cat where $acts2 ");
if(mysqli_num_rows($querysath) != "0"){
while($rowsath = mysqli_fetch_array($querysath)){
$lastcatid = $rowsath['id'];
$mtt = $rowsath['mtt'] ?? "";
$mts1 = $rowsath['mts1'] ?? "";
$mts2 = $rowsath['mts2'] ?? "";
$mts3 = $rowsath['mts3'] ?? "";
if (!empty($rowsath['sa'])) {
if($samecats != "")
$samecats .= "||";
$samecats .= $rowsath['sa'];
}
$bbbli = "";
$npbbbli = "";
if($rowsath['cat'] != ""){
$querysa2=mysqli_query($connect,"select * from cat where id = '".$rowsath['cat']."'");
while($rowsa2=mysqli_fetch_array($querysa2)){
$bbbli = $rowsa2['en']."/";
$npbbbli = "".$rowsa2['name']." ";
}
}
$npallcatshow = "$ornamesite $npbbbli".$rowsath['name']." $title
";
}
}
mysqli_free_result($querysath);
$catsforname = "";
$ex = explode($fwasel,$catree);
for($i=(count($ex)-1);$i>=1;$i--)
$catsforname .= "$ex[$i]$fwasel";
if($np == "")
$np = "$namesite$fwasel$title";
$namesite = strip_tags($title.$fwasel.$catsforname.$ornamesite);
$okfordk = substr(preg_replace('/\s+/', ' ', strip_tags(preg_replace(array("/