web.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. $http_host = $_SERVER['HTTP_HOST'];
  3. $default_host = substr($http_host, 0, strpos($http_host, ':'));
  4. include("../functions.php");
  5. $con = startdb();
  6. if (!checkSession($con)){
  7. header("Location: /index.php");
  8. exit (-1);
  9. }
  10. else{
  11. ?>
  12. <html>
  13. <head>
  14. <meta content="text/html; charset=windows-1252" http-equiv="content-type"/>
  15. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
  16. <title>Estadisticas Web - Administracion</title>
  17. <!-- CSS files -->
  18. <link rel="stylesheet" type="text/css" href="/css/ui.css"/>
  19. <link rel="stylesheet" type="text/css" href="/css/estadisticas.css"/>
  20. <!-- CSS for mobile version -->
  21. <link rel="stylesheet" type="text/css" media="(max-width : 990px)" href="/css/m/ui.css"/>
  22. <link rel="stylesheet" type="text/css" media="(max-width : 990px)" href="/css/m/estadisticas.css"/>
  23. <!-- Script files -->
  24. <script type="text/javascript" src="/script/ui.js"></script>
  25. </head>
  26. <body>
  27. <?php include('toolbar.php'); ?>
  28. <div id='content'>
  29. <div id='section_table'>
  30. <div class='section_row'>
  31. <div class='section_cell'>
  32. <div class='section'>
  33. <h3 class='section_title'>Visitantes &Uacute;nicos</h3>
  34. <?php
  35. $q_total = mysqli_query($con, "SELECT LOW_PRIORITY COUNT(id) AS c FROM stat_visit;");
  36. $q_week = mysqli_query($con, "SELECT LOW_PRIORITY COUNT(id) AS c FROM stat_visit WHERE id IN (SELECT visit FROM stat_view WHERE dtime > DATE_FORMAT(LAST_DAY(NOW()) - ((7 + WEEKDAY(LAST_DAY(NOW())) - 7) % 7), '%Y-%m-%d'));");
  37. $q_month = mysqli_query($con, "SELECT LOW_PRIORITY COUNT(id) AS c FROM stat_visit WHERE id IN (SELECT visit FROM stat_view WHERE dtime > LAST_DAY(NOW() - INTERVAL 1 MONTH) + INTERVAL 1 DAY);");
  38. $q_year = mysqli_query($con, "SELECT LOW_PRIORITY COUNT(id) AS c FROM stat_visit WHERE id IN (SELECT visit FROM stat_view WHERE dtime > DATE_FORMAT(NOW() ,'%Y-01-01'));");
  39. $r_total = mysqli_fetch_array($q_total);
  40. $r_week = mysqli_fetch_array($q_week);
  41. $r_month = mysqli_fetch_array($q_month);
  42. $r_year = mysqli_fetch_array($q_year);
  43. ?>
  44. <div class='entry'>
  45. <ul>
  46. <li>Totales: <?php echo($r_total['c']); ?> </li>
  47. <li>Semana: <?php echo($r_week['c']); ?> </li>
  48. <li>Mes: <?php echo($r_month['c']); ?> </li>
  49. <li>A&ntilde;o: <?php echo($r_year['c']); ?> </li>
  50. </ul>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </body>
  58. </html>
  59. <?php } ?>