File size: 4.02Kb
<?
Error_Reporting(E_ALL & ~E_NOTICE);
session_start();
require ('../data/config.php');
require ('../data/mysql.php');
require ('../data/functions.php');
require ('../data/mail.php');
if ($cookie_user<>$admin_login and $cookie_passwd<>$admin_passw)
{
header("Location:/index.php?err=falce");
exit();
}
?>
<html>
<head> <meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml" charset="utf-8"/>
<title>Администраторская - <? print "$site_title";?></title>
<? require ('../html/style.php');?>
</head>
<BODY BGCOLOR=#D3DDF4 LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<center>
<? require ('../html/up_admin.php');?>
<?
if ($action=="edit")
{
$result= mysql_query("UPDATE faq SET
q='$q',
a='$a'
WHERE id='$id'");
print "<br><font color=green><b>изменения внесены</b><br>";
}
if ($action=="add")
{
$result= mysql_query("INSERT INTO faq (q,a) VALUES ('$q','$a')");
print "<br><font color=green><b>добавлено</b><br>";
}
if ($action=="del")
{
$result= mysql_query("DELETE FROM faq WHERE id='$id'");
print "<br><font color=green><b>удалено</b><br>";
}
print "<center class=p><b>FAQ</b></center>";
print "
<center class=p><br>
<b>ДОБАВИТЬ ВОПРОС:</b>
<TABLE WIDTH=600 BORDER=0 CELLPADDING=2 CELLSPACING=2>
<form action=$PHP_SELF method=post>
<tr>
<td align=left valign=top class=p>
<b>вопрос:</td>
<td align=left valign=top class=p>
<TEXTAREA rows=2 cols=100 name=q class=p></TEXTAREA>
</td>
</tr>
<tr>
<td align=left valign=top class=p>
<b>ответ:</td>
<td align=left valign=top class=p>
<TEXTAREA rows=5 cols=100 name=a class=p></TEXTAREA></td>
</tr>
<tr>
<td align=left valign=top class=p>
<input type=hidden name=action value=add></td>
<td align=left valign=top class=p>
<input type=submit value=\"добавить\" class=p></td>
</tr>
</form>
</table>
<bR><b>ВОПРОСЫ И ОТВЕТЫ:</b>
</center>
";
$result= mysql_query("SELECT * FROM faq");
while ($row = mysql_fetch_array($result))
{
print "
<center><br>
<TABLE WIDTH=600 BORDER=0 CELLPADDING=2 CELLSPACING=2>
<form action=$PHP_SELF method=post>
<tr>
<td align=left valign=top class=p>
<b>вопрос:</td>
<td align=left valign=top class=p>
<TEXTAREA rows=2 cols=100 name=q class=p>$row[q]</TEXTAREA>
</td>
</tr>
<tr>
<td align=left valign=top class=p>
<b>ответ:</td>
<td align=left valign=top class=p>
<TEXTAREA rows=5 cols=100 name=a class=p>$row[a]</TEXTAREA></td>
</tr>
<tr>
<td align=left valign=top class=p>
<input type=hidden name=id value=$row[id]>
<input type=hidden name=action value=edit></td>
<td align=left valign=top class=p>
<input type=submit value=\"изменить\" class=p> <a href=$PHP_SELF?action=del&id=$row[id] class=p>удалить</a></td>
</tr>
</form>
</table>
</center>";
}
?>
</center>
</body>
</html>