Размер файла: 1.61Kb
<?php
include '../sys/db.php';
include '../sys/conf.php';
include '../sys/start.php';
include '../sys/functions.php';
$config_title_name = "Добавить шутку";
include '../style/head.php';
echo "<div class=title>Добавить шутку</div>\n";
if(isset($user['login'])){
if( isset($user['level']) || $user['level']=='1' || $user['level']=='2' || $user['level']=='3'){
$act = isset($_GET['act']) ? $_GET['act'] : '';
switch($act){
default:
echo "<div class=content>\n";
if ($_GET['isset']==yes) {echo "Шутка успешно добавленна!\n<br><br>";}
if ($_GET['isset']==no) {echo "Шутка не добавленна!\n<br><br>";}
echo "<form action='add_joke.php?act=add' method='post' name='reg'>\n";
echo "Шутка: <br><textarea name='text' cols='30' rows='5'></textarea><br><br>\n";
echo "<input type='submit' value='Добавить'></form>\n";
echo "</div>\n";
echo "<div class=stat><a href='index.php'>Админка</a></div>\n";
echo "<div class=stat><a href='../index.php'>Прихожая</a></div>\n";
break;
case('add'):
$text = htmlspecialchars(stripslashes(trim($_POST['text'])));
$text = str_replace("'",''',$text);
$text = str_replace("\$",'$',$text);
$text = str_replace("$",'$',$text);
$add = mysql_query ("INSERT INTO `сhat_joker` (text) VALUES ('$text')");
if ($add == 'true'){
header ("Location: add_joke.php?isset=yes"); exit;
}else{
header ("Location: add_joke.php?isset=no"); exit;}
break;
}}
if(isset($user['level']) && $user['level']=='0'){
header ("Location: ../index.php"); exit;}
} else {header ("Location: ../index.php"); exit;}
include '../style/foot.php';
?>