Файл: adm_ider.php
Строк: 42
<?php
/**
* @author [FaNiska]
* @copyright 2009
* Загруз центр
* Предложения, идеи, вопросы и об ошибках писать в icq 65-64-538 или на mobi-m-ru@ya.ru
*/
if (function_exists('set_time_limit'))
{
set_time_limit(99999);
}
ignore_user_abort(1);
include 'inc/db_connect.php';
include 'inc/function.php';
include 'inc/set.php';
include 'inc/adm_head.php';
include 'inc/adm.php';
if (isset($_GET['start']))
{
if (isset($_GET['p']))
{
$scan_p = $_GET['p'];
$table = str_replace('files/', '', $scan_p);
$table = strtok($table, '/');
} else
{
exit('Ошибка при выборе раздела');
}
$count_f_id = 0;
$reses = mysql_query('SELECT `id`,`s_name` FROM `' . $table . '` WHERE `type`="1";');
while ($arr = mysql_fetch_array($reses))
{
$array_path[$arr['id']] = "$arr[s_name]";
}
foreach ($array_path as $id => $folder)
{
mysql_query("UPDATE `$table` set `id_p`='$id' where `folder`='$folder';");
$count_f_id++;
}
echo $table;
echo '<br />Присвоение ID завершено. Обновлено папок - ' . $count_f_id . '<br />';
} else
{
echo '<div>Присвоение ID.<br />
<form method="get" action="?">
<b>Выберите раздел</b><br />
<select name="p" >';
$query = mysql_query('SELECT `id`, `s_name` FROM `category` WHERE `s_name`!="vlink" && `s_name`!="vrazdel" && `s_name`!="link";');
while ($papka = mysql_fetch_array($query))
{
$arr_category[$papka['id']] = $papka['s_name'];
echo '<option value="' . $papka['s_name'] . '">' . $papka['s_name'] . '</option>';
}
echo '</select><input name="start" type="submit" value="старт"/>
</form>
<hr /></div>';
}
include 'inc/adm_foot.php';
?>