Advertisement
Whistik

Untitled

Mar 19th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.53 KB | None | 0 0
  1. <?php
  2. require 'res/development/config.php';
  3. if(isset($_POST['log_create'])){
  4.     $qry = $GLOBALS['db']->prepare("INSERT INTO log(log_time, log_info) VALUES(:log_time, :log_info)");
  5.     $qry->execute(array(":log_time" => date("d/m/Y H:i:s", time()), ":log_info" => $_POST['log_info']));
  6. }
  7. function getLogs(){
  8.     $qry = $GLOBALS['db']->prepare("SELECT * FROM log ORDER BY log_id DESC");
  9.     $qry->execute();
  10.     while($logData = $qry->fetch(PDO::FETCH_ASSOC)){
  11.         $ret = "<div class='box'><span class='time'><strong>{$logData['log_time']}</strong></span><div class='content'>
  12.         -{$logData['log_info']}
  13.         </div></div>";
  14.         print($ret);
  15.     }
  16. }
  17. ?>
  18. <!DOCTYPE html>
  19. <html>
  20. <head>
  21.     <title>TinyPrivate - LOG</title>
  22. </head>
  23. <body>
  24. <style type="text/css">
  25.     body{
  26.         background-color: #eee;
  27.         font-family: Verdana;
  28.     }
  29.     .box{
  30.         display: box;
  31.         border:1px solid;
  32.         border-radius: 5px;
  33.         background-color: #eee;
  34.         margin-top:3px;
  35.         text-align: left;
  36.  
  37.     }
  38.     .box .content{
  39.         text-align: center;
  40.         margin-bottom: 20px;
  41.     }
  42.     .time{
  43.         margin-left:5px;
  44.         font:14px/10px sans-serif;
  45.     }
  46. </style>
  47. <?php
  48. if($_SERVER['REMOTE_ADDR'] == "109.105.39.50"){
  49. ?>
  50. <form action="<?PHP $PHP_SELF; ?>" method="POST">
  51.     <div class="box" style="border-radius: 0px;height: 100px;">
  52.         <div class="content">
  53.         <textarea name="log_info" placeholder="..."></textarea><br/>
  54.         <input type="submit" name="log_create" value="Create log">
  55.         </div>
  56.     </div>
  57. </form>
  58. <?php
  59. }
  60. ?>
  61. <center>
  62. <h1>TinyPrivate-LOGS</h1>
  63. <br/>
  64. <?php echo getLogs(); ?>
  65. <br/>
  66. </center>
  67. </body>
  68. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement