Просмотр файла games/bandit.php

Размер файла: 1.54Kb
<?php

include("../config.php");
include("../templates/head.php");

$ch1 = rand(1,7);
$ch2 = rand(1,7);
$ch3 = rand(1,7);
echo"<div class=\"a\">";
echo"Бандит";
echo"</div>";
echo"<div class=\"c\"><p>";
echo"|{$ch1}|{$ch2}|{$ch3}|";
echo"<p>";
$data_v = "../data/games/data_bandit_v.dat";
$data_l = "../data/games/data_bandit_l.dat";
if( (($ch1 == $ch2)||($ch2 == $ch3)) && ($ch1 != $ch3))
{
echo"Вы выйграли 10 баксов!";
$file = file("$data_v");
$wr = $file[0];
$wr2 = ++$wr;
$filek = fopen("$data_v","w+");
fwrite($filek,"$wr2");
fclose($filek);
}
elseif($ch1 == 7 && $ch2 == 7 && $ch3 == 7)
{
echo"Вы выйграли 1000 баксов!";
$file = file("$data_v");
$wr = $file[0];
$wr2 = ++$wr;
$filek = fopen("$data_v","w+");
fwrite($filek,"$wr2");
fclose($filek);
}
elseif(($ch1 == $ch2) && ($ch2 == $ch3))
{
echo"Вы выйграли 100 баксов!";
$file = file("$data_v");
$wr = $file[0];
$wr2 = ++$wr;
$filek = fopen("$data_v","w+");
fwrite($filek,"$wr2");
fclose($filek);
}
else
{
echo"Вы проиграли!";
$file = file("$data_l");
$wr = $file[0];
$wr2 = ++$wr;
$filek = fopen("$data_l","w+");
fwrite($filek,"$wr2");
fclose($filek);
}
echo"<p>";
$file_v = file("$data_v");
echo"Выйгрышей: $file_v[0]</br>";
$file_l = file("$data_l");
echo"Пройгрышей: $file_l[0]";
echo"<p>";
echo"<a href=\"bandit.php?sid=$r\">Играть</a></br>";
echo"<a href=\"help_bandit.php\">Помощь</a>";
echo"</div>";

include("../templates/foot.php");

?>