Создание web-узла по продаже услуг игрокам World Of Warcraft, страница 6

                if(mysql_query($query)) { echo "Запись добавлена <br><br> ";}

                 else {echo "Ошибка записи";};

                 }

                 else {echo "Введите текст";}

                 }

                 else {echo "Введите заголовок";}

                 }

                 else {

                 echo "Введите дату";               

                }

            }

            }

        }

        echo    "<form action='index.php?act=add_news&part=2' method=POST>

        <input type=hidden name=ordersend value=true>

        <input type=hidden name=data[1] value='Empty'>

        <table align=center valign=bottom width=600 cellpadding=0 cellspacing=2 style='border: 2px dotted #93969f; background-color: #f3f5f9; font-size:11pt;'>

            <tr>

                <td width=150 height=35>Дата (YYYY-MM-DD):</td>

                <td width=250><input type=text name=data[0]></td>

            </tr>

            <tr>

                <td valign=top width=150 height=55><br>Текст новости:</td>

                <td width=250><textarea name='data[2]' rows=10 cols=35 wrap='off'></textarea></td>

            </tr>

            <tr>

                <td colspan=2 align=center height=35><input type=submit name='add' value='Добавить'></td>

            </tr>

        </table>";

    }

    if ($act=="ed_news")  //редактирование новостей

    {

        if (isset($_GET['part']))

        {

            if ($_GET['part']=="ed_2")//

            {

                if (isset($_POST['text'])) $text=$_POST['text'];

                if (isset($_POST['id'])) $id=$_POST['id'];

                $q = mysql_query("UPDATE news SET text='$text' WHERE id='$id'");

            }

        }

        if (isset($_GET['accept']))

        {

            $num=$_GET['accept'];

            $q = mysql_query("DELETE FROM news WHERE id='$num'");

        }

        if (isset($_GET['ed'])) //==============================================================================================================================================

        {

            $id_ed=$_GET['ed'];

            $q = mysql_query("SELECT * FROM news WHERE id='$id_ed'");

            $r = mysql_fetch_array($q);

            echo "

            $r[text];<br>

            <form action='index.php?act=ed_news&part=ed_2' method=POST>

            <center><textarea rows=7 cols=25 name=text>$r[text]</textarea><br><br>

            <input type=hidden name=id value=$id_ed>

            <input type=submit name=ok value=Сохранить>

            </center>

            </form>

            ";

        }       

        echo "<div class=ord_text>";

        $q = mysql_query("SELECT * FROM news ORDER BY date DESC");

        echo "<table width=80% align=center cellpadding=1 border=0 cellspacing=2 style='border:1px solid #4f9fa8;'>";

        while($r = mysql_fetch_array($q))

        {

            echo"

            <tr>

                <td style='font-size: 10pt; background-color:#f1f1f1'>$r[date]</td>

                <td width=100 style='border: 1px dotted black;' rowspan=3 align=center>

                            <a href='index.php?act=ed_news&accept=". $r[id] ." ' class=main_lnk>удалить</a></td>

                <td width=100 style='border: 1px dotted black;' rowspan=3 align=center>

                            <a href='index.php?act=ed_news&ed=". $r[id] ." ' class=main_lnk>Изменить</a></td>

            </tr>

            <tr>

                <td style='background-color:#ecf6f5'>$r[title]</td>

            </tr>

            <tr>