Файл: flirt.php
Строк: 148
<?php
require('connect.php');
$location = '(Делает действие над пользователем)';
if($u['id']){
if(isset($_GET['id'])){
$id=num($_GET['id']);
$req = mysql_query("SELECT * FROM `users` WHERE `id` = '$id' LIMIT 1");
if (mysql_num_rows($req)) {
$user = mysql_fetch_assoc($req);
}
}
if(empty($user['id'])){
if($u['id']){
$id = $u['id'];
$req = mysql_query("SELECT * FROM `users` WHERE `id` = '".$u['id']."' LIMIT 1");
$user = mysql_fetch_assoc($req);
} else {
header ("Location: index.php");
exit;
}
}
switch(@$_GET['act'])
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Добавление~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
case 'add=1':
if($u['money']>=5) {
if($user['id'] && $user['id'] != $u['id']){
if (isset($_POST['submit'])) {
$user['flirt1']++;
mysql_query("UPDATE `users` SET `flirt1` = '".$user['flirt1']."' WHERE `id` = '".$user['id']."'");
mysql_query("UPDATE `users` SET `money` = '".($u['money']-5)."' WHERE `id` = '".$u['id']."'");
if($u['sex'] == 'm'){
$action[0] = 'Подмигнул';
} else {
$action[0] = 'Подмигнула';
}
$text = $action[0].' тебе.';
mysql_query("INSERT INTO `jurnal` SET
`user` = '".$user['id']."',
`outuser` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`new` = '1'
");
header ("Location: flirt.php?id=".$user['id']."&ok=1");
} else {
require('head.php');
echo '<div class="div">';
echo 'Пользователь: <a href = "/page.php?id='.$user['id'].'">'.$user['login'].'</a> (ID: '.$user['id'].') </div><div class="div">';
echo 'Подмигнуть ? <br/>';
echo '<form action="flirt.php?act=add=1&id='.$user['id'].'" method=post>';
echo '<input type=submit name="submit" value="Да" class="submit white"/></form>';
echo '</div>';
require('foot.php');
}
} else {
header ("Location: flirt.php?id=".$user['id']."&close=1");
}
} else {
header ("Location: flirt.php?id=".$user['id']."&err=1");
}
break;
case 'add=2':
if($u['money']>=5) {
if($user['id'] && $user['id'] != $u['id']){
if (isset($_POST['submit'])) {
$user['flirt2']++;
mysql_query("UPDATE `users` SET `flirt2` = '".$user['flirt2']."' WHERE `id` = '".$user['id']."'");
mysql_query("UPDATE `users` SET `money` = '".($u['money']-5)."' WHERE `id` = '".$u['id']."'");
if($u['sex'] == 'm'){
$action[0] = 'Поцеловал';
} else {
$action[0] = 'Поцеловала';
}
$text = $action[0].' тебя.';
mysql_query("INSERT INTO `jurnal` SET
`user` = '".$user['id']."',
`outuser` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`new` = '1'
");
header ("Location: flirt.php?id=".$user['id']."&ok=1");
} else {
require('head.php');
echo '<div class="div">';
echo 'Пользователь: <a href = "/page.php?id='.$user['id'].'">'.$user['login'].'</a> (ID: '.$user['id'].') </div><div class="div">';
echo 'Поцеловать ? <br/>';
echo '<form action="flirt.php?act=add=2&id='.$user['id'].'" method=post>';
echo '<input type=submit name="submit" value="Да" class="submit white"/></form>';
echo '</div>';
require('foot.php');
}
} else {
header ("Location: flirt.php?id=".$user['id']."&close=1");
}
} else {
header ("Location: flirt.php?id=".$user['id']."&err=1");
}
break;
case 'add=3':
if($u['money']>=5) {
if($user['id'] && $user['id'] != $u['id']){
if (isset($_POST['submit'])) {
$user['flirt3']++;
mysql_query("UPDATE `users` SET `flirt3` = '".$user['flirt3']."' WHERE `id` = '".$user['id']."'");
mysql_query("UPDATE `users` SET `money` = '".($u['money']-5)."' WHERE `id` = '".$u['id']."'");
if($u['sex'] == 'm'){
$action[0] = 'Обнял';
} else {
$action[0] = 'Обняла';
}
$text = $action[0].' тебя.';
mysql_query("INSERT INTO `jurnal` SET
`user` = '".$user['id']."',
`outuser` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`new` = '1'
");
header ("Location: flirt.php?id=".$user['id']."&ok=1");
} else {
require('head.php');
echo '<div class="div">';
echo 'Пользователь: <a href = "/page.php?id='.$user['id'].'">'.$user['login'].'</a> (ID: '.$user['id'].') </div><div class="div">';
echo 'Обнять ? <br/>';
echo '<form action="flirt.php?act=add=3&id='.$user['id'].'" method=post>';
echo '<input type=submit name="submit" value="Да" class="submit white"/></form>';
echo '</div>';
require('foot.php');
}
} else {
header ("Location: flirt.php?id=".$user['id']."&close=1");
}
} else {
header ("Location: flirt.php?id=".$user['id']."&err=1");
}
break;
case 'add=4':
if($user['sex'] != $u['sex']){
if($u['money']>=5) {
if($user['id'] && $user['id'] != $u['id']){
if (isset($_POST['submit'])) {
$user['flirt4']++;
mysql_query("UPDATE `users` SET `flirt4` = '".$user['flirt4']."' WHERE `id` = '".$user['id']."'");
mysql_query("UPDATE `users` SET `money` = '".($u['money']-5)."' WHERE `id` = '".$u['id']."'");
if($u['sex'] == 'm'){
$action[0] = 'Приласкал';
} else {
$action[0] = 'Приласкала';
}
$text = $action[0].' тебя.';
mysql_query("INSERT INTO `jurnal` SET
`user` = '".$user['id']."',
`outuser` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`new` = '1'
");
header ("Location: flirt.php?id=".$user['id']."&ok=1");
} else {
require('head.php');
echo '<div class="div">';
echo 'Пользователь: <a href = "/page.php?id='.$user['id'].'">'.$user['login'].'</a> (ID: '.$user['id'].') </div><div class="div">';
echo 'Приласкать ? <br/>';
echo '<form action="flirt.php?act=add=4&id='.$user['id'].'" method=post>';
echo '<input type=submit name="submit" value="Да" class="submit white"/></form>';
echo '</div>';
require('foot.php');
}
} else {
header ("Location: flirt.php?id=".$user['id']."&close=1");
}
} else {
header ("Location: flirt.php?id=".$user['id']."&err=1");
}
} else {
header ("Location: flirt.php?id=".$user['id']."&sex=1");
}
break;
case 'add=5':
if($user['sex'] != $u['sex']){
if($u['money']>=5) {
if($user['id'] && $user['id'] != $u['id']){
if (isset($_POST['submit'])) {
$user['flirt5']++;
mysql_query("UPDATE `users` SET `flirt5` = '".$user['flirt5']."' WHERE `id` = '".$user['id']."'");
mysql_query("UPDATE `users` SET `money` = '".($u['money']-5)."' WHERE `id` = '".$u['id']."'");
if($u['sex'] == 'm'){
$action[0] = 'Признался';
} else {
$action[0] = 'Призналась';
}
$text = $action[0].' в любви.';
mysql_query("INSERT INTO `jurnal` SET
`user` = '".$user['id']."',
`outuser` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`new` = '1'
");
header ("Location: flirt.php?id=".$user['id']."&ok=1");
} else {
require('head.php');
echo '<div class="div">';
echo 'Пользователь: <a href = "/page.php?id='.$user['id'].'">'.$user['login'].'</a> (ID: '.$user['id'].') </div><div class="div">';
echo 'Признатся в любви ? <br/>';
echo '<form action="flirt.php?act=add=5&id='.$user['id'].'" method=post>';
echo '<input type=submit name="submit" value="Да" class="submit white"/></form>';
echo '</div>';
require('foot.php');
}
} else {
header ("Location: flirt.php?id=".$user['id']."&close=1");
}
} else {
header ("Location: flirt.php?id=".$user['id']."&err=1");
}
} else {
header ("Location: flirt.php?id=".$user['id']."&sex=1");
}
break;
case 'add=6':
if($u['money']>=5) {
if($user['id'] && $user['id'] != $u['id']){
if (isset($_POST['submit'])) {
$user['flirt6']++;
mysql_query("UPDATE `users` SET `flirt6` = '".$user['flirt6']."' WHERE `id` = '".$user['id']."'");
mysql_query("UPDATE `users` SET `money` = '".($u['money']-5)."' WHERE `id` = '".$u['id']."'");
if($u['sex'] == 'm'){
$action[0] = 'Оскорбил';
} else {
$action[0] = 'Оскорбила';
}
$text = $action[0].' тебя.';
mysql_query("INSERT INTO `jurnal` SET
`user` = '".$user['id']."',
`outuser` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`new` = '1'
");
header ("Location: flirt.php?id=".$user['id']."&ok=1");
} else {
require('head.php');
echo '<div class="div">';
echo 'Пользователь: <a href = "/page.php?id='.$user['id'].'">'.$user['login'].'</a> (ID: '.$user['id'].') </div><div class="div">';
echo 'Оскорбить ? <br/>';
echo '<form action="flirt.php?act=add=6&id='.$user['id'].'" method=post>';
echo '<input type=submit name="submit" value="Да" class="submit white"/></form>';
echo '</div>';
require('foot.php');
}
} else {
header ("Location: flirt.php?id=".$user['id']."&close=1");
}
} else {
header ("Location: flirt.php?id=".$user['id']."&err=1");
}
break;
case 'add=7':
if($u['money']>=5) {
if($user['id'] && $user['id'] != $u['id']){
if (isset($_POST['submit'])) {
$user['flirt7']++;
mysql_query("UPDATE `users` SET `flirt7` = '".$user['flirt7']."' WHERE `id` = '".$user['id']."'");
mysql_query("UPDATE `users` SET `money` = '".($u['money']-5)."' WHERE `id` = '".$u['id']."'");
if($u['sex'] == 'm'){
$action[0] = 'Ущипнул';
} else {
$action[0] = 'Ущипнула';
}
$text = $action[0].' тебя.';
mysql_query("INSERT INTO `jurnal` SET
`user` = '".$user['id']."',
`outuser` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`new` = '1'
");
header ("Location: flirt.php?id=".$user['id']."&ok=1");
} else {
require('head.php');
echo '<div class="div">';
echo 'Пользователь: <a href = "/page.php?id='.$user['id'].'">'.$user['login'].'</a> (ID: '.$user['id'].') </div><div class="div">';
echo 'Ущипнуть ? <br/>';
echo '<form action="flirt.php?act=add=7&id='.$user['id'].'" method=post>';
echo '<input type=submit name="submit" value="Да" class="submit white"/></form>';
echo '</div>';
require('foot.php');
}
} else {
header ("Location: flirt.php?id=".$user['id']."&close=1");
}
} else {
header ("Location: flirt.php?id=".$user['id']."&err=1");
}
break;
case 'add=8':
if($u['money']>=5) {
if($user['id'] && $user['id'] != $u['id']){
if (isset($_POST['submit'])) {
$user['flirt8']++;
mysql_query("UPDATE `users` SET `flirt8` = '".$user['flirt8']."' WHERE `id` = '".$user['id']."'");
mysql_query("UPDATE `users` SET `money` = '".($u['money']-5)."' WHERE `id` = '".$u['id']."'");
if($u['sex'] == 'm'){
$action[0] = 'Ударил';
} else {
$action[0] = 'Ударила';
}
$text = $action[0].' тебя.';
mysql_query("INSERT INTO `jurnal` SET
`user` = '".$user['id']."',
`outuser` = '".$u['id']."',
`text` = '$text',
`time` = '".time()."',
`new` = '1'
");
header ("Location: flirt.php?id=".$user['id']."&ok=1");
} else {
require('head.php');
echo '<div class="div">';
echo 'Пользователь: <a href = "/page.php?id='.$user['id'].'">'.$user['login'].'</a> (ID: '.$user['id'].') </div><div class="div">';
echo 'Ударить ? <br/>';
echo '<form action="flirt.php?act=add=8&id='.$user['id'].'" method=post>';
echo '<input type=submit name="submit" value="Да" class="submit white"/></form>';
echo '</div>';
require('foot.php');
}
} else {
header ("Location: flirt.php?id=".$user['id']."&close=1");
}
} else {
header ("Location: flirt.php?id=".$user['id']."&err=1");
}
break;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Вывод добавленых~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
default:
$title = $title.' | Сделать действие';
require('head.php');
require('core/plural.php');
$act_1 = num($user['flirt1']);
$act_2 = num($user['flirt2']);
$act_3 = num($user['flirt3']);
$act_4 = num($user['flirt4']);
$act_5 = num($user['flirt5']);
$act_6 = num($user['flirt6']);
$act_7 = num($user['flirt7']);
$act_8 = num($user['flirt8']);
$act_9 = num($user['flirt9']);
$act_10 = num($user['flirt10']);
echo '<div class="title"> <img src="ico/heart.png" alt="!"/> Сделать действие </div>';
if(isset($_GET['ok'])) {
echo '<div class="nav"><font color="green"> Успешно !</font></div>';
}
if(isset($_GET['err'])) {
echo '<div class="cred">';
echo ' Недостаточно средств на счету. </div>';
}
if(isset($_GET['close'])) {
echo '<div class="cred">';
echo ' Ошибка , так делать нельзя !</div>';
}
if(isset($_GET['sex'])) {
echo '<div class="cred">';
echo ' Стоп , у вас всё нормально с ориентацией ?</div>';
}
echo '<div class="zona">';
echo 'Внимание ! стоимость услуги составляет 5 монет';
echo '</div>';
echo '<div class="div">';
echo '<a href = "/flirt.php?act=add=1&id='.$user['id'].'"> Подмигнули</a> (' . $act_1 . ') ' . plural($act_1, 'раз', 'раза', 'раз') . '</br>';
echo '<a href = "/flirt.php?act=add=2&id='.$user['id'].'"> Поцеловали</a> (' . $act_2 . ') ' . plural($act_2, 'раз', 'раза', 'раз') . '</br>';
echo '<a href = "/flirt.php?act=add=3&id='.$user['id'].'"> Обняли</a> (' . $act_3 . ') ' . plural($act_3, 'раз', 'раза', 'раз') . '</br>';
echo '<a href = "/flirt.php?act=add=4&id='.$user['id'].'"> Приласкали</a> (' . $act_4 . ') ' . plural($act_4, 'раз', 'раза', 'раз') . '</br>';
echo '<a href = "/flirt.php?act=add=5&id='.$user['id'].'"> Признались в любви</a> (' . $act_5 . ') ' . plural($act_5, 'раз', 'раза', 'раз') . '</br>';
echo '<a href = "/flirt.php?act=add=6&id='.$user['id'].'"> Оскорбили</a> (' . $act_6 . ') ' . plural($act_6, 'раз', 'раза', 'раз') . '</br>';
echo '<a href = "/flirt.php?act=add=7&id='.$user['id'].'"> Ущипнули</a> (' . $act_7 . ') ' . plural($act_7, 'раз', 'раза', 'раз') . '</br>';
echo '<a href = "/flirt.php?act=add=8&id='.$user['id'].'"> Ударили</a> (' . $act_8 . ') ' . plural($act_8, 'раз', 'раза', 'раз') . '</br>';
echo '</div>';
require('foot.php');
break;
}
} else {
header ("Location: registration.php?err=1");
}
?>