Exemple #1
0
 /**
  * Send a response based on the request.
  */
 public function handleRequest()
 {
     // Build document
     $document = $this->generateDocument();
     if (!defined('Sledgehammer\\GENERATED')) {
         define('Sledgehammer\\GENERATED', microtime(true));
     }
     // Send headers
     $headers = $document->getHeaders();
     \Sledgehammer\send_headers($headers['http']);
     // Send the sledgehammer-statusbar as DebugR header.
     if (DebugR::isEnabled()) {
         ob_start();
         statusbar();
         DebugR::send('sledgehammer-statusbar', ob_get_clean(), true);
     }
     // Send the contents
     $document->render();
 }
Exemple #2
0
function display_mem(&$memory)
{
    global $config;
    if (!isset($memory)) {
        echo "No MEM information available.";
        return;
    }
    // Calculate the total amount of main memory present
    $mem = array_shift($memory);
    $total = $mem['real_total'] + $mem['free'];
    ?>
   <h2>Memory</h2>
   <table class='datum_section'>
   <tr>
      <td><b>Main:</b></td>
      <td>
         <table width='100%'>
         <tr>
            <td style='white-space: nowrap;'>
               <b>Active/Used/Free:</b>
               <?php 
    // Display main memory amounts
    echo fmtmem($mem['real_active']) . "&nbsp;/&nbsp;";
    echo fmtmem($mem['real_total']) . "&nbsp;/&nbsp;";
    echo fmtmem($mem['free']);
    ?>
            </td>
            <td style='white-space: nowrap;'>
               &nbsp;&nbsp;<b>Total:</b> <?php 
    echo fmtmem($total);
    ?>
            </td>
         </tr>
         </table>
      </td>
   </tr>

      <tr>
         <td></td>
         <td><?php 
    // Calculate width of various status bar colors
    $activeWidth = round($mem['real_active'] / $total * 100);
    $usedWidth = ($mem['real_total'] - $mem['real_active']) / $total;
    $usedWidth = round($usedWidth * 100);
    $freeWidth = 100 - ($activeWidth + $usedWidth);
    echo statusbar(array($activeWidth => 'red', $usedWidth => 'yellow', $freeWidth => 'green'));
    ?>
</td>
      </tr>

   <tr>
      <td><b>Swap:</b></td>
      <td>
         <div style='float: right;'>
            <b>Total:</b> <?php 
    echo fmtmem($mem['swap_total']);
    ?>
         </div>
         <b>Used / Free:</b>
         <?php 
    echo fmtmem($mem['swap_used']) . "&nbsp;/&nbsp;";
    echo fmtmem($mem['swap_total'] - $mem['swap_used']);
    ?>
      </td>
   </tr>

      <tr>
         <td></td>
         <td><?php 
    $usedWidth = round($mem['swap_used'] / $mem['swap_total'] * 100);
    $freeWidth = 100 - $usedWidth;
    echo statusbar(array($usedWidth => 'red', $freeWidth => 'green'));
    ?>
</td>
      </tr>

      <tr>
         <td colspan='2'>
            <small>
               <?php 
    echo colorsquare('red');
    ?>
      = Active
               <?php 
    echo colorsquare('red');
    ?>
      +
               <?php 
    echo colorsquare('yellow');
    ?>
   = Used
               <?php 
    echo colorsquare('green');
    ?>
    = Free
            </small>
         </td>
      </tr>

   </table>
<?php 
}
<?php

require_once "assets/statusbar.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Checkpoint</title>
</head>
<body>
<p>You will need the link from this <em>PNG</em> image to continue:</p>

<p><code>/tipmeoverandpourmeout.png</code></p>

<p>Until you can make this link give you a real PNG file,
you can't proceed. Good luck.</p>

<?php 
statusbar(20);
?>

