Файл: world-faces.ru/world-faces.ru/fermer/index.php
Строк: 46
<?php
include_once '../i.php';
only_reg();
$set['title']='Счастливый фермер!';
verh();
err();
aut();
if(mysql_result(mysql_query("SELECT count(id) FROM `my_apps` where `id_us` = '".$us['id']."' and `id_app` = '1'"),0)==0){
pdo();
$app = DB::$dbs->queryFetch("SELECT * FROM `apps` where `id` = ? limit 1",array(1));
function ret($type){
$type = str_replace('И','и',$type);
$type = str_replace('а','ы',$type);
$type = str_replace('П','п',$type);
$type = str_replace('ие','ия',$type);
return $type;
}
echo '<div class="title" align="center">Запуск '.ret($app['type']).' | <a href="/play">закрыть</a></div>';
echo '<div class="prof"><img src="'.$app['img'].'" align="middle" alt="'.$app['name'].'"/><b>'.$app['name'].'</b><br/>'.$app['opis'].'</div>';
echo '<div class="app">Запустили уже <b>'.DB::$dbs->querySingle("SELECT count(id) FROM `my_apps` where `id_app` = '1'").'</b> человек! <a href="?add"><input type="submit" value="Запустить '.$app['name'].'!"/></a></div>';
if(isset($_GET['add'])){
DB::$dbs->query("INSERT INTO `my_apps` set `id_us` = ?, `id_app` = ?",array($us['id'],1));
$text = 'запустил'.(($us['pol']==0)?'а':'').' приложение <b>[url='.$app['src'].']"'.$app['name'].'"[/url]</b>!';
DB::$dbs->query("INSERT INTO `lenta_saita` set `user` = ?, `time` = ?,`action` = ?",array($us['nick'],time(),$text));
header('location:'.$app['src'].'');
}
niz(); exit;
}
$dog = mysql_result(mysql_query("select count(*) from `fermer_dog` WHERE `id_user` = '$user[id]' LIMIT 1"),0);
if($dog==0){
mysql_query("INSERT INTO `fermer_dog` (`id_user`,`time`) VALUES ($user[id],NULL) ");
}
$post = mysql_result(mysql_query("select count(*) from `fermer_gr` WHERE `id_user` = '$user[id]' LIMIT 1"),0);
if($post<5){
mysql_query("INSERT INTO `fermer_gr` (`kol`,`semen`, `id_user`) VALUES ( NULL, '0', '".$user['id']."') ");
mysql_query("INSERT INTO `fermer_gr` (`kol`,`semen`, `id_user`) VALUES ( NULL, '0', '".$user['id']."') ");
mysql_query("INSERT INTO `fermer_gr` (`kol`,`semen`, `id_user`) VALUES ( NULL, '0', '".$user['id']."') ");
mysql_query("INSERT INTO `fermer_gr` (`kol`,`semen`, `id_user`) VALUES ( NULL, '0', '".$user['id']."') ");
mysql_query("INSERT INTO `fermer_gr` (`kol`,`semen`, `id_user`) VALUES ( NULL, '0', '".$user['id']."') ");
}
$menu=' <b>»</b> ';
echo "<center><b>Добро пожаловать на Ферму!</b></center>";
echo '<img src="http://sefan.ru/farmer/img/1.jpg" /></br> ';
echo $menu."<a href='my.php'>Моя ферма</a><br/>";
echo $menu."<a href='storage.php'>Склад</a><br/>";
echo $menu."<a href='shop.php'>Магазин семян</a><br/>";
echo $menu."<a href='shop_udobr.php'>Магазин удобрений</a><br/>";
echo $menu."<a href='dog.php'>Купить собаку</a><br/>";
echo $menu."<a href='fermers.php'>Фермеры</a><br/>";
echo $menu."<a href='obmen.php'>Обмен баллов</a><br/>";
include_once '../sys/inc/tfoot.php';
?>