Advertisement
Guest User

share.php

a guest
Mar 18th, 2015
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.03 KB | None | 0 0
  1. <!doctype html>
  2. <?php
  3.     require 'connect.php';
  4.     require 'core.php';
  5.     require 'navigation.php';
  6.     if(loggedin()) {
  7.         //header('Location: index.php');
  8.     } else {
  9.         header('Location: login.php');
  10.     }
  11. ?>
  12. <html>
  13.     <head>
  14.         <meta charset='utf-8'>
  15.         <title>Upstrey - Shared Tickets</title>
  16.         <style>
  17.         #banner {
  18.             float: left;
  19.             margin: 6px;
  20.         }
  21.         li.SuccShared {
  22.             position:fixed;
  23.             opacity: 1;
  24.             padding: 7px;
  25.             background-color: lightgreen;
  26.             color: black;
  27.             top: 0%;
  28.             margin-left: 40%;
  29.             -moz-border-radius:30px 30px 5px 5px;
  30.             -webkit-border-bottom-left-radius: 10px;
  31.             -webkit-border-bottom-right-radius: 10px;
  32.             -khtml-border-top-left-radius: 10px;
  33.             -khtml-border-top-right-radius: 10px;
  34.         }
  35.         li.AlreadyShared {
  36.             position:fixed;
  37.             opacity: 1;
  38.             padding: 7px;
  39.             background-color: red;
  40.             color: white;
  41.             top: 0%;
  42.             margin-left: 40%;
  43.             -moz-border-radius:30px 30px 5px 5px;
  44.             -webkit-border-bottom-left-radius: 10px;
  45.             -webkit-border-bottom-right-radius: 10px;
  46.             -khtml-border-top-left-radius: 10px;
  47.             -khtml-border-top-right-radius: 10px;
  48.         }
  49.         </style>
  50.     </head>
  51.     <body>
  52. <?php
  53.     $responseText = '';
  54.     $user = getUserData('users', 'Username');
  55.     $sql = "SELECT `Uplata`, `Dobivka`, `Date`, `match1`, `match2`, `match3`, `match4`, `match5`, `match6`, `match7`, `match8`, `match9`, `match10`, `match11`, `match12`, `match13`, `match14`, `match15`, `match16`, `Odds`, `tip1`, `tip2`, `tip3`, `tip4`, `tip5`, `tip6`, `tip7`, `tip8`, `tip9`, `tip10`, `tip11`, `tip12`, `tip13`, `tip14`, `tip15`, `tip16`, `isActive`, `ticket_id`, `isShared`, `Username`, `Liked` FROM `kladilnica`";
  56.     $result = $conn->query($sql);
  57.     $count = 0;
  58.     $count1 = 0;
  59.     $uplata_total = 0;
  60.    
  61.     if($result === false) {
  62.         echo "<b>Could not connect to database.</b>";
  63.         trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
  64.     } else {
  65.         if($result->num_rows == 0) {
  66.             echo "<b>No more shared tickets.</b>";
  67.         } else if($result->num_rows >= 1) {
  68.             $count = $count + 1;
  69.             $count1 = $count1 + 1;
  70.             while($row = $result->fetch_assoc()) {
  71.                 if($result->num_rows != empty($row['match1'])) {
  72.                     $date = $row["Date"];
  73.                     $uplata_total = $row["Uplata"];
  74.                     $dobivka_total = $row["Dobivka"];
  75.                     $is_active = $row["isActive"];
  76.                     $is_shared = $row["isShared"];
  77.                     $odd = $row["Odds"];
  78.                     $publisher = $row["Username"];
  79.                     $ticket_id = $row["ticket_id"];
  80.                     $likedCount = $row["Liked"];
  81.                    
  82.                     if($is_active == 1 && $is_shared == 1) {
  83.                     ?>
  84.         <form action='shared.php' method='POST'>
  85.             <table id='t01' style='margin-bottom: 10px; padding: 15px;'>
  86.                 <thead>
  87.                     <tr>
  88.                         <th colspan='2'>
  89.                             <a style='position: relative; padding-left: 5px; float: left;'>Publisher: <?= $publisher ?></a>
  90.                         </th>
  91.                     </tr>
  92.                     <tr>
  93.                         <th colspan='2'>
  94.                             <button name="like" style="position: relative;  cursor: pointer; margin-right: 5px; float: right;" class="share_button" value="<?= $ticket_id ?>" type="submit" id="likeBtn" onclick="change()">Like <?php echo "($likedCount)" ?></button>
  95.                             <a style="position: relative;  cursor: pointer; margin-left: 5px; float: left;">Date: <?php echo $date ?></a>
  96.                         </th>
  97.                     </tr>
  98.                 </thead>
  99.                 <tbody>
  100.                     <tr>
  101.                         <td><?= $row["match1"] ?></td>
  102.                         <td><?= $row["tip1"] ?></td>
  103.                     </tr>
  104.                     <tr>
  105.                         <td><?= $row["match2"] ?></td>
  106.                         <td><?= $row["tip2"] ?></td>
  107.                     </tr>
  108.                     <tr>
  109.                         <td><?= $row["match3"] ?></td>
  110.                         <td><?= $row["tip3"] ?></td>
  111.                         </tr>
  112.                     <tr>
  113.                         <td><?= $row["match4"] ?></td>
  114.                         <td><?= $row["tip4"] ?></td>
  115.                     </tr>
  116.                     <tr>
  117.                         <td><?= $row["match5"] ?></td>
  118.                         <td><?= $row["tip5"] ?></td>
  119.                     </tr>
  120.                     <tr>
  121.                         <td><?= $row["match6"] ?></td>
  122.                         <td><?= $row["tip6"] ?></td>
  123.                     </tr>
  124.                     <tr>
  125.                         <td><?= $row["match7"] ?></td>
  126.                         <td><?= $row["tip7"] ?></td>
  127.                     </tr>
  128.                     <tr>
  129.                         <td><?= $row["match8"] ?></td>
  130.                         <td><?= $row["tip8"] ?></td>
  131.                     </tr>
  132.                     <tr>
  133.                         <td><?= $row["match9"] ?></td>
  134.                         <td><?= $row["tip9"] ?></td>
  135.                     </tr>
  136.                     <tr>
  137.                         <td><?= $row["match10"] ?></td>
  138.                         <td><?= $row["tip10"] ?></td>
  139.                     </tr>
  140.                     <tr>
  141.                         <td><?= $row["match11"] ?></td>
  142.                         <td><?= $row["tip11"] ?></td>
  143.                     </tr>
  144.                     <tr>
  145.                         <td><?= $row["match12"] ?></td>
  146.                         <td><?= $row["tip12"] ?></td>
  147.                     </tr>
  148.                     <tr>
  149.                         <td><?= $row["match13"] ?></td>
  150.                         <td><?= $row["tip13"] ?></td>
  151.                     </tr>
  152.                     <tr>
  153.                         <td><?= $row["match14"] ?></td>
  154.                         <td><?= $row["tip14"] ?></td>
  155.                     </tr>
  156.                     <tr>
  157.                         <td><?= $row["match15"] ?></td>
  158.                         <td><?= $row["tip15"] ?></td>
  159.                     </tr>
  160.                     <tr>
  161.                         <td><?= $row["match16"] ?></td>
  162.                         <td><?= $row["tip16"] ?></td>
  163.                     </tr>
  164.                     <tr>
  165.                         <th colspan='2'>Total Bet: <?= $uplata_total ?></th>
  166.                     </tr>
  167.                     <tr>
  168.                         <th colspan='2'>Total Win: <?= $dobivka_total ?></th>
  169.                     </tr>
  170.                 </tbody>
  171.             </table>
  172.         </form>
  173.     <?php
  174.     $count++;
  175.                         }
  176.                         if($count % 10 == 0) {
  177.                             ?>
  178.                             <div id="banner">
  179.                                 <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
  180.                                     <!-- ticketAds -->
  181.                                     <ins class="adsbygoogle"
  182.                                          style="display:inline-block;width:300px;height:250px"
  183.                                          data-ad-client="ca-pub-5699416235054188"
  184.                                          data-ad-slot="8461367752"></ins>
  185.                                     <script>
  186.                                     (adsbygoogle = window.adsbygoogle || []).push({});
  187.                                     </script>
  188.                             </div>
  189.                             <?php
  190.                             if(isset($_POST['like'])) {
  191.                                 $like = (int) $_POST['like'];
  192.                                 $sql = "UPDATE `kladilnica` SET Liked = Liked+1 WHERE ticket_id = '".$like."' AND Username = '".$user."'";
  193.                                 $return = $conn->query($sql);
  194.                                 $responseText = ($conn->affected_rows)
  195.                                 ? "<li class='SuccShared' id='activator'>You have successfully shared the ticket $ticket_id</li>"
  196.                                 : "<li class='AlreadyShared' id='activator'>The ticket ($ticket_id) was shared already</li>";
  197.                             }
  198.                         }
  199.                     }
  200.                 }
  201.             }
  202.         }
  203.    
  204.     $conn->close();
  205. ?>
  206. </body>
  207. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement