<?php

# by bage
# ICQ 281123 
# masteram.us 

include_once '../sys/inc/start.php'; 
include_once '../sys/inc/compress.php'; 
include_once '../sys/inc/sess.php'; 
include_once '../sys/inc/home.php'; 
include_once '../sys/inc/settings.php'; 
include_once '../sys/inc/db_connect.php'; 
include_once '../sys/inc/ipua.php'; 
include_once '../sys/inc/fnc.php'; 
include_once '../sys/inc/shif.php'; 
$show_all=true; 
include_once '../sys/inc/user.php'; 
$set['title']='Авторегер'; 
include_once '../sys/inc/thead.php'; 
title(); 
aut();
 
if ($user['level']<3){
header ("Location: /index.php?"); 
exit;
} 


echo '
<style>

.aRows{
text-align: center;
background: #F0F8FF;
color: #4682B4;
border-radius: 1em;
}

.aHows{
margin-top: 1px;
 background-color: #F5F5F5; 
border-bottom: 2px solid #e8e8e8; 
padding: 4px;
}

</style>';


/* подсчет ботов */

$bot_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `bot_us` = '1'"),0);

if (isset($_POST['del'])){

mysql_query("DELETE FROM `user` WHERE `bot_us` = '1'");

}


if (isset($_POST['reg'])){

/* для авок */

ini_set('allow_url_fopen', 1);

/* добавляем опознание ботов */

$table = mysql_query("SELECT `bot_us` FROM `user` WHERE 0");
if (!$table){
mysql_query("ALTER TABLE `user` ADD `bot_us` int(11) NOT NULL");
}

/* количество юзеров */

$users_start = intval($_POST['users_start']);


for($i = 0; $i < $users_start; $i++) { 

/* пол юзеров */

if ($_POST['pol']==0)$pol = 0;
if ($_POST['pol']==1)$pol = 1;
if ($_POST['pol']==2)$pol = rand(0,1);


/* рандуем xD */

$rand_img = rand(1,99);


/* pass */

$pass = rand(1000,99999);


/* id user */

$us_id = mysql_fetch_assoc(mysql_query("SELECT id FROM `user` ORDER BY id desc LIMIT 1"));


/* возраст */

$ank_d_r = rand(1,30);

$ank_m_r = rand(1,12);

$ank_g_r = rand(1970,2002);


/* Имена */

if ($pol==0){

$txt = file('names/0.txt'); 
$names = $txt[array_rand($txt)];

$q = 'http://'.$_SERVER['SERVER_NAME'].'/auto_reg/img_0/1_'.$rand_img.'.jpg';
$newfile = '../sys/avatar/'.$us_id['id'].'.jpg';
copy($q,$newfile);
}

if ($pol==1){

$txt = file('names/1.txt'); 
$names = $txt[array_rand($txt)];

$q = 'http://'.$_SERVER['SERVER_NAME'].'/auto_reg/img_1/Fantasy_'.$rand_img.'.jpg';
$newfile = '../sys/avatar/'.$us_id['id'].'.jpg';
copy($q,$newfile);
}

/* Поехали =) */

mysql_query("INSERT INTO `user` (`nick`, `pass`, `date_reg`, `date_last`, `pol`, `bot_us`, `ank_d_r`, `ank_m_r`, `ank_g_r`) values('".$names."', '".shif($pass)."', '$time', '$time', '".$pol."', '1', '".$ank_d_r."', '".$ank_m_r."', '".$ank_g_r."')",$db);

}

echo '<div class="aRows">Успешно зарегистрировано '.$users_start.' пользователей =)</div>';

}

?>

<div class="aHows">
     <center>
 <marquee><img src="b1.gif"> </marquee><br />

<marquee height="150" direction="up"><img src="b2.gif"></marquee><br />

Всего ботов <b> <?php echo $bot_count; ?> </b><br />

<form method='post' action='?'>
Количество пользователей:<br />
<select size='1' name='users_start'>";
<option value='10'>10</option>
<option value='100'>100</option>
<option value='1000'>1000</option>
</select><br />

Пол:<br />
<select size='1' name='pol'>";
<option value='0'>Женский</option>
<option value='1'>Мужской</option>
<option value='2'>Случайный</option>
</select><br />
<input type='submit' name='reg' value='Go ...' />
</form>

<form method='post' action='?'>
<input type='submit' name='del' value='Удалить ботов' />
</form>
   <a href="http://masteram.us/1506">By <font color="#1"><span style="color: #BB4000">b</span><span style="color: #7D8000">a</span><span style="color: #3FC000">g</span><span style="color: #01FF00">e</span></font></a> <span style="color:#00AE00">ICQ 281123</span><br />       </center>     </div>
   
<?
include_once '../sys/inc/tfoot.php'; 
?>