| Current Path : /home/ereika83/www/wp-content/plugins/pressplay/templates/ |
| Current File : /home/ereika83/www/wp-content/plugins/pressplay/templates/debug.php |
<?php
global $pp_results;
$pp_results = array();
if ( !empty( $_POST['check-ban'] )) {
$host = 'app.pressplay.io';
$port = 80;
$waitTimeoutInSeconds = 5;
if ($fp = fsockopen( $host, $port, $errCode, $errStr, $waitTimeoutInSeconds )) {
$pp_results['check-ban'] = 'Connected OK.';
} else {
$pp_results['check-ban'] = 'Connection failed.';
}
fclose( $fp );
}
if ( !empty( $_POST['check-ban-specific'] )) {
$host = $_POST['server'];
$port = 80;
$waitTimeoutInSeconds = 5;
if ($fp = fsockopen( $host, $port, $errCode, $errStr, $waitTimeoutInSeconds )) {
$pp_results['check-ban-specific'] = 'Connected OK.';
} else {
$pp_results['check-ban-specific'] = 'Connection failed.';
}
fclose( $fp );
}
function display_pp_result( $id )
{
global $pp_results;
if (isset( $pp_results[$id] )) {
echo "<pre>>> $pp_results[$id]</pre>";
}
}
?>
<pre>
Server IP: <?php echo $_SERVER['SERVER_ADDR']; ?>
</pre>
<pre>
<?php display_pp_result( 'check-ban' ); ?>
</pre>
<form action="" method="post">
Check if can connect to PressPlay server. <input type="submit" name="check-ban" value="Ping PressPlay"/>
</form>
<pre>
<?php display_pp_result( 'check-ban-specific' ); ?>
</pre>
<form action="" method="post">
Check if can connect to specific server.
<input type="text" name="server"/>
<input type="submit" name="check-ban-specific" value="Ping PressPlay"/>
</form>