SHOW:
|
|
- or go back to the newest paste.
| 1 | - | $(document).ready(function(){ |
| 1 | + | $(document).ready(function(){
|
| 2 | - | |
| 2 | + | |
| 3 | - | $(".reload").click(function() { |
| 3 | + | $(".reload").click(function() {
|
| 4 | - | $("div#update").fadeOut("fast") |
| 4 | + | $("div#update").fadeOut("fast")
|
| 5 | - | .load("home.php div#update").fadeIn("fast") |
| 5 | + | .load("home.php div#update").fadeIn("fast")
|
| 6 | - | }); |
| 6 | + | |
| 7 | }); | |
| 8 | ||
| 9 | - | function statusUpdate() { |
| 9 | + | function statusUpdate() {
|
| 10 | - | |
| 10 | + | |
| 11 | - | $service_query = mysql_query("SELECT * FROM service ORDER BY status"); |
| 11 | + | $service_query = mysql_query("SELECT * FROM service ORDER BY status");
|
| 12 | - | $service_num = mysql_num_rows($service_query); |
| 12 | + | $service_num = mysql_num_rows($service_query); |
| 13 | - | |
| 13 | + | |
| 14 | - | for ($x=1;$x<=$service_num;$x++) { |
| 14 | + | for ($x=1;$x<=$service_num;$x++) {
|
| 15 | - | $service_row = mysql_fetch_row($service_query); |
| 15 | + | $service_row = mysql_fetch_row($service_query); |
| 16 | - | |
| 16 | + | |
| 17 | - | $second_query = mysql_query("SELECT * FROM service WHERE sid='$service_row[0]'"); |
| 17 | + | $second_query = mysql_query("SELECT * FROM service WHERE sid='$service_row[0]'");
|
| 18 | - | $row = mysql_fetch_row($second_query); |
| 18 | + | $row = mysql_fetch_row($second_query); |
| 19 | - | |
| 19 | + | |
| 20 | - | $socket = @fsockopen($row[3], $row[4], $errnum, $errstr, 0.01); |
| 20 | + | $socket = @fsockopen($row[3], $row[4], $errnum, $errstr, 0.01); |
| 21 | - | if ($errnum >= 1) { $status = 'offline'; } else { $status = 'online'; } |
| 21 | + | if ($errnum >= 1) { $status = 'offline'; } else { $status = 'online'; }
|
| 22 | - | |
| 22 | + | |
| 23 | - | mysql_query("UPDATE service SET status='$status' WHERE sid='$row[0]'") |
| 23 | + | mysql_query("UPDATE service SET status='$status' WHERE sid='$row[0]'")
|
| 24 | - | or die(mysql_error()); |
| 24 | + | or die(mysql_error()); |
| 25 | - | |
| 25 | + | |
| 26 | - | ?> |
| 26 | + | ?> |
| 27 | - | |
| 27 | + | |
| 28 | - | <ul><li style="min-width:190px;"><?php echo $row[1]; ?></li> |
| 28 | + | <ul><li style="min-width:190px;"><?php echo $row[1]; ?></li> |
| 29 | - | <li style="min-width: 190px;" title="DNS: <?php echo $row[2]; ?>"> |
| 29 | + | <li style="min-width: 190px;" title="DNS: <?php echo $row[2]; ?>"> |
| 30 | - | <?php echo $row[3] . ':' . $row[4]; ?></li> |
| 30 | + | <?php echo $row[3] . ':' . $row[4]; ?></li> |
| 31 | - | <li class="<?php echo $status; ?>" style="min-width:80px;"><div id="update"> |
| 31 | + | <li class="<?php echo $status; ?>" style="min-width:80px;"><div id="update"> |
| 32 | - | <?php echo $status; ?></div></li></ul> |
| 32 | + | <?php echo $status; ?></div></li></ul> |
| 33 | - | |
| 33 | + | |
| 34 | - | <?php |
| 34 | + | <?php |
| 35 | - | |
| 35 | + | |
| 36 | - | } |
| 36 | + | } |
| 37 | - | } |
| 37 | + | } |
| 38 | - | |
| 38 | + | |
| 39 | - | ?> |
| 39 | + | |
| 40 | - | |
| 40 | + | |
| 41 | <?php statusUpdate(); ?> | |
| 42 | ||
| 43 | - | $(document).ready(function(){ |
| 43 | + | $(document).ready(function(){
|
| 44 | - | |
| 44 | + | |
| 45 | - | $(".reload").click(function() { |
| 45 | + | $(".reload").click(function() {
|
| 46 | - | $("div#update").fadeOut("fast"); |
| 46 | + | $("div#update").fadeOut("fast");
|
| 47 | - | $.ajax({ |
| 47 | + | $.ajax({
|
| 48 | - | url:'home.php', |
| 48 | + | url:'home.php', |
| 49 | - | data:{type:'getStatus'}, |
| 49 | + | data:{type:'getStatus'},
|
| 50 | - | type;'post', |
| 50 | + | type;'post', |
| 51 | - | success:function(data){ |
| 51 | + | success:function(data){
|
| 52 | - | $('div#update').html(data).fadeIn('fast'); |
| 52 | + | $('div#update').html(data).fadeIn('fast');
|
| 53 | - | } |
| 53 | + | } |
| 54 | - | }); |
| 54 | + | }); |
| 55 | - | }); |
| 55 | + | }); |
| 56 | }); | |
| 57 | ||
| 58 | - | <?php |
| 58 | + | <?php |
| 59 | - | $type= $_POST['type']; |
| 59 | + | $type= $_POST['type']; |
| 60 | - | if($type=="getStatus") |
| 60 | + | if($type=="getStatus") |
| 61 | - | { |
| 61 | + | {
|
| 62 | - | //get statuses from data base and return only formatted statuses in html |
| 62 | + | //get statuses from data base and return only formatted statuses in html |
| 63 | - | } |
| 63 | + | } |
| 64 | - | else |
| 64 | + | else |
| 65 | - | { |
| 65 | + | {
|
| 66 | - | //your page codes here |
| 66 | + | //your page codes here |
| 67 | - | //like tags <html>,<body> etc, all regular tags |
| 67 | + | //like tags <html>,<body> etc, all regular tags |
| 68 | - | //<script> tags etc |
| 68 | + | //<script> tags etc |
| 69 | - | } |
| 69 | + | } |
| 70 | ?> | |
| 71 | ||
| 72 | .load("home.php div#update").fadeIn("fast")
| |
| 73 | ||
| 74 | - | $('div#update').load('home.php', function(data) { |
| 74 | + | $('div#update').load('home.php', function(data) {
|
| 75 | - | $('div#update').html(data).fadeIn("fast"); |
| 75 | + | $('div#update').html(data).fadeIn("fast");
|
| 76 | }); | |
| 77 | ||
| 78 | - | var $data = $('div#update'); |
| 78 | + | var $data = $('div#update');
|
| 79 | - | $data.fadeOut('slow', function() { |
| 79 | + | $data.fadeOut('slow', function() {
|
| 80 | - | $data.load('home.php div#update', function() { |
| 80 | + | $data.load('home.php div#update', function() {
|
| 81 | - | $data.fadeIn('slow'); |
| 81 | + | $data.fadeIn('slow');
|
| 82 | - | }); |
| 82 | + | }); |
| 83 | }); | |
| 84 | ||
| 85 | - | var $data = $('div#update'); |
| 85 | + | var $data = $('div#update');
|
| 86 | - | $data.fadeOut('slow', function() { |
| 86 | + | $data.fadeOut('slow', function() {
|
| 87 | - | $data.load('phpcode.php div#update', function() { |
| 87 | + | $data.load('phpcode.php div#update', function() {
|
| 88 | - | $data.fadeIn('slow'); |
| 88 | + | $data.fadeIn('slow');
|
| 89 | - | }); |
| 89 | + | }); |
| 90 | }); |