Файл: my_game_set.php
Строк: 46
<?
include_once 'connect.php';
$title = $title . ' : Добавляем игру';
include_once 'head.php';
if (!$u['id']) {
header("Location: registration.php?err=1");
exit;
}
if (isset($_POST['save'])){
if (isset($_POST['game1']) && ($_POST['game1']==1 || $_POST['game1']==0)){$u['game1']=intval($_POST['game1']);mysql_query("UPDATE `users` SET `game1` = '$u[game1]' WHERE `id` = '$u[id]' LIMIT 1");}else{$u['game1']=0;mysql_query("UPDATE `users` SET `game1` = '0' WHERE `id` = '$u[id]' LIMIT 1");}
if (isset($_POST['game2']) && ($_POST['game2']==1 || $_POST['game2']==0)){$u['game2']=intval($_POST['game2']);mysql_query("UPDATE `users` SET `game2` = '$u[game2]' WHERE `id` = '$u[id]' LIMIT 1");}else{$u['game2']=0;mysql_query("UPDATE `users` SET `game2` = '0' WHERE `id` = '$u[id]' LIMIT 1");}
if (isset($_POST['game3']) && ($_POST['game3']==1 || $_POST['game3']==0)){$u['game3']=intval($_POST['game3']);mysql_query("UPDATE `users` SET `game3` = '$u[game3]' WHERE `id` = '$u[id]' LIMIT 1");}else{$u['game3']=0;mysql_query("UPDATE `users` SET `game3` = '0' WHERE `id` = '$u[id]' LIMIT 1");}
if (isset($_POST['game8']) && ($_POST['game8']==1 || $_POST['game8']==0)){$u['game8']=intval($_POST['game8']);mysql_query("UPDATE `users` SET `game8` = '$u[game8]' WHERE `id` = '$u[id]' LIMIT 1");}else{$u['game8']=0;mysql_query("UPDATE `users` SET `game8 = '0' WHERE `id` = '$u[id]' LIMIT 1");}
if (isset($_POST['game5']) && ($_POST['game5']==1 || $_POST['game5']==0)){$u['game5']=intval($_POST['game5']);mysql_query("UPDATE `users` SET `game5` = '$u[game5]' WHERE `id` = '$u[id]' LIMIT 1");}else{$u['game5']=0;mysql_query("UPDATE `users` SET `game5` = '0' WHERE `id` = '$u[id]' LIMIT 1");}
if (isset($_POST['game6']) && ($_POST['game6']==1 || $_POST['game6']==0)){$u['game6']=intval($_POST['game6']);mysql_query("UPDATE `users` SET `game6` = '$u[game6]' WHERE `id` = '$u[id]' LIMIT 1");}else{$u['game6']=0;mysql_query("UPDATE `users` SET `game6` = '0' WHERE `id` = '$u[id]' LIMIT 1");}
if (isset($_POST['game7']) && ($_POST['game7']==1 || $_POST['game7']==0)){$u['game7']=intval($_POST['game7']);mysql_query("UPDATE `users` SET `game7` = '$u[game7]' WHERE `id` = '$u[id]' LIMIT 1");}else{$u['game7']=0;mysql_query("UPDATE `users` SET `game7` = '0' WHERE `id` = '$u[id]' LIMIT 1");}
ok('Игры успешно добавлены');
}
echo "<form method='post' action='?$passgen'>n";
echo '<div class=title>Укажите игры которые будут видны вам.<br/></div>';
echo "<div class=div><label><input type='checkbox' name='game1'".($u['game1']?" checked='checked'":null)." value='1' /> Принц персии</label><br /></div>";
echo "<div class=div><label><input type='checkbox' name='game2'".($u['game2']?" checked='checked'":null)." value='1' /> Кровавые кошки мышки</label><br /></div>";
echo "<div class=div><label><input type='checkbox' name='game3'".($u['game3']?" checked='checked'":null)." value='1' /> Марио</label><br /></div>";
echo "<div class=div><label><input type='checkbox' name='game8'".($u['game8']?" checked='checked'":null)." value='1' /> Онлайн рыбалка</label><br /></div>";
echo "<div class=div><label><input type='checkbox' name='game5'".($u['game5']?" checked='checked'":null)." value='1' /> Разбей свой старый компьютер</label><br /></div>";
echo "<div class=div><label><input type='checkbox' name='game6'".($u['game6']?" checked='checked'":null)." value='1' /> Запусти пингвина</label><br /></div>";
echo "<div class=div><label><input type='checkbox' name='game7'".($u['game7']?" checked='checked'":null)." value='1' /> Гоночный драйв</label><br /></div>";
echo "<div class=div><input type='submit' name='save' value='Добавить игры' />n";
echo "</form></div>";
echo "<div class=div><img src='/about/img/str.png'/><a href='/my_game.php?id=".$u['id']."'> Назад</a></div>";
include_once 'foot.php';
?>