Advertisement
Guest User

Untitled

a guest
Sep 5th, 2015
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.63 KB | None | 0 0
  1. <!--
  2. Author: Dibyendu Konar
  3.  
  4. -->
  5. <?php
  6. session_start();
  7. print_r($_SESSION);
  8. include "db.php";
  9. ?>
  10. <!DOCTYPE html>
  11. <html>
  12. <head>
  13. <title>Handikap admin login</title>
  14. <meta charset="utf-8">
  15. <link href="css/style.css" rel='stylesheet' type='text/css' />
  16. <meta name="viewport" content="width=device-width, initial-scale=1">
  17. <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
  18. <!--webfonts-->
  19. <link href='http://fonts.googleapis.com/css?family=Open+Sans:600italic,400,300,600,700' rel='stylesheet' type='text/css'>
  20. <!--//webfonts-->
  21. </head>
  22. <body>
  23. <!-----start-main---->
  24. <div class="main">
  25. <div class="login-form">
  26. <h1>Admin Login</h1>
  27. <div class="head">
  28. <img src="images/user.png" alt=""/>
  29. </div>
  30. <form method="POST" onsubmit="errorCheck()">
  31. <input type="text" name="email" id="email" class="text" value="EMAIL" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'EMAIL';}" >
  32. <input type="password" id="password" name="password" value="PASSWORD" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Password';}">
  33. <div class="submit">
  34. <input type="submit" name="submit" value="LOGIN" >
  35. </div>
  36. <p><a href="<?php echo "./login"; ?>">Forgot Password ?</a></p>
  37. </form>
  38. </div>
  39. <!--//End-login-form-->
  40.  
  41. </div>
  42. <!-----//end-main---->
  43.  
  44. </body>
  45. <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
  46. <script type="text/javascript" charset="utf-8" async defer>
  47. function errorCheck()
  48. {
  49. var password = $('#password').val();
  50. var email = $('#email').val();
  51. if(((password == '') || (password == 'password') )|| ((email == '') || (email == 'EMAIL')))
  52. {
  53. alert("Please enter values");
  54. return false;
  55. }
  56. }
  57.  
  58. </script>
  59. </html>
  60.  
  61.  
  62. <?php
  63. function curPageURL() {
  64. $pageURL = 'http';
  65. if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
  66. $pageURL .= "://";
  67. if ($_SERVER["SERVER_PORT"] != "80") {
  68. $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
  69. } else {
  70. $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
  71. }
  72. return $pageURL;
  73. }
  74. function redirect($url) {
  75. if(!headers_sent()) {
  76. //If headers not sent yet... then do php redirect
  77. header('Location: '.$url);
  78. exit;
  79. } else {
  80. //If headers are sent... do javascript redirect... if javascript disabled, do html redirect.
  81. echo '<script type="text/javascript">';
  82. echo 'window.location.href="'.$url.'";';
  83. echo '</script>';
  84. echo '<noscript>';
  85. echo '<meta http-equiv="refresh" content="0;url='.$url.'" />';
  86. echo '</noscript>';
  87. exit;
  88. }
  89. }
  90.  
  91.  
  92. if(isset($_POST['submit']))
  93. {
  94. /*-------------Getting the value------------*/
  95. $emailId = trim($_POST["email"]);
  96. $passwordAdmin = trim($_POST["password"]);
  97. /*------------------------------------------*/
  98.  
  99. //echo $emailId.'<br/>'.$passwordAdmin;
  100. $result =mysql_query("SELECT * FROM `admin`");
  101. if(mysql_num_rows($result)>0)
  102. {
  103. while($row=mysql_fetch_assoc($result))
  104. {
  105. extract($row);
  106. echo '<pre/>';
  107. $values[] = $row;
  108. }
  109. }
  110. $databaseAdminEmail = $values[0]['email'];
  111. $databaseAdminPassword = $values[0]['password'];
  112. //echo $databaseAdminEmail.'<br/>'.$databaseAdminPassword;
  113. /*-----------------Validation debug--------------------------*/
  114.  
  115. if ($databaseAdminEmail != $emailId)
  116. {
  117. header('Location: '.$_SERVER['PHP_SELF'].'?auth=user_not_found');
  118.  
  119. }
  120.  
  121. if($databaseAdminPassword != $passwordAdmin)
  122. {
  123. header('Location: '.$_SERVER['PHP_SELF'].'?auth=password_error');
  124. //echo "stupid";
  125. }
  126. else
  127. {
  128.  
  129. $_SESSION["admin"] = "log_in";
  130. echo "testpassed";
  131. echo $_SESSION['login'];
  132. $newURLExploded = explode("/admin.php", $newURL);
  133. $targetUrl = "playerlist.php";
  134. redirect($targetUrl);
  135.  
  136. //die();
  137. }
  138. }
  139. ?>
  140.  
  141. <!DOCTYPE html>
  142. <?php
  143. session_start();
  144. echo $_SESSION['login'];
  145. include "db.php";
  146. ?>
  147. <html>
  148.  
  149. <head>
  150. <meta charset='UTF-8'>
  151.  
  152. <title>User information</title>
  153.  
  154. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  155.  
  156. <link rel="stylesheet" href="css/style.css">
  157.  
  158. <!--[if !IE]><!-->
  159. <style>
  160.  
  161. /*
  162. Max width before this PARTICULAR table gets nasty
  163. This query will take effect for any screen smaller than 760px
  164. and also iPads specifically.
  165. */
  166. @media
  167. only screen and (max-width: 760px),
  168. (min-device-width: 768px) and (max-device-width: 1024px) {
  169.  
  170. /* Force table to not be like tables anymore */
  171. table, thead, tbody, th, td, tr {
  172. display: block;
  173. }
  174.  
  175. /* Hide table headers (but not display: none;, for accessibility) */
  176. thead tr {
  177. position: absolute;
  178. top: -9999px;
  179. left: -9999px;
  180. }
  181.  
  182. tr { border: 1px solid #ccc; }
  183.  
  184. td {
  185. /* Behave like a "row" */
  186. border: none;
  187. border-bottom: 1px solid #eee;
  188. position: relative;
  189. padding-left: 50%;
  190. }
  191.  
  192. td:before {
  193. /* Now like a table header */
  194. position: absolute;
  195. /* Top/left values mimic padding */
  196. top: 6px;
  197. left: 6px;
  198. width: 45%;
  199. padding-right: 10px;
  200. white-space: nowrap;
  201. }
  202.  
  203. /*
  204. Label the data
  205. */
  206.  
  207. }
  208.  
  209. /* Smartphones (portrait and landscape) ----------- */
  210. @media only screen
  211. and (min-device-width : 320px)
  212. and (max-device-width : 480px) {
  213. body {
  214. padding: 0;
  215. margin: 0;
  216. width: 320px; }
  217. }
  218.  
  219. /* iPads (portrait and landscape) ----------- */
  220. @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
  221. body {
  222. width: 495px;
  223. }
  224. }
  225.  
  226. </style>
  227. <!--<![endif]-->
  228.  
  229. </head>
  230.  
  231. <body>
  232.  
  233. <div id="page-wrap">
  234.  
  235.  
  236.  
  237. <table>
  238. <thead>
  239. <tr>
  240. <th>Player id</th>
  241. <th>Percentage of complition</th>
  242. <th>Tag</th>
  243. <th>Device</th>
  244.  
  245. </tr>
  246. </thead>
  247. <tbody>
  248.  
  249.  
  250.  
  251. <?php
  252.  
  253.  
  254. $result =mysql_query("SELECT * FROM `handikap`");
  255. if(mysql_num_rows($result)>0)
  256. {
  257. while($row=mysql_fetch_assoc($result))
  258. {
  259. extract($row);
  260. echo '<pre/>';
  261. $values[] = $row;
  262. }
  263. }
  264. $sizeOfArray = sizeof($values);
  265. if($sizeOfArray >= 0)
  266. {
  267. for($i=0;$i<$sizeOfArray;$i++)
  268. {
  269.  
  270. echo "<tr>
  271. <td>".$values[$i]['playerId']."</td>
  272. <td>".$values[$i]['percentageComplete']."%"."</td>
  273. <td>".$values[$i]['tag']."</td>
  274. <td>".$values[$i]['device']."</td>
  275.  
  276. </tr>";
  277. }
  278. }
  279. ?>
  280. </tbody>
  281. </table>
  282.  
  283. </div>
  284.  
  285. </body>
  286.  
  287. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement