| |
|
|
| | Код удаления и редактирвоаняи сообещений, тока что то видимо задел :( час ищу что где (
Не как блин ((
Помогите найти ошибку, почему не удаляются сообщения :(
<?php
$admin_login = "1";
$admin_password = "1";
function auth ()
{
global $nameurl;
Header ("WWW-Authenticate: Basic realm=\"http auth via php\"");
Header ("HTTP/1.0 401 Unauthorized");
echo "Please enter login and password to your account";
exit;
}
if (@empty ($_SERVER["PHP_AUTH_USER"])) auth ();
if ($_SERVER["PHP_AUTH_USER"] != $admin_login or $_SERVER["PHP_AUTH_PW"] != $admin_password) auth ();
?>
<?
Error_Reporting(E_ALL & ~E_NOTICE);
include("config.html");
?>
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=windows-1251">
</head>
<?
$name=str_replace("\r\n","<br>",$name);
$name=str_replace("\n","<br>",$name);
$msg=str_replace("\r\n","<br>",$msg);
$msg=str_replace("\n","<br>",$msg);
$answer=str_replace("\r\n","",$answer);
$answer=str_replace("\n","",$answer);
$msg=str_replace("\r\n","<br>",$msg);
$msg=str_replace("\n","<br>",$msg);
function replace ($string)
{
$string = stripslashes($string);
$string = ereg_replace('\\\"',""",$string);
$string = ereg_replace("!","!",$string);
$string = ereg_replace("%","%",$string);
$string = ereg_replace("^ +","",$string);
$string = ereg_replace(" +$","",$string);
$string = ereg_replace(" +"," ",$string);
return $string;
}
?>
<left>
<?
$general = file("$base");
if (isset($action))
{
if ($action == "$a7" or $action == "$a8")
{
$editor = fopen("$base","w");
for ($j = 0; $j < count($general); $j++)
{
if ($j != $number)
{
fputs($editor,$general[$j]);
}
else
{
if ($action == "$a8")
{
$from = replace($from);
$into = replace($into);
$name = replace($name);
$msg = replace($msg);
$mail = replace($mail);
$city = replace($city);
$homepage = replace($homepage);
$answer = replace($answer);
$date = replace($date);
$ip = replace($ip);
fputs($editor,"$name::$mail::$msg::$data::$ip::$answer\r\n");
}
}
}
fclose($editor);
$general = file("$base");
}
}
$messages = count($general);
$pmessages = file("$base");
if ($page == "")
{
$page = "1";
}
$first = count($pmessages) - ($onlyp * ($page - 1));
$second = count($pmessages) - ($onlyp * $page) + 1;
if ($second < 1)
{
$second = 1;
}
$pages = (int) ((count($pmessages) + $onlyp) / $onlyp);
$line = "";
for ($onlyp = 1; $onlyp <= $pages; $onlyp++)
{
if ($onlyp != $page)
{
$line .= "<a href=\"admin.html?p=$p&page=$onlyp\">$onlyp</a> ";
}
if ($onlyp == $page)
{
$line .= "$onlyp ";
}
}
for ( $i = $first-1; $i >= $second-1; $i--)
{
list($name,$mail,$msg,$data,$ip,$answer) = explode("::", $general[$i]);
if ($messages != "0")
{
$answer = str_replace("<br>","\r\n",$answer);
$msg = str_replace("<br>","\r\n",$msg);
$id = $i;
$id++;
echo "<form action=admin.html method=\"get\">
<p align=left>
<input type=\"hidden\" name=\"p\" value=\"$p\"><input type=text name=mail value=\"$mail\" size=30>
<font face=verdana size=1>Сообщение номер </font>
<font face=verdana size=1 color=000000>$a10 $id</font></B><input type=submit name=action value=Изменить!><BR>
<input type=text name=name value=\"$name\"><input type=text name=ip value=\"$ip\" size=30> <input type=submit name=action1 value=Удалить!><br>
<textarea rows=7 cols=73 name=msg>$msg</textarea><br>
<textarea rows=7 cols=73 name=answer>$answer</textarea><br>
<input type=hidden name=menu value=msg>
<input type=hidden name=page value=$page>
<input type=hidden name=number value=$i></form>";
}
}
if ($messages <= 0)
print "Сообщений нет";
if ($messages > "0")
{
echo "<br>$line<br>";
}
?>
</center>
</body>
</html>
</body>
</html>
|
| |
| |
|
|
| |
|
|
| |
для: Panker
(27.06.2006 в 17:42)
| | | Error_Reporting(E_ALL & ~E_NOTICE);
надо ставить в начале а не где-то в середине.
и для вас надо ставить Error_Reporting(E_ALL) | |
| |
|
|
| |
|
|
| |
для: RV
(27.06.2006 в 20:22)
| | | дело то не в этмо ) | |
| |
|
|
| |
|
|
| |
для: Panker
(27.06.2006 в 21:22)
| | | Ты бы выложил часть, которая удаляет. | |
| |
|
|
| |
|
|
| |
для: Ziq
(27.06.2006 в 22:20)
| | | в этом коде она есть )) вот тока где я без понятия ) | |
| |
|
|
| |
|
|
| |
для: Panker
(28.06.2006 в 16:02)
| | | что то про меян все забыли :( помогите не удаляет :( господи всё исковырял :( | |
| |
|
|
| |
|
|
| |
для: Panker
(29.06.2006 в 21:31)
| | | А что именно за ошибка?
какая вылезает и т.п. | |
| |
|
|
| |
|
|
| |
для: CrazyAngel
(29.06.2006 в 21:34)
| | | не чгео не вылезает, прсото не удаляется строка и всё :( | |
| |
|
|