<!--/***************** DO NOT REMOVE! *********************/---->
<!--/*   Author: Nevezhyn Evgeny  Date : 10/01/2003       */---->
<!--/*             All Rights Reserved ...                */---->
<!--/*        Supplied by WTN-WDYL Team `2004             */---->
<!--/***************** DO NOT MODIFY! *********************/---->

<html><head>
<?php
include("var.php");
echo"<title>Управление фотографиями : $sitename</title>";
include("top.php");
?>
<h3><center><strong>Управление фотографиями</strong></center></h3>
<?php
@$db=mysql_connect($bdhost,$bdlogin,$bdpass);
@mysql_select_db($bdname,$db);
$err2 = "Фотография должна иметь расширение *.jpg либо *.gif<br>";
$err3 = "Фотография должна иметь размер не более $MAX_FILE_SIZE байт.<br>";
$err4 = "Не указан путь к фотографии.<br>";
$error = "";
$n = getenv('REQUEST_URI');
$n = ereg_replace("\?.*$","",$n);
$result = @mysql_query("SELECT id,pass FROM $autortable WHERE (id = '$id' and pass = '$pass')");
if ((!isset($id) or !isset($pass)) or @mysql_num_rows($result) == 0)
{
echo "<center><br><br><h3>Вы не авторизированы!</h3><b><a href=autor.php>Авторизация</a></b>";
}
else
{//1
if ($QUERY_STRING != "add")
{ //2
$result = @mysql_query("SELECT foto1,foto2,foto3,foto4,foto5,aid,status FROM $saluntable WHERE aid = '$id'");
while ($myrow=mysql_fetch_array($result)) {
$foto1=$myrow["foto1"];
$foto2=$myrow["foto2"];
$foto3=$myrow["foto3"];
$foto4=$myrow["foto4"];
$foto5=$myrow["foto5"];
}
echo "<center><font color=red>$error</font></center>";
} //2
if ($QUERY_STRING == "add") {
if ($file1 != "") {
$file1 = $HTTP_POST_FILES['file1']['name'];
$filesize1 = $HTTP_POST_FILES['file1']['size']; 
$temp1 = $HTTP_POST_FILES['file1']['tmp_name'];
$fileres1=strtolower(basename($file1));
if ($file1 != "" and !strpos($fileres1,".jpg") and !strpos($fileres1,".gif")){$error .= "$err2";}
if ($filesize1 > $MAX_FILE_SIZE){$error .= "$err3";}
}
if ($file2 != "") {
$file2 = $HTTP_POST_FILES['file2']['name'];
$filesize2 = $HTTP_POST_FILES['file2']['size']; 
$temp2 = $HTTP_POST_FILES['file2']['tmp_name'];
$fileres2=strtolower(basename($file2));
if ($file2 != "" and !strpos($fileres2,".jpg") and !strpos($fileres2,".gif")){$error .= "$err2";}
if ($filesize2 > $MAX_FILE_SIZE){$error .= "$err3";}
}
if ($file3 != "") {
$file3 = $HTTP_POST_FILES['file3']['name'];
$filesize3 = $HTTP_POST_FILES['file3']['size']; 
$temp3 = $HTTP_POST_FILES['file3']['tmp_name'];
$fileres3=strtolower(basename($file3));
if ($file3 != "" and !strpos($fileres3,".jpg") and !strpos($fileres3,".gif")){$error .= "$err2";}
if ($filesize3 > $MAX_FILE_SIZE){$error .= "$err3";}
}
if ($file4 != "") {
$file4 = $HTTP_POST_FILES['file4']['name'];
$filesize4 = $HTTP_POST_FILES['file4']['size']; 
$temp4 = $HTTP_POST_FILES['file4']['tmp_name'];
$fileres4=strtolower(basename($file4));
if ($file4 != "" and !strpos($fileres4,".jpg") and !strpos($fileres4,".gif")){$error .= "$err2";}
if ($filesize4 > $MAX_FILE_SIZE){$error .= "$err3";}
}
if ($file5 != "") {
$file5 = $HTTP_POST_FILES['file5']['name'];
$filesize5 = $HTTP_POST_FILES['file5']['size']; 
$temp5 = $HTTP_POST_FILES['file5']['tmp_name'];
$fileres5=strtolower(basename($file5));
if ($file5 != "" and !strpos($fileres5,".jpg") and !strpos($fileres5,".gif")){$error .= "$err2";}
if ($filesize5 > $MAX_FILE_SIZE){$error .= "$err3";}
}
if (isset($upload) and $file1 == "" and $file2 == "" and $file3 == "" and $file4 == "" and $file5 == "") {$error .= "$err4";}
echo "<center><font color=red>$error</font></center>";
if ($QUERY_STRING == "add" and $error == "") {
if ($textconfirm=='TRUE') {$status='wait';$stroka='<b>После проверки изменений администратором информация будет добавлена в базу сайта.</b>';}
elseif ($textconfirm=='FALSE') {$status='ok';$stroka='<b>В течение нескольких минут изменения вступят в силу</b>';}
if (isset($upload)) {
$updir=$photodir;
$path1 = $upath."$updir";
$fileres1=@substr($fileres1,-3,3);
$fileres2=@substr($fileres2,-3,3);
$fileres3=@substr($fileres3,-3,3);
$fileres4=@substr($fileres4,-3,3);
$fileres5=@substr($fileres5,-3,3);
$source_name1="";
$source_name2="";
$source_name3="";
$source_name4="";
$source_name5="";
if ($file1 != "") {$source_name1 = "s".$id."_1.$fileres1";}
if ($file2 != "") {$source_name2 = "s".$id."_2.$fileres2";}
if ($file3 != "") {$source_name3 = "s".$id."_3.$fileres3";}
if ($file4 != "") {$source_name4 = "s".$id."_4.$fileres4";}
if ($file5 != "") {$source_name5 = "s".$id."_5.$fileres5";}
if($error == ""){
$dest1 = $path1.$source_name1;
$dest2 = $path1.$source_name2;
$dest3 = $path1.$source_name3;
$dest4 = $path1.$source_name4;
$dest5 = $path1.$source_name5;
if ($file1 != "") {@copy("$temp1","$dest1");$foto1=$updir."$source_name1";
$sql="update $saluntable SET foto1='$source_name1',status='$status' WHERE aid='$id'";
$result=@mysql_query($sql,$db);
}
if ($file2 != "") {@copy("$temp2","$dest2");$foto2=$updir."$source_name2";
$sql="update $saluntable SET foto2='$source_name2',status='$status' WHERE aid='$id'";
$result=@mysql_query($sql,$db);
}
if ($file3 != "") {@copy("$temp3","$dest3");$foto3=$updir."$source_name3";
$sql="update $saluntable SET foto3='$source_name3',status='$status' WHERE aid='$id'";
$result=@mysql_query($sql,$db);
}
if ($file4 != "") {@copy("$temp4","$dest4");$foto4=$updir."$source_name4";
$sql="update $saluntable SET foto4='$source_name4',status='$status' WHERE aid='$id'";
$result=@mysql_query($sql,$db);
}
if ($file5 != "") {@copy("$temp5","$dest5");$foto5=$updir."$source_name5";
$sql="update $saluntable SET foto5='$source_name5',status='$status' WHERE aid='$id'";
$result=@mysql_query($sql,$db);
}
}
}
if (isset($delete1) or isset($delete2) or isset($delete3) or isset($delete4) or isset($delete5)) {
unset($result);
if (isset($delete1)) {@unlink($upath.$photodir.$foto1);
$sql="update $saluntable SET foto1='',status='$status' WHERE aid='$id'";
$result=@mysql_query($sql,$db);
}
if (isset($delete2)) {@unlink($upath.$photodir.$foto2);
$sql="update $saluntable SET foto2='',status='$status' WHERE aid='$id'";
$result=@mysql_query($sql,$db);
}
if (isset($delete3)) {@unlink($upath.$photodir.$foto3);
$sql="update $saluntable SET foto3='',status='$status' WHERE aid='$id'";
$result=@mysql_query($sql,$db);
}
if (isset($delete4)) {@unlink($upath.$photodir.$foto4);
$sql="update $saluntable SET foto4='',status='$status' WHERE aid='$id'";
$result=@mysql_query($sql,$db);
}
if (isset($delete5)) {@unlink($upath.$photodir.$foto5);
$sql="update $saluntable SET foto5='',status='$status' WHERE aid='$id'";
$result=@mysql_query($sql,$db);
}
}
}
}
if ($QUERY_STRING != "add" or $error != "") {
$foto1upl="Фото 1: <input type=file name=file1 size=30><br>";
$foto2upl="Фото 2: <input type=file name=file2 size=30><br>";
$foto3upl="Фото 3: <input type=file name=file3 size=30><br>";
$foto4upl="Фото 4: <input type=file name=file4 size=30><br>";
$foto5upl="Фото 5: <input type=file name=file5 size=30><br>";
$foto1line="";
$foto2line="";
$foto3line="";
$foto4line="";
$foto5line="";
if ($foto1 != "")
{$foto1line="<td align=center><a href=$photodir$foto1 target=_blank><img src=$photodir$foto1 border=0 height=150></a><br><input type=submit name=delete1 value=Удалить></td>";
$foto1upl="";
}
if ($foto2 != "")
{$foto2line="<td align=center><a href=$photodir$foto2 target=_blank><img src=$photodir$foto2 border=0 height=150></a><br><input type=submit name=delete2 value=Удалить></td>";
$foto2upl="";
}
if ($foto3 != "")
{$foto3line="<td align=center><a href=$photodir$foto3 target=_blank><img src=$photodir$foto3 border=0 height=150></a><br><input type=submit name=delete3 value=Удалить></td>";
$foto3upl="";
}
if ($foto4 != "")
{$foto4line="<td align=center><a href=$photodir$foto4 target=_blank><img src=$photodir$foto4 border=0 height=150></a><br><input type=submit name=delete4 value=Удалить></td>";
$foto4upl="";
}
if ($foto5 != "")
{$foto5line="<td align=center><a href=$photodir$foto5 target=_blank><img src=$photodir$foto5 border=0 height=150></a><br><input type=submit name=delete5 value=Удалить></td>";
$foto5upl="";
}
echo ("
<form name=form method=post ENCTYPE=\"multipart/form-data\" action=schanfot.php?add>
<input type=hidden name=id value=$id>
<input type=hidden name=pass value=$pass>
<input type=hidden name=foto1 value=$foto1>
<input type=hidden name=foto2 value=$foto2>
<input type=hidden name=foto3 value=$foto3>
<input type=hidden name=foto4 value=$foto4>
<input type=hidden name=foto5 value=$foto5>
<table width=90%>
<tr>$foto1line
$foto2line
$foto3line
$foto4line
$foto5line
</tr>
<tr><td align=center colspan=6>&nbsp;</td></tr>
<tr><td align=center colspan=6>
$foto1upl
$foto2upl
$foto3upl
$foto4upl
$foto5upl
</td></tr>
</table>
");
echo "<center><p><input type=submit value=\"Загрузить\" name=\"upload\"></form>";
echo "<p align=center><a href=autor.php?id=$id&apass=$pass&submit=Войти>Вернуться в личный раздел</a></p>";
}
else {
echo "<br><br><h3 align=center>Изменения сохранены!</h3><br><br>$stroka<br><br><br><br><p align=center><a href=autor.php?id=$id&apass=$pass&submit=Войти>Вернуться в авторский раздел</a></p><br><br>";
$txt="На сайте $siteadress - изменены фотографии к салону/сауне. <a href=$siteadress/admin.php>Одобрить/Удалить</a>\nФото1: $source_name1\nФото2: $source_name2\nФото3: $source_name3\nФото4: $source_name4\nФото5: $source_name5";
if ($mailchange == 'TRUE')
{@mail($adminemail,"Изменение фотографий к салону/сауне",$txt,"Return-Path:$adminemail");}
}
} //1
mysql_close($db);
include("down.php");
?>