PHP: <? include"params.php"; session_start(); if(session_is_registered("adm")) { print"<font face=Verdana size=2> <a href=admin.php?do=addnews>Äîáàâèòü íîâîñòü</a> <a href=admin.php?do=addmoderator>Äîáàâèòü ìîäåðàòîðà</a> <a href=admin.php?do=moderatorslist>Ñïèñîê ìîäåðàòîðîâ</a> <a href=admin.php?do=showfiles>Ñïèñîê çàêà÷åííûõ ôàéëîâ</a> <a href=>Íà ãëàâíóþ</a> <a href=admin.php?do=logout>Âûõîä</a> </font><HR size=1 color=#000000>"; } if($do=="addnews" and session_is_registered("adm")) { print"<div align=center><font face=Verdana size=3>Äîáàâëåíèå íîâîñòè</font></div>"; if(session_is_registered("adm")) { $author=$yourname; $authormail=$yourmail; $authorid="admin"; } ?> <form ENCTYPE="multipart/form-data" method="post"> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value=<?print$maxfsize;?>> <table width="100%" border="0"> <tr> <td width="22%"><font face=Verdana size=2><B>Ä</B>îáàâèë:</font></td> <td width="78%"><font face=Verdana size=2><B><?print$author;?></B></font></td> </tr> <tr> <td width="22%"><font face=Verdana size=2><B>Ç</B>àãîëîâîê íîâîñòè:</font></td> <td width="78%"><input type=text name=name style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid"></td> </tr> <tr> <td width="22%"><font face=Verdana size=2><B>Ò</B>åêñò íîâîñòè:</font></td> <td width="78%"><textarea name="msg" cols="70" rows="20" style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid"></textarea></td> </tr> <tr> <td width="22%"><font face=Verdana size=2><B>Ã</B>ðàôè÷åñêèé ôàéë:</font></td> <td width="78%"><input type=file name=newfile style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid"></td> </tr> <tr> <td width="22%"><font face=Verdana size=2><B>Î</B>áû÷íûé ôàéë:</font></td> <td width="78%"><input type=file name=newfile2 style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid"></td> </tr> <tr> <td width="22%"> </td> <td width="78%"> <input type=submit name=submit value=Äîáàâèòü! style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BACKGROUND: ffffff;"> </td> </tr> </table> </form> <? if(isset($submit) and $msg!="") { $name = stripslashes($name); $name = ereg_replace("<","<",$name); $name = ereg_replace(">",">",$name); $name = ereg_replace("::","::",$name); $msg = ereg_replace("::","::",$msg); $msg = ereg_replace("<","<",$msg); $msg = ereg_replace(">",">",$msg); $msg = stripslashes($msg); $msg = ereg_replace("\r","",$msg); $msg = ereg_replace("\n","<br>",$msg); $random=date("U"); touch("comments/$random.dat"); chmod("comments/$random.dat",0777); $date=date("d.m.Y"); $fp=@fopen("base.dat","a"); $fn=$_FILES['newfile']['name']; $var = $HTTP_POST_FILES['newfile']['tmp_name']; copy ("$var","img/$fn"); chmod("img/$fn",0777); $size = getimagesize("img/$fn"); $fn2=$_FILES['newfile2']['name']; $var = $HTTP_POST_FILES['newfile2']['tmp_name']; copy ("$var","files/$fn2"); chmod("files/$fn2",0777); $info = "$date::$random::$author::$authormail::$authorid::$name::$msg::$fn::$size[0]::$size[1]::$fn2\r\n"; fputs($fp,$info); fclose($fp); print "<div align=\"center\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\">Ñïàñèáî! Íîâîñòü äîáàâëåíà</font></div>"; print "<meta http-equiv=refresh content='1; url=admin.php?do='>"; } } if($do=="addmoderator" and session_is_registered("adm")) { print"<div align=center><font face=Verdana size=3>Äîáàâëåíèå ìîäåðàòîðà</font><BR></div>"; ?> <form method="post"> <table width="100%" border="0"> <tr> <td width="22%"><font face=Verdana size=2><B>Ë</B>îãèí:</font></td> <td width="78%"><input type=text name=logi style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid"></td> </tr> <tr> <td width="22%"><font face=Verdana size=2><B>Ï</B>àðîëü:</font></td> <td width="78%"><input type=text name=passw style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid"></td> </tr> <tr> <td width="22%"><font face=Verdana size=2><B>È</B>ìÿ:</font></td> <td width="78%"><input type=text name=name style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid"></td> </tr> <tr> <td width="22%"><font face=Verdana size=2><B>E</B>-mail:</font></td> <td width="78%"><input type=text name=mail style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid"></td> </tr> <tr> <td width="22%"> </td> <td width="78%"> <input type=submit name=submit value=Ñîçäàòü! style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BACKGROUND: ffffff;"> </td> </tr> </table> </form> <? if(isset($submit)) { touch("moders/$logi"); chmod("moders/$logi",0777); $fp=@fopen("moders/$logi","w"); $info = "$logi::$passw::$name::$mail"; fputs($fp,$info); fclose($fp); print "<div align=\"center\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\">Ìîäåðàòîð ñîçäàí!</font></div>"; print "<meta http-equiv=refresh content='0; url=admin.php?do=moderatorslist'>"; } } if($do=="moderatorslist" and session_is_registered("adm")) { print"<div align=center><font face=Verdana size=3>Ñïèñîê ìîäåðàòîðîâ</font><BR><font face=Verdana size=2><a href=admin.php?do=>Íà ãàâíóþ</a></font></div>"; if ($dir=opendir('moders')) { while (false!==($file=readdir($dir))) { if ($file != "." && $file != ".." && $file != ".htaccess") { $f=file("moders/$file"); list($modlog,$modpass,$n,$m)=split("::",$f[0]); print"<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\">Ëîãèí: <B>$modlog</B><BR>Ïàðîëü: <B>$modpass</B><BR><I>$n <a href=mailto:$m>$m</a></I> <a href=admin.php?do=delmoder&id=$modlog>Óäàëèòü</a> <a href=admin.php?do=editmod&id=$modlog>Èçìåíèòü</a><BR><BR></font>"; } } closedir($dir); } } if($do=="editmod" and session_is_registered("adm")) { print"<div align=center><font face=Verdana size=3>Ðåäàêòèðîâàíèå ìîäåðàòîðà</font><BR></div>"; $File=file("moders/$id"); list($Modlog,$Modpass,$N,$M)=split("::",$File[0]); ?> <form method="post"> <input type=hidden name=modlog value=<?print $Modlog;?>> <table width="100%" border="0"> <tr> <td width="22%"><font face=Verdana size=2><B>Ï</B>àðîëü:</font></td> <td width="78%"><input type=text name=modpass value=<?print $Modpass;?> style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid"></td> </tr> <tr> <td width="22%"><font face=Verdana size=2><B>È</B>ìÿ:</font></td> <td width="78%"><input type=text name=n value=<?print $N;?> style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid"></td> </tr> <tr> <td width="22%"><font face=Verdana size=2><B>E</B>-mail:</font></td> <td width="78%"><input type=text name=m value=<?print $M;?> style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid"></td> </tr> <tr> <td width="22%"> </td> <td width="78%"> <input type=submit name=submit value=Èçìåíèòü! style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BACKGROUND: ffffff;"> </td> </tr> </table> </form> <? if(isset($submit)) { $File[0]="$modlog::$modpass::$n::$m"; $file=""; foreach($File as $val) $file.=trim($val)."\r\n"; $_file=fopen("moders/$id", "w+"); fwrite($_file, "$file"); fclose($_file); print "<div align=\"center\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\">Èçìåíåíèÿ ïðèíÿòû!</font></div>"; print "<meta http-equiv=refresh content='1; url=admin.php?do=moderatorslist'>"; } } if($do=="delmoder" and session_is_registered("adm")) { if($flag=="") print "<div align=\"center\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\">Âû óâåðåíû, ÷òî õîòèòå óäàëèòü ìîäåðàòîðà <B>$id</B>?<BR><a href=admin.php?do=delmoder&id=$id&flag=yes>Äà</a> <a href=admin.php?do=moderatorslist>Íåò</a></font></div>"; if($flag=="yes") { unlink("moders/$id"); print "<div align=\"center\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\">Ìîäåðàòîð <B>$id</B> óäàëåí!</font></div>"; print "<meta http-equiv=refresh content='1; url=admin.php?do=moderatorslist'>"; } } if($do=="editnews" and session_is_registered("adm")) { print"<div align=center><font face=Verdana size=3>Ðåäàêòèðîâàíèå íîâîñòåé</font><BR></div>"; $File=file("base.dat"); list($Date,$Random,$Author,$Authormail,$Authorid,$Name,$Msg,$Fn,$X,$Y,$Fn2)=split("::",$File[$id]); $Msg = eregi_replace("\r","",$Msg); $Msg = eregi_replace("<br>","\r\n",$Msg); $Fn2=trim($Fn2); print" <form method=\"post\"> <input type=hidden name=authorid value=$Authorid> <input type=hidden name=fn value=$Fn> <input type=hidden name=fn2 value=$Fn2> <input type=hidden name=x value=$X> <input type=hidden name=y value=$Y> <input type=hidden name=random value=$Random> <table width=\"100%\" border=\"0\"> <tr> <td width=\"22%\"><font face=Verdana size=2><B>Ä</B>àòà:</font></td> <td width=\"78%\"><input type=text name=date value=$Date style=\"BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid\"></td> </tr> <tr> <td width=\"22%\"><font face=Verdana size=2><B>À</B>âòîð:</font></td> <td width=\"78%\"><input type=text name=author value=$Author style=\"BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid\"></td> </tr> <tr> <td width=\"22%\"><font face=Verdana size=2><B>E</B>-mail:</font></td> <td width=\"78%\"><input type=text name=authormail value=$Authormail style=\"BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid\"></td> </tr> <tr> <td width=\"22%\"><font face=Verdana size=2><B>Í</B>îâîñòü:</font></td> <td width=\"78%\"><input name=\"name\" type=\"text\" value=\"$Name\" style=\"BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid\"></td> </tr> <tr> <td width=\"22%\"><font face=Verdana size=2><B>Í</B>îâîñòü:</font></td> <td width=\"78%\"><textarea name=\"msg\" cols=\"40\" rows=\"10\" style=\"BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid\">$Msg</textarea></td> </tr> <tr> <td width=\"22%\"> </td> <td width=\"78%\"> <input type=submit name=submit value=Èçìåíèòü! style=\"BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BACKGROUND: ffffff;\"> </td> </tr> </table> </form>"; if(isset($submit)) { $name = stripslashes($name); $name = ereg_replace("<","<",$name); $name = ereg_replace(">",">",$name); $name = ereg_replace("::","::",$name); $name = ereg_replace("::::","::::",$name); $msg = stripslashes($msg); $msg = ereg_replace("\r","",$msg); $msg = ereg_replace("\n","<br>",$msg); $msg = ereg_replace("::","::",$msg); $msg = ereg_replace("::::","::::",$msg); $File[$id]="$date::$random::$author::$authormail::$authorid::$name::$msg::$fn::$x::$y::$fn2"; $file=""; foreach($File as $val) $file.=trim($val)."\r\n"; $_file=fopen("base.dat", "w+"); fwrite($_file, "$file"); fclose($_file); print "<div align=\"center\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\">Èçìåíåíèÿ ïðèíÿòû!</font></div>"; print "<meta http-equiv=refresh content='1; url='>"; } } if($do==="deletenews" and session_is_registered("adm")) { if($flag=="") print "<div align=\"center\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\">Âû óâåðåíû, ÷òî õîòèòå óäàëèòü íîâîñòü ID: <B>$id</B>?<BR><a href=admin.php?do=deletenews&id=$id&flag=yes>Äà</a> <a href=\"javascript:history.back(1)\">Íåò</a></font></div>"; if($flag=="yes") { $File=file("base.dat"); list($Date,$Random,$Author,$Authormail,$Authorid,$Name,$Msg,$Fn,$X,$Y,$Fn2)=split("::",$File[$id]); $Fn2=trim($Fn2); unlink("comments/$Random.dat"); @unlink("files/$Fn2"); @unlink("img/$Fn"); $file=file("base.dat"); $fp=fopen("base.dat","w"); for($i=0;$i<sizeof($file);$i++) { if($i==$id) { unset($file[$i]); } } fputs($fp,implode("",$file)); fclose($fp); print "<meta http-equiv=refresh content='1; url=index.php'>"; } } if($do=="showfiles" and session_is_registered("adm")) { print"<div align=center><font face=Verdana size=3>Ñïèñîê çàêà÷åííûõ ôàéëîâ</font><BR><font face=Verdana size=2><a href=admin.php?do=>Íà ãàâíóþ</a></font></div>"; if ($dir=opendir('files')) { while (false!==($file=readdir($dir))) { if ($file != "." && $file != ".." && $file != ".htaccess") { print"<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\"><a href=files/$file>$file</a> <a href=admin.php?do=delfile&name=$file&flag=>Óäàëèòü</a><BR><BR></font>"; } } closedir($dir); } } if($do=="delfile" and session_is_registered("adm")) { if($flag=="") print "<div align=\"center\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\">Âû óâåðåíû, ÷òî õîòèòå óäàëèòü <B>$name</B>?<BR><a href=admin.php?do=delfile&name=$name&flag=yes>Äà</a> <a href=admin.php?do=showfiles>Íåò</a></font></div>"; if($flag=="yes") { unlink("files/$name"); print "<div align=\"center\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\"><B>$name</B> óäàëåí!</font></div>"; print "<meta http-equiv=refresh content='1; url=admin.php?do=showfiles'>"; } } if($do=="answer" and session_is_registered("adm")) { $File=file("comments/$random.dat"); list($Date,$Name,$Mail,$Msg,$Answer)=split("::",$File[$id]); $Msg=trim($Msg); $Msg = eregi_replace("\r","",$Msg); $Msg = eregi_replace("<br>","\r\n",$Msg); $Answer=trim($Answer); $Answer = eregi_replace("\r","",$Answer); $Answer = eregi_replace("<br>","\r\n",$Answer); print"<div align=center><font face=Verdana size=3>Ðåäàêòèðîâàíèå / îòâåò êîììåíòàðèÿ</font><BR></div>"; print" <form method=\"post\"> <table width=\"100%\" border=\"0\"> <tr> <td width=\"22%\"><font face=Verdana size=2><B>Ä</B>àòà:</font></td> <td width=\"78%\"><input type=text name=date value=$Date style=\"BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid\"></td> </tr> <tr> <td width=\"22%\"><font face=Verdana size=2><B>À</B>âòîð:</font></td> <td width=\"78%\"><input type=text name=name value=$Name style=\"BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid\"></td> </tr> <tr> <td width=\"22%\"><font face=Verdana size=2><B>E</B>-mail:</font></td> <td width=\"78%\"><input type=text name=mail value=$Mail style=\"BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid\"></td> </tr> <tr> <td width=\"22%\"><font face=Verdana size=2><B>Ê</B>îììåíòàðèé:</font></td> <td width=\"78%\"><textarea name=\"msg\" cols=\"40\" rows=\"10\" style=\"BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid\">$Msg</textarea></td> </tr> <tr> <td width=\"22%\"><font face=Verdana size=2><B>Î</B>òâåò:</font></td> <td width=\"78%\"><textarea name=\"answer\" cols=\"40\" rows=\"10\" style=\"BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid\">$yourname:\r\n$Answer</textarea></td> </tr> <tr> <td width=\"22%\"> </td> <td width=\"78%\"> <input type=submit name=submit value=Èçìåíèòü! style=\"BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BACKGROUND: ffffff;\"> </td> </tr> </table> </form>"; if(isset($submit)) { $name = stripslashes($name); $name = ereg_replace("<","<",$name); $name = ereg_replace(">",">",$name); $name = ereg_replace("::","::",$name); $name = ereg_replace("::::","::::",$name); $msg = stripslashes($msg); $msg = ereg_replace("\r","",$msg); $msg = ereg_replace("\n","<br>",$msg); $msg = ereg_replace("::","::",$msg); $msg = ereg_replace("::::","::::",$msg); $answer = stripslashes($answer); $answer = ereg_replace("\r","",$answer); $answer = ereg_replace("\n","<br>",$answer); $answer = ereg_replace("::","::",$answer); $answer = ereg_replace("::::","::::",$answer); $File[$id]="$date::$name::$mail::$msg::$answer"; $file=""; foreach($File as $val) $file.=trim($val)."\r\n"; $_file=fopen("comments/$random.dat", "w+"); fwrite($_file, "$file"); fclose($_file); print "<div align=\"center\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\">Èçìåíåíèÿ ïðèíÿòû!</font></div>"; print "<meta http-equiv=refresh content='1; url=index.php?show=comments&id=$back'>"; } } if($do=="deletecomm" and session_is_registered("adm")) { if($flag=="") print "<div align=\"center\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\">Âû óâåðåíû, ÷òî õîòèòå óäàëèòü êîììåíòàðèé ID: <B>$id</B>?<BR><a href=moder.php?do=deletecomm&id=$id&random=$random&back=$back&flag=yes>Äà</a> <a href=\"javascript:history.back(1)\">Íåò</a></font></div>"; if($flag=="yes") { $file=file("comments/$random.dat"); $fp=fopen("comments/$random.dat","w"); for($i=0;$i<sizeof($file);$i++) { if($i==$id) { unset($file[$i]); } } fputs($fp,implode("",$file)); fclose($fp); print "<meta http-equiv=refresh content='1; url=index.php?show=comments&id=$back'>"; } } if($do=="logout") { session_destroy(); print "<meta http-equiv=refresh content='1; url=login.php'>"; } ?>