Вход Регистрация
Файл: muzxit.ru/stars/add.php
Строк: 116
<?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['add'];    

//require('../incfiles/head.php');
$agn1 strtok($agn' ');
$type mysql_query("SELECT * FROM `stars` WHERE `id` = '$id'");
$type1 mysql_fetch_assoc($type);
if(isset(
$_POST['submit']))
{
        
/*
        -----------------------------------------------------------------
        Получаем данные
        -----------------------------------------------------------------
        */
        
$name = isset($_POST['name']) ? trim($_POST['name']) : '';
        
$about = isset($_POST['about']) ? trim($_POST['about']) : '';
        
$namelat = isset($_POST['namelat']) ? trim($_POST['namelat']) : '';
        
$films = isset($_POST['films']) ? trim($_POST['films']) : '';
        
$birth = isset($_POST['birth']) ? trim($_POST['birth']) : '';
        
$where_born = isset($_POST['where_born']) ? trim($_POST['where_born']) : '';
        if (isset(
$_POST['submit']) && !empty($_POST['name'])) {
            
// Проверяем на минимальную длину
            
if (mb_strlen($name) < 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("INSERT INTO `stars` SET
                `name` = '
$name',
                `namelat` = '" 
mysql_real_escape_string($namelat) . "',
                `about` = '" 
mysql_real_escape_string($about) . "',
                `films` = '" 
mysql_real_escape_string($films) . "',
                `birth` = '" 
mysql_real_escape_string($birth) . "',
                `where_born` = '" 
mysql_real_escape_string($where_born) . "',
                `cid` = '
$id',
                `type` = '1',
                `date` = '" 
time() . "'
            "
);
            
$fadd mysql_insert_id();
            
// Вычисляем, на какую страницу попадает добавляемый пост
            
$page ceil(mysql_result(mysql_query("SELECT COUNT(*) FROM `stars` WHERE `type` = '0' AND `id` = '$id'"), 0) / $kmess);
            
            if (
$_POST['addfiles'] == 1)
                
header("Location: addfile.php?id=$fadd");
            else
                
header("Location: index.php?id=$id&page=$page");
                }
        } else {
require(
'../incfiles/head.php');
$req mysql_query("SELECT * FROM `stars` WHERE `id` = '$id'");
$res mysql_fetch_assoc($req);
$cats2 mysql_fetch_assoc(mysql_query("select * from `stars` where `id` = '$type1[cid]';"));
$cats3 $cats2['cid'] != mysql_fetch_assoc(mysql_query("select * from `stars` where `id` = '$cats2[cid]';")) : null;
/*
---------------------------------
Верхнее меню навигации
---------------------------------
*/
echo '<div class="topmenu">
<div class="bmenu">'
 
. ($id ?  '<a href="index.php">' $lng_stars['stars'] . '</a>'
 
. ($cats2 != null ' - <a href="index.php?id=' $cats2['id'] . '">' $cats2['name'] . '</a>' null)
 . 
' - <a href="index.php?id=' $res['id'] . '"><b>' $res['name'] . '</b></a>'
 
' - <b>' $lng_stars['add'] . '</b>' '<b>' $lng_stars['stars'] . '</b>')
 . 
' - ' $set['copyright'] . '</div></div>';
 
            echo 
'<form name="form" action="add.php?id=' $id '&amp;start=' $start '" method="post"><div class="gmenu">' .
            
$lng_stars['name'] . ' (max 25):<br/><input type="text" name="name" maxlength="25"/><br/>' .
            
$lng_stars['namelat'] . ' (max 25):<br/><input type="text" name="namelat" maxlength="25"/><br/>' .
            
$lng_stars['birth'] . ' (max 25):<br/><input type="text" name="birth" maxlength="25"/><br/>' .
            
$lng_stars['where_born'] . ' (max 56):<br/><input type="text" name="where_born" maxlength="56"/><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">' . (empty($_POST['about']) ? '' functions::checkout($about)) . '</textarea></p>' .
            
'<p>' $lng_stars['films'] . ' (' $lng_stars['notice'] . '):<br/>';
            echo 
'<textarea rows="' $set_user['field_h'] . '" name="films">' . (empty($_POST['films']) ? '' functions::checkout($films)) . '</textarea></p>' .
                 
'<p><input type="checkbox" name="addfiles" value="1" ' . (isset($_POST['addfiles']) ? 'checked="checked" ' '') . '/> ' $lng_stars['add_foto'];
            echo 
'</p><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 '&amp;start=' $start '">' $lng['back'] . '</a></p>';


require(
'../incfiles/end.php');
?>
Онлайн: 0
Реклама