<?php
session_start();
include("db.php");
date_default_timezone_set("Asia/Calcutta");
$insertdate = date("h:i:s d-m-Y ");
if(isset($_GET['id'])){
  $ip=$_SERVER['REMOTE_ADDR'];
 $r=$_GET['id'];
  $_SESSION['id']=$r;

  $sql=mysqli_query($conn,"INSERT INTO `win`(`ip`, `ammount`, `status`, `date`) VALUES ('$ip','$r', '0', '$insertdate')");


  ?><script>window.location.href = "win.php";</script><?php 
}
if(isset($_SESSION['id'])){
   $id=$_SESSION['id'];
 }
else {
  ?><script>window.location.href = "index.php";</script><?php
}

?>

<style>
 .mo{
  background-image: url('https://i.pinimg.com/originals/a3/f3/68/a3f368c029712d922beb2964299134da.gif');
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
}
.modal-header {
    padding: 0px!important;
    border-bottom: 1px solid #e5e5e5;
}
.pr{
      background: white;
    padding: 10px;
    text-align: center;
}
.modal-footer {
    padding: 10px!important;
    text-align: center!important;
</style>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<body class="mo">
<div class="container ">
  <!-- Trigger the modal with a button -->
 <!--  <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
 -->
  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog" data-backdrop="static" tabindex="-1">
    <div class="modal-dialog ">
    
      <!-- Modal content-->
      <div class="modal-content mo">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <!-- <h4 class="modal-title">Modal Header</h4> -->
        </div>
        <div class="modal-body">
          <img src="win.jpg" style="width: 100%;object-fit: cover;height:50%!important;">
          <h1 class="pr">You win &#8377; <?=$id;?> </h1>
        </div>
        <div class="modal-footer">
          <a href="" class="btn btn-success" >Widthdraw</a>
          <a href="admin/" class="btn btn-info" >Dashboard</a>
          <a href="index.php" class="btn btn-primary" >Spin Again</a>
          <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>

        </div>
      </div>
      
    </div>
  </div>
  
</div>
</body>
<script>
  $(window).load(function()
{
    $('#myModal').modal('show');
});
</script>


