ericek111

Frames Index page

Jul 27th, 2014
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.37 KB | None | 0 0
  1. <html>
  2. <head>
  3.   <title>Frames Test</title>
  4.   <meta charset="utf8">
  5.   <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
  6.   <script src="<?=PATH?>js/jquery.cookie.js"></script>
  7.   <link rel="stylesheet" type="text/css" href="style.css">
  8.     <script type="text/javascript" src="<?=PATH?>js/noty/packaged/jquery.noty.packaged.min.js"></script>
  9.        <script type="text/javascript">
  10.        
  11.         function loadlog(showalert) {
  12.         $.get( "logger.php?action=showlog", function(data) {
  13.     if(data == "error") {
  14.      $.noty.consumeAlert({layout: 'topCenter', type: 'error', dismissQueue: true});
  15.         alert("Error whilst trying to load logfile! [1]");
  16.     } else {
  17.     if(showalert) {
  18.     $.noty.consumeAlert({layout: 'topCenter', type: 'success', dismissQueue: true, timeout: 2000});
  19.         alert("Logfile loaded!"); }
  20.         $('#logcontent').html(data);
  21.         }
  22.     })
  23.     .fail(function(data) {
  24.      $.noty.consumeAlert({layout: 'topCenter', type: 'error', dismissQueue: true});
  25.         alert("Error whilst trying to load logfile! [2]");
  26.     });
  27.        }
  28.        function clearlog() {
  29.                 $.get( "logger.php?action=clearlog", function(data) {
  30.     if(data == "cleared") {
  31.         $.noty.consumeAlert({layout: 'topCenter', type: 'success', dismissQueue: true});
  32.         alert("Logfile cleared!");
  33.         $('#logcontent').html(data);
  34.         loadlog(false);
  35.     } else {
  36.      $.noty.consumeAlert({layout: 'topCenter', type: 'error', dismissQueue: true, timeout: 3000});
  37.         alert("Error whilst trying to clear logfile! [1]" + data);
  38.         }
  39.     })
  40.     .fail(function(data) {
  41.      $.noty.consumeAlert({layout: 'topCenter', type: 'error', dismissQueue: true, timeout: 3000});
  42.         alert("Error whilst trying to clear logfile! [2]");
  43.     });
  44.        }
  45.         function wakeup() {
  46.     var invocations = 0;
  47.  
  48.       if (++invocations >= 200) {
  49.         $.noty.consumeAlert({layout: 'topCenter', type: 'warning', dismissQueue: true, timeout: 3000});
  50.         alert("Stopped loading!");
  51.         clearInterval(handle);
  52.       } else {
  53.       loadlog(false);
  54.       }
  55.       }
  56.        function opentab(id) {
  57.        $("#container").html($("#page" + id).html());
  58.        $.cookie("lixko1_lasttab", id);
  59.        if(id == "2") {
  60.        $(document).ready(function() {
  61.  
  62.     var handle = setInterval(wakeup, 2000);
  63.  
  64.     });
  65.        } else {
  66.        if(handle === false) {} else {clearInterval(handle);
  67.        }
  68.        }
  69.        loadlog(true);
  70.        }
  71.        function notif() {
  72.         $.noty.consumeAlert({layout: 'topRight', type: 'success', dismissQueue: true});
  73.         alert("This is the same but noty consumed with options");
  74.        }
  75.      $(document).ready(function(){
  76.      opentab($.cookie('lixko1_lasttab'));
  77.             /*$('#submitbut').change(function(){
  78.                  $.ajax({
  79.                        type: "GET",
  80.                        url: "send.php",
  81.                        data: "query="+document.form.textarea.value,
  82.                        success: function(msg){
  83.                         document.getElementById("Div_Where_you_want_the_response").innerHTML = msg                         }
  84.                      })
  85.             });*/
  86.         });
  87.  
  88.  
  89.     </script>
  90. </head>
  91. <body>
  92. <? logtofile("Page loaded!", "d"); ?>
  93.   <div id="page">
  94.   <div id="al">
  95.   <div id="menu">
  96.     <a href="#" name="link1" class="tab" onclick=opentab("1")>Debug</a>
  97.     <a href="#" name="link1" class="tab" onclick=opentab("2")>Log</a>
  98.     <a href="#" name="link1" class="tab" onclick=opentab("3")>Users</a>
  99.     <a href="#" name="link1" class="tab" onclick=opentab("4")>Ahoj!</a>
  100.   </div>
  101.   <div id="content">
  102.     <div id="container"></div>
  103.     <div id="page1" class="hiddenpage">
  104.       <b>Path: </b><?=PATH?><br />
  105.       <b>Date: </b><? echo date("Y-m-d H:m:s") ?><br />
  106.       <b>Logfile: </b><?=LOGFILE?><br />
  107.       <b>Absolute path: </b> <?=ABSPATH?>
  108.     </div>
  109.     <div id="page2" class="hiddenpage">
  110.       <input type="submit" name="submitbut" id="submitbut" value="Clear log!" onclick=clearlog(); /> &nbsp; &nbsp; Auto-refresh:<input type="checkbox" name="autoupdate" id="autoupdate" />
  111.       <pre><div id="logcontent"></div></pre>
  112.       <br />
  113.  
  114.     </div>
  115.     <div id="page3" class="hiddenpage">
  116.     <? if(LEVEL == "debug") {
  117.     $array = ["firstname" => "Erik", "lastname" => "Bročko", "city" => "Trnava"];
  118.     $jsoned = json_encode($array);
  119.     echo($jsoned . "<br />");
  120.     $original = json_decode($jsoned, true);
  121. //     var_dump($original);
  122.     echo("<b>First: </b>" . $original["firstname"] . " <b>Last: </b>" . $original["lastname"]);
  123.     if(isset($original["city"])) { echo(" <b>City:</b>". $original["city"]); } else {echo(" <b>City</b> is not set! <br />"); }    ?>
  124.     <!--       <b>User 1: <? if(user_exists(1)){ echo("Exists!"); } ?></b><br /> -->
  125.        <br /><b>Userdata: <? echo(get_userdata(1)); ?></b><br />
  126.        <? } ?>
  127.     <form>
  128.     Name:
  129.     <input type="submit" value="Register" name="registerbut" id="registerbut" />
  130.     </form>
  131.  
  132.       <table class="gridtable">
  133.       <tr>
  134.     <th colspan="5" class="head">MySQL</th>
  135.     <th colspan="3" class="head">JSON userdata</th>
  136.       </tr>
  137.       <tr>
  138.     <th><b>#</b></th>
  139.     <th><b>Username</b></th>
  140.     <th><b>E-mail</b></th>
  141.     <th><b>Rank</b></th>
  142.     <th><b>Created</b></th>
  143.     <th><b>First name</b></th>
  144.     <th><b>Last name</b></th>
  145.     <th><b>City</b></th>
  146.       </tr>
  147.      <?
  148.        sql_connect();
  149.   global $mysqli;
  150.   $sql = "SELECT * FROM `users`";
  151.   if(!$result = $mysqli->query($sql)){
  152.     logtofile("There was an error running the query! (" . $mysqli->errno . ") " . $mysqli->error, "f");
  153.     die('There was an error running the query [' . $mysqli->error . ']');
  154.   }
  155.      while($row = mysqli_fetch_array($result)) {
  156.      $userdata = json_decode($row["data"], true); ?>
  157.  
  158.       <tr>
  159.     <td><?=$row['id']?></td>
  160.     <td><?=$row['username']?></td>
  161.     <td><?=$row['email']?></td>
  162.     <td><?=getrank(5)?></td>
  163.     <td><?=$row['created']?></td>
  164.     <td><?=$userdata['firstname']?></td>
  165.     <td><?=$userdata['lastname']?></td>
  166.     <td><?=$userdata['city']?></td>
  167.       </tr>
  168.      
  169.      <? } ?>
  170.      </table>
  171.      </div>
  172.     <div id="page4" class="hiddenpage">Stránka 4! ŠTVRTÁ!</div>
  173.   </div>
  174. </div>
  175. <?php ?>
  176. <script type="text/javascript">
  177. if($.cookie('lixko1_lasttab') == '1' || $.cookie('lixko1_lasttab') == '2' || $.cookie('lixko1_lasttab') == '3' || $.cookie('lixko1_lasttab') == '4' ) {
  178. opentab($.cookie('lixko1_lasttab'));
  179. } else {
  180. opentab("1");
  181. }
  182. </script>
  183. </body>
  184. </html>
Advertisement
Add Comment
Please, Sign In to add comment