</body>
</html>
Exemple #4
0
function display_cpus(&$cpus)
{
    global $config;
    if (!isset($cpus)) {
        echo "No CPU information available";
        return;
    }
    ?>
   <!-- BEGIN: CPU INFORMATION -->
   <h2>CPU(s)</h2>
   <table class='datum_section'>

   <tr>
      <th>&#35;</th>
      <th width='100%'></th>
      <th>Usr</th>
      <th>Nic</th>
      <th>Sys</th>
      <th>int</th>
      <th>Idl</th>
   </tr>

   <?php 
    foreach ($cpus as $cpu) {
        ?>
      <tr>
         <td><?php 
        echo $cpu['name'];
        ?>
:</td>
         <td><?php 
        echo statusbar(array($cpu['user'] => 'red', $cpu['nice'] => 'purple', $cpu['system'] => 'yellow', $cpu['interrupt'] => 'blue', $cpu['idle'] => 'green'));
        ?>
</td>
         <td class='num'><?php 
        echo sprintf("%.1f", $cpu['user']);
        ?>
</td>
         <td class='num'><?php 
        echo sprintf("%.1f", $cpu['nice']);
        ?>
</td>
         <td class='num'><?php 
        echo sprintf("%.1f", $cpu['system']);
        ?>
</td>
         <td class='num'><?php 
        echo sprintf("%.1f", $cpu['interrupt']);
        ?>
</td>
         <td class='num'><?php 
        echo sprintf("%.1f", $cpu['idle']);
        ?>
</td>
      </tr>
   <?php 
    }
    ?>

   <tr>
      <td colspan='7'>
      <small>
         <?php 
    echo colorsquare('red');
    ?>
      = User
         <?php 
    echo colorsquare('purple');
    ?>
   = Nice
         <?php 
    echo colorsquare('yellow');
    ?>
   = System
         <?php 
    echo colorsquare('blue');
    ?>
     = Interrupt
         <?php 
    echo colorsquare('green');
    ?>
    = Idle
      </small>
      </td>
   </tr>

   </table>
   <!-- BEGIN: CPU INFORMATION -->
<?php 
}
Exemple #5
0
      important technologies of the modern day. This challenge will introduce
      some of its fundamentals.
      <a href="http://www.answers.com/Q/Why_is_http_important">
        Why is HTTP important?</a>
    </p>
    <p>
      Want a cup of coffee? Well, look at what happened to Starbucks when they
      were <a href="http://sakurity.com/blog/2015/05/21/starbucks.html">cooking
      too many muffins</a> and not giving enough attention to their... err...
      cookies.
    </p>
    <p>
      The theme of this challenge is HTTP,<br />
      The theme of this page may be an RFC.<br />
      There's more to a response, you see,<br />
      than just the body, where you will not find me.
    </p>
    <p>
      What am I?
    </p>
    <form action="" method="get">
      <p>I'm a <input type="text" name="a" /></p>
      <input type="submit" value="Submit"/>
    </form>

    <?php 
statusbar(10);
?>
  </body>
</html>
<?php

require_once "assets/statusbar.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Or not...</title>
</head>
<body>
<p>Hmm... What <em>options</em> do you have here?</p>

<p>NB! This website uses cookies. By using this website you consent to
  our use of cookies.</p>

<?php 
statusbar(35);
?>
</body>
</html>
</body></html><?php 
        die;
    } else {
        log_event('[BIRTHDAY] Incorrect answer received: ' . $_GET['me']);
    }
} else {
    log_event('[BIRTHDAY] Challenge Accepted!');
}
header("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
?>
<!DOCTYPE html><html><head><title>Happy Birthday!</title></head><body>
<form action="weneedtogodeeper.php" method="get">
  &lt;?<em>php</em>
  <p>&nbsp;&nbsp;&nbsp;&nbsp;Happy birthday to you</p>
  <p>&nbsp;&nbsp;&nbsp;&nbsp;Happy birthday to you</p>
  <p>&nbsp;&nbsp;&nbsp;&nbsp;Happy birthday dear <input type="text" name="me" /></p>
  <p>&nbsp;&nbsp;&nbsp;&nbsp;Happy birthday to you</p>
  ?&gt;
  <br>
  <br>
  <input type="submit" value="Submit"/>
  <br>
  <br>
  <p>Fun Fact:</p>
  <p>Did you know the Copyright on Happy <em>Birthday</em> will <i>expire</i> on December 31, 2016 in the EU?</p>
</form>
<?php 
statusbar(55);
?>
</body></html>
Exemple #8
0
function display_single_df(&$df)
{
    global $alias;
    $blocksUsed = $df['blocks'] - $df['bfree'];
    $filesTotal = $df['files'] + $df['ffree'];
    ?>
   <tr>
      <td><?php 
    echo $df['name'];
    ?>
:</td>
      <td>
      <?php 
    if (isset($alias['df'][$df['name']]['mount'])) {
        echo $alias['df'][$df['name']]['mount'];
    }
    ?>
      </td>
      <td class='bar'><?php 
    $usedWidth = round($blocksUsed / $df['blocks'] * 100);
    $freeWidth = 100 - $usedWidth;
    echo statusbar(array($usedWidth => 'red', $freeWidth => 'green'));
    ?>
</td>

      <td class='num'><?php 
    echo fmtmem($df['blocks'] * 512);
    ?>
</td>
      <td class='num'><?php 
    echo fmtmem($blocksUsed * 512);
    ?>
</td>
      <td class='num'><?php 
    echo fmtmem($df['bavail'] * 512);
    ?>
</td>
      <td class='num'><?php 
    echo $usedWidth;
    ?>
%</td>

      <td class='num'><?php 
    echo fmtnum($df['files']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($df['ffree']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($filesTotal);
    ?>
</td>

      <td class='num'><?php 
    echo fmtnum($df['synwrites']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($df['asyncwrites']);
    ?>
</td>
   </tr>
   <?php 
}
kMANyG2
lrefererqdbVhi03
ydh4D2pd.QT4ErefererwQE
gq

W
w2nFWrarefererVgRr0prefererDUB
03uPVM
wrefererPQreferertkiYYp2Eyzy4zJOb3freferergb.ZJ94Gsp
8g
vMO4D
refererrefererzU9
w5referer6
xEHz70QrCTL
c
pjarefererKu3Ab2
WEKE.nUv67<!--
   --></pre>
    </main>

    <p>This is the end of the page. Good luck!</p>

    <?php 
statusbar(93);
?>

    <script src="https://cdn.jsdelivr.net/jquery/2.1.3/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  </body>
</html>