Добавить новость К списку новостей На главную Выход
"; } // ADD NEWS if($do=="addnews" and session_is_registered("adm")) { print"
Добавление новости
"; if(session_is_registered("adm")) { $author=$yourname; $authormail=$yourmail; $authorid="admin"; } ?>
>
Заголовок новости:
Текст новости:
Графический файл:
Описание к нему:
Rss:
 
/",">",$name); $name = preg_replace("/\:\:/","::",$name); $msg = preg_replace("/\:\:/","::",$msg); $msg = stripslashes($msg); $msg = preg_replace("/\r/","",$msg); $msg = preg_replace("/\n/","
",$msg); // added, v2 $newfile_alt = stripslashes($newfile_alt); $newfile_alt = preg_replace("/\"/",""",$newfile_alt); $newfile_alt = preg_replace("/\/",">",$newfile_alt); $newfile_alt = preg_replace("/\:\:/","::",$newfile_alt); if ($rss == "on") $rss = "1"; $random=date("U"); touch("comments/$random.dat"); chmod("comments/$random.dat",0777); $date=date("d.m.Y H:i:s"); $fp=@fopen("base.dat","a"); $fn=$_FILES['newfile']['name']; if ($fn != "") { $var = $HTTP_POST_FILES['newfile']['tmp_name']; copy ("$var","img/".$random."$fn"); chmod("img/".$random."$fn",0777); $size = getimagesize("img/".$random."$fn"); $info = "$date::$random::$author::$authormail::$authorid::$name::$msg::".$random."$fn::$size[0]::$size[1]::$fn2::$rss::".$newfile_alt."\r\n"; } else $info = "$date::$random::$author::$authormail::$authorid::$name::$msg::noimg.gif::30::40::$fn2::$rss::".$newfile_alt."\r\n"; fputs($fp,$info); fclose($fp); UpdateYandexNews(); print "
Спасибо! Новость добавлена
"; print ""; } } // EDIT NEWS if ($do=="editnews" and session_is_registered("adm")) { print "
Редактирование новостей
"; $File = file("base.dat"); list($Date,$Random,$Author,$Authormail,$Authorid,$Name,$Msg,$Fn,$X,$Y,$Fn2,$Rss,$Alt)=explode("::",$File[$id]); $Msg = eregi_replace("\r","",$Msg); $Msg = eregi_replace("
","\r\n",$Msg); $Fn2 = trim($Fn2); $Rss = ($Rss)?'checked':''; print"
Дата:
Автор:
E-mail:
Новость:
Новость:
Графический файл:
Описание к нему:
Rss:
 
"; if (isset($submit)) { $name = stripslashes($name); $name = preg_replace("/\"/",""",$name); $name = preg_replace("/\/",">",$name); $name = preg_replace("/\:/","::",$name); $name = preg_replace("/\:\:\:\:/","::::",$name); $msg = stripslashes($msg); $msg = preg_replace("/\r/","",$msg); $msg = preg_replace("/\n/","
",$msg); $msg = preg_replace("/\:\:/","::",$msg); $msg = preg_replace("/\:\:\:\:/","::::",$msg); $alt = trim($alt); $alt = stripslashes($alt); $alt = preg_replace("/\"/",""",$alt); $alt = preg_replace("/\/",">",$alt); $alt = preg_replace("/\:\:/","::",$alt); $alt = preg_replace("/\:\:\:\:/","::::",$alt); if ($rss == "on") $rss = "1"; $File[$id] = "$date::$random::$author::$authormail::$authorid::$name::$msg::$fn::$x::$y::$fn2::$rss::$alt"; $file = ""; foreach($File as $val) $file.=trim($val)."\r\n"; $_file = fopen("base.dat", "w+"); fwrite($_file, "$file"); fclose($_file); UpdateYandexNews(); print "
Изменения приняты!
"; print ""; } } // DELETE NEWS if($do==="deletenews" and session_is_registered("adm")) { if($flag=="") print "
Вы уверены, что хотите удалить новость ID: $id?
Да Нет
"; if($flag=="yes") { $File=file("base.dat"); list($Date,$Random,$Author,$Authormail,$Authorid,$Name,$Msg,$Fn,$X,$Y,$Fn2)=explode("::",$File[$id]); $Fn2=trim($Fn2); @unlink("comments/$Random.dat"); @unlink("files/$Fn2"); if ($Fn != "noimg.gif") @unlink("img/$Fn"); $file=file("base.dat"); $fp=fopen("base.dat","w"); for($i=0;$i"; } } if($do=="showarc" and session_is_registered("adm")) { include "news2.php"; } if($do=="logout") { session_destroy(); print ""; } ?>