View file index.php

File size: 2.21Kb
<?php
//     СТАРТУЕМ СЕССИЮ
Session_name('SID');
Session_start();
//     CSS /////////////////////
Echo '<style>
  img{
   width:160px;
   height:160px;
   border-radius:20px;
          }
   #spinner{
   background:silver;
   color:white;
   border:13px solid skyblue;
   border-radius:40px;
   width:70%;
   height:320px;
   padding-top:120px;
   font-size:32px;
          }
   #spin{
   background:skyblue;
   font-size:60px;
   color:black;
   border:13px solid skyblue;
   border-bottom-left-radius:50px;
   border-bottom-right-radius:50px;
   text-decoration:none;
         }
   #head{
   background:black;
   font-size:60px;
   position:absolute;
   top:0px;
   left:0px;
   height:120px;
   width:100%;
   color:white;
         }
   #foot{
   position:absolute;
   bottom:0px;
   left:0px;
   background:black;
   color:white;
   width:100%;
   height:120px;
          }
  </style>';
///////////////////////////////////////
//     ОПРЕДЕЛЯЕМ ПЕРЕМЕННЫЕ
$a=rand(1,9);
$b=rand(1,9);
$c=rand(1,9);
if($_SESSION['coins'] <= 0){
echo'<script>alert("GAME OVER");</script>';
$_SESSION['coins'] = 1000;}
//     ВЫВОДИМ АППАРАТ
Echo '
<div id="head">
<b>'.$_SESSION['coins'].' $</b>
<font style="float:right;">BET: 5$</font>
</div>
<center>
<div id="spinner">
<img src="img/'.$a.'.jpg">
<img src="img/'.$b.'.jpg">
<img src="img/'.$c.'.jpg">
</div>
<a id="spin" href="?spin">SPIN</a><br>
<div id="foot"><center><br><b>&copy; SP 2o16</b></center></div>
</center>'
;
// КРУТИМ БАРАБАН
if(@isset($_GET['spin']))
{
           // ----- JACKPOT -----
if($a == $b AND $b == $c AND $c == 7){$_SESSION['coins'] = round($_SESSION['coins']+1000);
Echo '<script>alert("JACKPOT!!! 
+1000$");</script>';}
           // ----- 3 MATCHES -----
    elseif($a == $b AND $b == $c) {$_SESSION['coins'] = round($_SESSION['coins']+$a*10);
Echo '<script>alert("YOU WIN '.round($a*10).' $");</script>';}
           // ----- 2 MATCHES -----
    elseif($a == $b) {$_SESSION['coins'] = round($_SESSION['coins']+$a*5);
Echo '<script>alert("YOU WIN '.round($a*5).' $");</script>';}
            // ----- LOSE -----
else{
  $_SESSION['coins'] = round($_SESSION['coins']-5);
  Echo '
<script>location("header:index.php");</script>';}
}
?>