Вход Регистрация
Файл: muzxit.ru/stars/edit.php
Строк: 143
<?php

/**
 * @package     JohnCMS
 * @link        http://johncms.com
 * @copyright   Copyright (C) 2008-2011 JohnCMS Community
 * @license     LICENSE.txt (see attached file)
 * @version     VERSION.txt (see attached file)
 * @author      http://johncms.com/about
 */

define('_IN_JOHNCMS'1);
$headmod 'stars';
require(
'../incfiles/core.php');
$lng_stars core::load_lng('stars');
$lng_forum core::load_lng('forum');
if (isset(
$_SESSION['ref']))
    unset(
$_SESSION['ref']);
// Задаем заголовки страницы
$textl $lng_stars['stars'];    



if (
$rights 8) {
    require(
'../incfiles/head.php');
    echo 
functions::display_error($lng['error_wrong_data']);
    require(
'../incfiles/end.php');
    exit;
}
if(isset(
$_POST['submit']))
{
        
/*
        -----------------------------------------------------------------
        Получаем данные
        -----------------------------------------------------------------
        */
        
$name_star = isset($_POST['name']) ? trim($_POST['name']) : '';
        
$about_star = isset($_POST['about']) ? trim($_POST['about']) : '';
        
$namelat_star = isset($_POST['namelat']) ? trim($_POST['namelat']) : '';
        
$films_star = isset($_POST['films']) ? trim($_POST['films']) : '';
        
$birth_star = isset($_POST['birth']) ? trim($_POST['birth']) : '';
        
$where_born_star = isset($_POST['where_born']) ? trim($_POST['where_born']) : '';
        if (isset(
$_POST['submit']) && !empty($_POST['name'])) {
            
// Проверяем на минимальную длину
            
if (mb_strlen($name_star) < 4) {
                require(
'../incfiles/head.php');
                echo 
functions::display_error($lng['error_message_short'], '<a href="index.php?id=' $id '">' $lng['back'] . '</a>');
                require(
'../incfiles/end.php');
                exit;
            }
            
// Добавляем звезду в базу
            
mysql_query("UPDATE `stars` SET
                `name` = '
$name_star',
                `namelat` = '" 
mysql_real_escape_string($namelat_star) . "',
                `about` = '" 
mysql_real_escape_string($about_star) . "',
                `films` = '" 
mysql_real_escape_string($films_star) . "',
                `birth` = '" 
mysql_real_escape_string($birth_star) . "',
                `where_born` = '" 
mysql_real_escape_string($where_born_star) . "',
                `type` = '1'
                WHERE `id` = '
$id'
            "
);
           
              
header("Location: index.php?id=$id");
                }
        } else {
$req_star mysql_query("SELECT * FROM `stars` WHERE `id` = '$id'");
$res_star mysql_fetch_assoc($req_star);
$cats2_star $res_star['cid'] != mysql_fetch_assoc(mysql_query("select * from `stars` where `id` = '$res_star[cid]';")) : null;
$cats3_star $cats2_star['cid'] != mysql_fetch_assoc(mysql_query("select * from `stars` where `id` = '$cats2_star[cid]';")) : null;
require(
'../incfiles/head.php');
/*
---------------------------------
Верхнее меню навигации
---------------------------------
*/
echo '<div class="topmenu">
<div class="bmenu">'
 
. ($id ?  '<a href="index.php">' $lng_stars['stars'] . '</a>'
 
. ($cats3_star ' - <a href="index.php?id=' $cats3_star['id'] . '">' $cats3_star['name'] . '</a>' null)
 . (
$cats2_star != null ' - <a href="index.php?id=' $cats2_star['id'] . '">' $cats2_star['name'] . '</a>' null)
 . 
' - <a href="index.php?id=' $id '"><b>' $res_star['name'] . '</b></a>' '<b>' $lng_stars['stars'] . '</b>')
 . 
' - ' $set['copyright'] . '</div></div>';
 
            echo 
'<form name="form" action="edit.php?id=' $id '" method="post"><div class="gmenu">' .
            
$lng_stars['name'] . ' (max 25):<br/><input type="text" name="name" maxlength="25" value="' functions::checkout($res_star['name']) . '"/><br/>' .
            
$lng_stars['namelat'] . ' (max 25):<br/><input type="text" name="namelat" maxlength="25" value="' functions::checkout($res_star['namelat']) . '"/><br/>' .
            
$lng_stars['birth'] . ' (max 25):<br/><input type="text" name="birth" maxlength="25" value="' functions::checkout($res_star['birth']) . '"/><br/>' .
            
$lng_stars['where_born'] . ' (max 56):<br/><input type="text" name="where_born" maxlength="25" value="' functions::checkout($res_star['where_born']) . '"/><br/>' .
            
'<p>' $lng_stars['about'] . ':';
            if (!
$is_mobile)
                echo 
'</p><p>' bbcode::auto_bb('form''about');
            echo 
'<textarea rows="' $set_user['field_h'] . '" name="about">' functions::checkout($res_star['about']) . '</textarea></p>' .
            
'<p>' $lng_stars['films'] . ' (' $lng_stars['notice'] . '):<br/>';
            echo 
'<textarea rows="' $set_user['field_h'] . '" name="films">' functions::checkout($res_star['films']) . '</textarea></p>';
            echo 
'<p><input type="submit" name="submit" value="' $lng['sent'] . '" style="width: 107px; cursor: pointer;"/> ' .
                 
'</p></div></form>';
        }
        echo 
'<p><a href="index.php?id=' $id '">' $lng['back'] . '</a></p>';


 
 
/*
---------------------------------
Нижнее меню навигации
---------------------------------
*/
echo '<div class="topmenu">
<div class="bmenu">'
 
. ($id ?  '<a href="index.php">' $lng_stars['stars'] . '</a>'
 
. ($cats3_star ' - <a href="index.php?id=' $cats3_star['id'] . '">' $cats3_star['name'] . '</a>' null)
 . (
$cats2_star != null ' - <a href="index.php?id=' $cats2_star['id'] . '">' $cats2_star['name'] . '</a>' null)
 . 
' - <a href="index.php?id=' $id '"><b>' $res_star['name'] . '</b></a>' '<b>' $lng_stars['stars'] . '</b>')
 . 
' - ' $set['copyright'] . '</div></div>';
 require(
'../incfiles/end.php');
?>
Онлайн: 1
Реклама