/*
برمجة: أبوشهاب
© www.AbuShhab.com
*/
include_once("config.php");
include_once("functions.php");
include_once("tip.dat");
include_once("et.php");
$tpl = new EasyTemplate;
$page = addslashes(strip_tags($_GET['page'] ?? ""));
$id = addslashes(strip_tags($_GET['id'] ?? ""));
$getajax = $_GET['ajax'] ?? "";
$nextpage = $_POST['start'] ?? "";
if ($page == "call"){
/////////////////////////////// IMG
$chtime = rand(10000000000,99999999999);
$pcheck = "
";
$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 );
/////////////////////////////// End IMG
$cname = $_POST['name'];
$cemail = $_POST['email'];
$csubject = $_POST['subject'];
$cmessage = $_POST['message'];
$ctype = $_POST['type'];
if ($cname != "" and $cemail != "" and $csubject != "" and $cmessage != "" and $ctype != "" and $checkv == $fcheckrand){
$sok = 1;
mysqli_query($connect,"INSERT INTO `call`(name,email,subject,message,ip,type,url,time) VALUES ('".$cname."','".$cemail."','".$csubject."','".$cmessage."','".$_SERVER['REMOTE_ADDR']."','".$ctype."','".addslashes(strip_tags($_POST["fp"]))."','".$time."')");
addmail($cemail);
}else{
if ($page == "call"){
$showcall = 1;
}else{
$showorderfilm = 1;
}
}
echo $tpl->display($ftemplets,"header.html");
echo $tpl->display($ftemplets,"menur.html");
echo $tpl->display($ftemplets,"call.html");
echo $tpl->display($ftemplets,"menul.html");
echo $tpl->display($ftemplets,"footer.html");
}else{
//////////// الاعلانات ///////////////
$queryhads = @mysqli_query($connect,"SELECT ad FROM ads where type = '1' and cat = '-' order by id ASC");
while($rowhads = @mysqli_fetch_array($queryhads))
$headerads .= $rowhads[ad];
mysqli_free_result($queryhads);
$queryrids = @mysqli_query($connect,"SELECT ad FROM ads where type = '2' and cat = '-' order by id ASC");
while($rowrids = @mysqli_fetch_array($queryrids))
$rightmenuads .= $rowrids[ad];
mysqli_free_result($queryrids);
$queryleds = @mysqli_query($connect,"SELECT ad FROM ads where type = '3' and cat = '-' order by id ASC");
while($rowleds = @mysqli_fetch_array($queryleds))
$leftmenuads .= $rowleds[ad];
mysqli_free_result($queryleds);
$queryfads = @mysqli_query($connect,"SELECT ad FROM ads where type = '4' and cat = '-' order by id ASC");
while($rowfads = @mysqli_fetch_array($queryfads))
$footerads .= $rowfads[ad];
mysqli_free_result($queryfads);
//////////// نهاية الاعلانات ///////////////
if ($_GET["npage"] == "" or $_GET["npage"] == "0"){
$npage = 1;
}else{
$npage = $_GET["npage"];
}
if($getajax != "" and $nextpage != "")
$npage = $nextpage;
/*
$nsites_in_page_show_sites_admin = $thingsinpage;
$querytonumsites = mysqli_query($connect,"SELECT * FROM thing where ok=1 order by time DESC");
$numtonumsites = mysqli_num_rows($querytonumsites); */
$frommaxinpage=($thingsinpage*$npage)-$thingsinpage;
$querytoshowsites = mysqli_query($connect,"SELECT * FROM thing where ok=1 order by time DESC limit ".$frommaxinpage.",".$thingsinpage);
//$pages = ceil($numtonumsites/$nsites_in_page_show_sites_admin);
/*
$numlimitpages = 5;
if ($pages != "1" and $pages != "0"){
if ($npage > 1){
$forindexcutcats = "1";
$morepages1 .= "الصفحة الأولى ";
}
for($i=1; $i<=$pages; $i++){
if ($npage == $i){
$morepages .= "$i ";
}else{
if($i <= ($npage+$numlimitpages)){
if($i >= ($npage-$numlimitpages)){
if ($i == "1"){
$morepages .= "1 ";
}else{
$morepages .= "$i ";
}
}else{
$beforni = " ... ";
}
}else{
$afterni = " ... ";
}
}
}
if ($npage != $pages){
$morepages2 .= "الصفحة الأخيرة";
}
$morepages = $morepages1.$beforni.$morepages.$afterni.$morepages2;
}else{
$morepages = "";
}
*/
$numthisth = 0;
while($rowlath = @mysqli_fetch_array($querytoshowsites)){
$numthisth ++;
$things[] = array("id"=>$rowlath['id'],"title"=>$rowlath['title'],"pic"=>spic($rowlath['pic']),"date"=>td($rowlath['rtime'],1,$limittimeshow),"price"=>$rowlath['branch']);
}
mysqli_free_result($querytoshowsites);
if($numthisth == $thingsinpage)
$morepage = "الصفحة التالية ";
if($npage != 1 or $morepage != ""){
$morepages = 1;
if($npage != 1)
$ppage = "الصفحة السابقة ";
}
if($thisdayupdate != date("d",$time)){
$thisdayupdate = date("d",$time);
$randomthings = "";
$queryrandthings = @mysqli_query($connect,"SELECT id FROM thing where ok = 1 order by time DESC limit 20");
while($rowrandthings = @mysqli_fetch_array($queryrandthings)){
if($randomthings != "")
$randomthings .= "||";
$randomthings .= "id='$rowrandthings[id]'";
}
mysqli_free_result($queryrandthings);
updatetips();
}
if ($luptags <= $time){
$luptags = $time+(3600*24);
$newtags = tags();
sitemap();
$fp = fopen("tags.dat", "w+");
fwrite($fp,"
\$luptags = \"$luptags\";
\$tags = \"$newtags\";
?>");
}
$np = "";
$namesite = $nameindex;
$indexpageyes = "1";
if($npage != "" and $npage != "1" and $npage != "0")
$namesite = $namesite." - صفحة $npage";
if($_GET['q'] != ""){
$orq = $_GET['q'];
$w = addslashes(strip_tags($_GET['q']));
/*
if($_GET['s'] == "")
header("Location: ".$urlsite."index.php?s=1&oq=$orq&q=".$_GET['q']);
*/
$googlesearch = $orq;
$namesite = "$googlesearch - بحث";
echo $tpl->display($ftemplets,"header.html");
echo $tpl->display($ftemplets,"menur.html");
echo $tpl->display($ftemplets,"searchgoogle.html");
echo $tpl->display($ftemplets,"menul.html");
echo $tpl->display($ftemplets,"footer.html");
/*
if($w != ""){
$queryw = @mysqli_query($connect,"SELECT * FROM word where word = '$w'");
$numw = @mysqli_num_rows($queryw);
mysqli_free_result($queryw);
if($numw == "0")
mysqli_query($connect,"INSERT INTO word(word,t) VALUES ('".$w."',1) ");
else
mysqli_query($connect,"UPDATE word set t = t + 1 where word = '". $w ."' ");
}
*/
}else{
echo $tpl->display($ftemplets,"header.html");
echo $tpl->display($ftemplets,"menur.html");
echo $tpl->display($ftemplets,"cat.html");
echo $tpl->display($ftemplets,"menul.html");
echo $tpl->display($ftemplets,"footer.html");
}
}
mysqli_close ($connect);
?>