Размер файла: 1.83Kb
<?php
/**********************************************/
/* Автор скрипта: Александр Есин */
/* E-Mail: [email protected] ([email protected]) */
/* ICQ: 6464729 */
/* Site: http://ticlove.ru */
/**********************************************/
?>
<?php define ('SECURED', true); ?>
<?php require (dirname(__FILE__).'/../../_inc/sql.php'); ?>
<?php require (dirname(__FILE__).'/../../_inc/config.php'); ?>
<?php require (dirname(__FILE__).'/../../_inc/function.php'); ?>
<?php
if (!empty($_SESSION['auth_admin']) && (intval($_POST['auth_admin']) == $_SESSION['auth_admin']))
{
$name_country = trim($_POST['name_country']);
$name_country = function_sql($name_country);
$explode_country = explode('\n', $name_country);
for ($i = 0; $i < count($explode_country); $i++)
{
if (!empty($explode_country[$i]))
{
$explode_country[$i] = iconv('utf-8', 'windows-1251', $explode_country[$i]);
$explode_country[$i] = ucfirst(strtolower($explode_country[$i]));
$explode_country[$i] = iconv('windows-1251', 'utf-8', $explode_country[$i]);
if (mysql_num_rows(mysql_query("SELECT * FROM `q_country` WHERE `name_country` = '".function_sql(trim($explode_country[$i]))."' LIMIT 1;")) == 0)
{
mysql_query("INSERT INTO `q_country` (`name_country`) VALUES ('".function_sql($explode_country[$i])."');");
echo '<span class="green">Страна "'.htmlspecialchars($explode_country[$i], ENT_QUOTES).'" добавлена</span><br/>';
}
else
{
echo '<span class="red">Страна "'.htmlspecialchars($explode_country[$i], ENT_QUOTES).'" уже есть в БД</span><br/>';
}
}
}
}
?>