Просмотр файла games/admin/avtor.php

Размер файла: 6.61Kb
<?php
require_once"../../template/start.php";require_once"../../template/regglobals.php";require_once"../../template/config.php";require_once"../../template/siti_conf.php";require_once"../../template/functions.php";require_once"../../template/antidos.php";require_once"../../template/cookies.php";require_once"../../template/gzip.php";require_once"../../template/header.php";require_once"../../template/referer.php";include_once"../../themes/$config_themes/index.php";include_once"../../template/isset.php";$date=date("d.m.Y"); $time=date("H:i:s"); if (!$_SESSION['log']=="" && !md5($_SESSION['par'])=="" && md5($_SESSION['par'])==$provpar && $_SESSION['log']==$provlog ) {if ($dostup==101 && $log==$config_nikname){echo'<div class=tp>Авто-рынок</div>';if (isset($_GET['id'])) { $page=$_GET['page'];$file=file("../car/rynok/avto.dat"); $itogo=count($file)-1;$id=$itogo-$_GET['id']+2;$fp=fopen("../car/rynok/avto.dat","w");flock ($fp,LOCK_EX);for ($i=0;$i< sizeof($file);$i++) { if ($i==$id) {unset($file[$i]);} }fputs($fp, implode("",$file));flock ($fp,LOCK_UN);fclose($fp);@chmod("$fp", 0666);unlink ("../car/rynok/$kill");header ("Location: avtor.php?".SID); exit; }if ($_GET['event']=="showimg") {if (isset($_GET['num'])) {$num=$_GET['num']+1;} else {$num=0;}$lines = file("../car/rynok/avto.dat");$dti=explode("|",$lines[$num]);echo "Название: $dti[1]<br><img src='../car/rynok/$dti[6]' alt=''>";echo"<br>$dti[0]<br>TUNING: $dti[8]<br> Цена: $dti[9] Размер: $dti[7] Кб.<br>Добавил: <a href=\"../../pages/anketa.php?uz=$dti[2]\">$dti[2]</a> ($dti[3] / $dti[4])";}if (isset($_GET['event'])) {if ($_GET['event']=="add") { $name=$_POST['name']; $msg=$_POST['msg'];if (isset($_POST['page'])) {$page=$_POST['page'];} else {$page=1;}if ($name=="" || strlen($name) > 50) {echo 'Вы не ввели имя, или ввели слишком длинное имя!<br><a href="avtor.php?page='.$page.'">Продолжить</a><br>';include_once "../../themes/$config_themes/foot.php"; exit; }if ($msg=="" || strlen($msg) > 500) {echo 'Ваше описание пустое или превышает 500 символов.<br><a href="avtor.php?page='.$page.'">Продолжить</a><br>';include_once "../../themes/$config_themes/foot.php"; exit; }$msg=stripslashes($msg);$msg=htmlspecialchars($msg);$msg=str_replace("|","I",$msg);$msg=str_replace("\r\n","",$msg);$name=htmlspecialchars($name);$name=str_replace("|","I",$name);if (isset($_GET['rd'])) { $rd=$_GET['rd'];$fdate=$_POST['fdate'];$ftime=$_POST['ftime'];$smallfoto=$_POST['smallfoto'];$foto=$_POST['foto'];$fotoksize=$_POST['fotoksize'];$fwidth=$_POST['fwidth'];$fheight=$_POST['fheight'];$text="$msg|$name|$email|$fdate|$ftime||$foto|$fotoksize|$tun|$cena|";$file=file("../car/rynok/avto.dat");$fp=fopen("../car/rynok/avto.dat","a+");flock ($fp,LOCK_EX);ftruncate ($fp,0);for ($i=0;$i< sizeof($file);$i++) {if ($rd!=$i) {fputs($fp,$file[$i]);} else {fputs($fp,"$text\r\n");}}fflush ($fp);flock ($fp,LOCK_UN);fclose($fp);@chmod("$fp", 0666);} else {$text="$msg|$name|$email|$date|$time|";$fp=fopen("../car/rynok/avto.dat","a+");flock ($fp,LOCK_EX);fputs($fp,"$text\r\n");fflush ($fp);flock ($fp,LOCK_UN);fclose($fp);@chmod("$fp", 0666); }header ("Location: avtor.php?".SID); exit; }} else {if (isset($_GET['page'])) {$page=$_GET['page'];} else {$page="1";}if ((!isset($_GET['event'])) or (isset($_GET['event'])) & ($_GET['event']!="add")) {$lines=file("../car/rynok/avto.dat");$itogo=count($lines);$maxi=$itogo-1;if ($page=="0") {$page="1";} else {$page=abs($page);}echo '<form action="avtor.php?action=da" method="POST">Кол-во на стр:<br><input name="koll" maxlength="1" value="'.$siti_avtor.'" ><br><input type="submit" value="Ok"></form>';$fotolist=$siti_avtor;$maxpage=ceil(($maxi+1)/$fotolist); if ($page>$maxpage) {$page=$maxpage;}$fm=$maxi-$fotolist*($page-1); if ($fm<"0") {$fm=$fotolist;}$lm=$fm-$fotolist; if ($lm<"0") {$lm="-1";} do { $dt = explode("|", $lines[$fm]);$fm--;$num=$itogo-$fm;$tp=$fm; $teknum=$maxi-$tp;if(!$dt[0]==""){echo'<div class=b>'.$teknum.'. '. $dt[1].'</div> | <a href="avtor.php?rd='.$num.'&amp;page='.$page.'">Ред-ть</a> | <a href="avtor.php?id='.$num.'&amp;page='.$page.'&amp;kill='.$dt[6].'">Удалить</a> | <br><a href="avtor.php?event=showimg&amp;num='.$tp.'">'; $size = getimagesize("../car/rynok/$dt[6]");echo"<img src=\"../car/rynok/$dt[6]\" alt=\"\"></a><br>"; echo"$dt[0]<br>TUNING: $dt[8]<br> Цена: $dt[9]<br> Размер: <b>$dt[7]</b> Кб.<br>Добавил: <a href=\"../../pages/anketa.php?uz=$dt[2]\">$dt[2]</a> ($dt[3] / $dt[4])";}else{echo'<hr>Автомобилей нет!<br>';}$cm=1; $zz=$maxi-$fm;if ((round(($maxi-$fm)))==(($maxi-$fm))) {$cm++;}$whm=$lm; $whe=$fm;} while($whm < $whe);echo "<div class=panel>стр: ";for($i=0; $i<$maxi+1;) {$ip=$i/$fotolist+1;if ($page==$ip) {echo "<b>$ip</b> ";} else {echo " <a href='avtor.php?page=$ip'>$ip</a> ";}$i=$i+$fotolist;}}if (isset($_GET['rd'])) {$rd=$maxi-$_GET['rd']+2;$dt=explode("|",$lines[$rd]);$dt[0]=str_replace("<br>", "\r\n", $dt[0]);echo '<form action="avtor.php?event=add&amp;rd='.$rd.'" method="POST" name="REPLIER">Название:<br><input type="text" value="'.$dt[1].'" name="name"><br>TUNING:<br><input type="text" value="'.$dt[8].'" name="tun"><br>Цена:<br><input type="text" value="'.$dt[9].'" name="cena"><br> Описание:<br><textarea cols="25" rows="3" name="msg">'.$dt[0].'</textarea><br><input type="hidden" name="email" value="'.$dt[2].'"><input type="hidden" name="fdate" value="'.$dt[3].'"><input type="hidden" name="ftime" value="'.$dt[4].'"><input type="hidden" name="foto" value="'.$dt[6].'"><input type="hidden" name="fwidth" value="'.$dt[8].'"><input type="hidden" name="fheight" value="'.$dt[9].'"><input type="hidden" name="fotoksize" value="'.$dt[7].'"><input type="hidden" name="page" value="'.$page.'"><br><input type="submit" value="Сохранить"></form>';}}if ($action=="da"){if(!eregi("[^1-9;]",$koll)){$ufile = file(BASEDIR."local/navigator/conf/conf.dat"); $udata = explode("|",$ufile[0]);$udata[15]=$koll;for ($u=0; $u<$siti_config; $u++){$utext.=$udata[$u].'|';}$fp=fopen(BASEDIR."local/navigator/conf/conf.dat","a+"); flock($fp,LOCK_EX); ftruncate($fp,0); fputs($fp,$utext);fflush($fp);flock($fp,LOCK_UN);fclose($fp); unset($utext); header ("Location: avtor.php?".SID);}}


echo'</div><div class="btm">&#187; <a href="../index.php?'.SID.'">В город</a><br>';
echo'&#187; <a href="setting.php?">Настройки</a><br>';
echo'&#187; <a href="../../index.php?'.SID.'">На главную</a></div>';











} else {header ("Location: ../index.php?error&".SID);}} else {header ("Location: ../index.php?error&".SID);}

include_once "../../themes/$config_themes/foot.php";
?>