View file reclama/add.php

File size: 2.14Kb
<?php

require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"../template/functions.php";
require_once"../template/antidos.php";
require_once"../template/cookies.php";
require_once"../template/gzip.php";
require_once"../template/header.php";
require_once"../template/referer.php";
include_once"../themes/$config_themes/index.php";
include_once"../template/isset.php";

if (isset($_POST['burl'])) $burl = $_POST['burl'];
if (isset($_POST['bname'])) $bname = $_POST['bname'];
if (isset($_POST['bb'])) $bb = $_POST['bb'];
if (isset($_POST['bsize'])) $bsize = $_POST['bsize'];
if (isset($_POST['bcolor'])) $bcolor = $_POST['bcolor'];

$burl = htmlspecialchars(stripslashes($burl));
$bname = htmlspecialchars(stripslashes($bname));
$bb = htmlspecialchars(stripslashes($bb));
$bsize = htmlspecialchars(stripslashes($bsize));
$bcolor = htmlspecialchars(stripslashes($bcolor));

if(empty($bname)){echo'<br><center><big>Заполните поле "Название сылки"!</big></center>';
include_once "../themes/$config_themes/foot.php";
exit;}
if(empty($burl)){echo'<br><center><big>Заполните поле "URL-ссылка"!</big></center>';
include_once "../themes/$config_themes/foot.php";
exit;}
if(isset($bname{50})){
echo'<br><center><big>Слишком длинное название ссылки! Максимум - 50симв.</big></center>';
include_once "../themes/$config_themes/foot.php";
exit;}
if(isset($burl{300})){
echo'<br><center><big>Слишком длинный url! Максимум - 300симв.</big></center>';
include_once "../themes/$config_themes/foot.php";
exit;}

include_once "data/set.php";

$burl = str_replace("|","I",$burl);
$bname = str_replace("|","I",$bname);

$text=$burl.'|<font color="'.$bcolor.'" size="'.$bsize.'"><'.$bb.'>'.$bname.'</'.$bb.'></font>|';

$text=str_replace("\r\n", "", $text);
$fp=fopen("data/list.dat","a+");
chmod ("data/list.dat", 0666);
flock($fp,LOCK_EX);
fputs($fp,"$text\r\n");
flock($fp,LOCK_UN);
fclose($fp);
chmod ("data/list.dat", 0666);
header ("Location: new.php?".SID);

?>