The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Need help - custom ping script!
Using this mod I want to imbed a custom Ping script into the page.
The script works fine, it pings a web address or IP fine however, the results are outputted to the very top of the web page, above the logo. I want the results to output right underneath the field that you type the web address/IP into. Here is the ping script: Code:
<?php error_reporting(E_ALL & ~E_NOTICE); define('NO_REGISTER_GLOBALS', 1); define('THIS_SCRIPT', 'page_ping'); // change this depending on your filename $phrasegroups = array( ); $specialtemplates = array( ); $globaltemplates = array( 'page_ping', ); $actiontemplates = array( ); chdir('/home/USERNAME/public_html/'); require_once('./global.php'); // Start Ping $_ip = $_SERVER['REMOTE_ADDR']; if($_GET['do'] == 'ping') { $_domain = $_POST['domain']; echo "<pre>"; system ("ping -w 10 -c 5 $_domain"); echo "</pre>"; } // End Ping $pingresult = $_POST['ping -w 10 -c 5 $_domain']; $navbits = array(); $navbits[$parent] = 'Ping'; $navbits = construct_navbits($navbits); eval('$navbar = "' . fetch_template('navbar') . '";'); eval('print_output("' . fetch_template('page_ping') . '");'); ?> Here is my template: Code:
$stylevar[htmldoctype] <html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]"> <head> <title>$vboptions[bbtitle]</title> $headinclude </head> <body> $header $navbar <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"> <tr> <td class="tcat">Ping</td> </tr> <tr> <td class="alt1"> Enter the IP Address or domain name of the server that you want to ping.<br> <form method='post' action='page_ping.php?do=ping'><input type='text' name='domain' value=''> <input type='submit' value='Ping'></form> <br /><br /> $pingresult <br /> </td> </tr> </table> $footer </body> </html> What do I need to do to get this working correctly? I've tried many different things to get this working - currently this seems to be the most 'functional' for lack of a better word. Any help would be greatly appreciated. Thanks! |
#2
|
|||
|
|||
Create a template for it instead of using 'echo'.
Regular echo is only suitable for debug with vBulletin. |
#3
|
|||
|
|||
Sorry, I'm going to need a bit more detail. I don't understand!
|
#4
|
||||
|
||||
All your display should be in your templates. The PHP code should not print any output into the browser (except for the final print_output), but instead assign all the data into variables for use in the template.
|
#5
|
|||
|
|||
Hmmm! Not having much luck with this. I even tried dynamic AJAX inclusions using a script from dynamic drive and I still couldn't get it to work properly.
Unfortunately, I'm not the most talented coder out there. |
#6
|
||||
|
||||
Use this PHP instead of yours. The template doesn't need to be changed (keep the one you posted above).
PHP Code:
|
#7
|
|||
|
|||
I had something similar to what you have posted but I there were a few errors in mine when I tried to run it.
There are no errors in yours but check it out now (http://www.itresource.com.au/page_ping.php). I wont bother explaining, you will see the results yourself. |
#8
|
||||
|
||||
PHP Code:
|
#9
|
|||
|
|||
Now no results appear, just a 0 under the form.
|
#10
|
||||
|
||||
PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|