Старый 25.03.2008, 12:04   #1 (permalink)
Новичок
 
Регистрация: 25.03.2008
Сообщений: 1
Репутация: 0
По умолчанию нужна помощь

дело в том:у мя есть поля которые надо заполнять если не заполняешь объявление не добавляется, когда я добавляю код защиты от "< >" проверка заполнение не работает?в чем проблема плиз помогите
PHP код:
<?php 
include("block/bd.php");
if (isset(
$_POST['title'])) {$title $_POST['title']; if ($title == ''){unset($title);}}
if (isset(
$_POST['meta_d'])) {$meta_d $_POST['meta_d'];if ($meta_d == ''){unset($meta_d);}}
if (isset(
$_POST['date'])) {$date $_POST['date'];if ($date== ''){unset($date);}}
if (isset(
$_POST['description'])) {$description $_POST['description'];if ($description == ''){unset($description);}}
if (isset(
$_POST['text'])) {$text$_POST['text'];if ($text == ''){unset($text);}}
if (isset(
$_POST['author'])) {$author$_POST['author'];if ($author == ''){unset($author);}}
if (isset(
$_POST['submit'])) {$submit$_POST['submit'];}
if (isset(
$submit))
{
if (isset(
$title)) {trim($title); }
else {
$title="";}
if (isset(
$meta_d)) {trim($meta_d); }
else {
$meta_d="";}
if (isset(
$date)) {trim($date); }
else {
$date="";}
if (isset(
$description)) {trim($description); }
else {
$description="";}
if (isset(
$text)) {trim($text); }
else {
$text="";}
if (isset(
$author)) {trim($author); }
else {
$author="";}




}
$title stripslashes($title);
$meta_d stripslashes($meta_d);
$date stripslashes($date);
$description stripslashes($description);
$author stripslashes($author);
$text stripslashes($text);
$title htmlspecialchars($title);
$meta_d htmlspecialchars($meta_d);
$date htmlspecialchars($date);
$description htmlspecialchars($description);
$author htmlspecialchars($author);
$text htmlspecialchars($text);
?>
<?php ?>


<HTML>
<HEAD>
<TITLE>обработ</TITLE>
<style type="text/css">
<!--
body,td,th {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
}
.style7 {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 14px;
}
.style8 {
    font-size: 12px;
    color: #666666;
}
.style11 {
    font-family: Geneva, Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: bold;
}
.style12 {
    font-size: 12px;
    font-weight: bold;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></HEAD>
<BODY LINK="#464545" ALINK="#9fb5b5" vlink="#666666">
<style type="text/css">
A {
 text-decoration: none; 

A:hover { 
 color: #5a8f96;

</style>
<TABLE width="980" cellpadding="0" cellspacing="0">
<!--шапка сайта-->
  <?php include("block/head.php");?>
</table>
<table width="980" cellspacing="0" cellpadding="0" background="bg.jpg">
  <tr>
    <td width="100" height="100" valign="top" rowspan="3" bgcolor="#ffffff">
     <table  cellspacing="0" cellpadding="0" width="185" height="142">
         <tr>
         <!--меню сайта-->
           <?php include("block/menu.php");?>
         </tr>
       </table>    </td>
    <td width="795" height="110" colspan="2" align="center" valign="middle" background="img/Downhead.jpg"><table width="177" height="52" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <th width="177" scope="col"><a href="new_add_ob.php"><span class="style8">--&gt;Добавить объявление</span></a></th>
      </tr>
    </table>    </td>
  </tr>
  <tr>
    <td width="673" height="400" align="left" valign="top" bgcolor="#ffffff" class="style7">
    
    
    
    <p class="style7"><?php 
    

    
    
    
    
if ((isset($title)) and (isset($meta_d)) and (isset($date)) and (isset($description)) and (isset($text)) and (isset($author)))
    {
        
$azat =mysql_query ("INSERT INTO obiav (title,meta_d,date,description,text,author) VALUES('$title','$meta_d','$date','$description','$text','$author')");

    
    if (
$azat == "true")  {echo "<p>объявление добавлена</p>";}
    
    
    else {echo 
"<p>объявление не добавлена</p>";}
    }
    else
    {
    echo  (
"<p>Вы ввели не всю информацию <br><input name='back' type='button' value='Вернуться назад' onclick='javascript:self.back();'></p>"); 
    }


    
    
?></p></td>
    <!--правый край-->
    <?php include("block/pravkr.php");?>
  </tr>
  <!--после текста-->
  <?php include("block/dopodvl.php");?>
  <!--нижняя часть-->
  <?php include("block/podval.php");?>
</TABLE>
</BODY>
</HTML>

Последний раз редактировалось AleX; 25.03.2008 в 15:02.
astec вне форума  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post! Добавить в закладки Google
Ответить с цитированием
Старый 25.03.2008, 23:40   #2 (permalink)
Администратор
 
Аватар для Devil
 
Специализация: Кодер
Регистрация: 05.12.2007
Адрес: Москва
Сообщений: 3,699
Репутация: 1729
Номер ICQ 599613
По умолчанию Ответ: нужна помощь

astec, ни чё не понял Объясни что тебе надо-то ?
__________________
Мы те, кто мы есть
Мой личный блог
Devil вне форума  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post! Добавить в закладки Google
Ответить с цитированием
Старый 03.04.2008, 16:11   #3 (permalink)
Новичок
 
Аватар для Asid Storm
 
Специализация: Кодер
Регистрация: 03.04.2008
Адрес: Москва
Сообщений: 9
Репутация: 3
Номер ICQ 20020440
По умолчанию Ответ: нужна помощь

Может быть надо писать не
$title = stripslashes($title);
А
$title = stripslashes($_POST['title']);
Asid Storm вне форума  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post! Добавить в закладки Google
Ответить с цитированием
Ответ


Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
 
Опции темы
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения
Быстрый переход

Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Нужна раскрутка NecroS SEO оптимизация 1 21.10.2008 16:52
Блочная верстка! нужна помощь! NetStranger CSS и HTML верстка 6 27.08.2008 22:45
Нужна помощь в css Blacksmith CSS и HTML верстка 1 22.08.2008 23:01
нужна Помощь (не психиатрическая вроде бы) Fantomas Я - новенький! 7 11.08.2008 14:37
Нужна помощь по CSS Blacksmith Предоставление работы 1 29.06.2008 20:16



Часовой пояс GMT +4, время: 11:51.
Powered by vBulletin® Version 7.51.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Web Mastering By Devil Art