vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Include PHP in custom pages (https://vborg.vbsupport.ru/showthread.php?t=156347)

rayw 08-27-2007 02:10 AM

Include PHP in custom pages
 
Is there anyway I can easily add PHP code to a custom page using this mod... or something similar!

I can only seem to get HTML to work which is for the most part great, however, there are a few small PHP scripts which I would like to include in the custom pages.

Any help would be greatly appreciated.

Thanks a lot. :up:

Kirk Y 08-27-2007 02:17 AM

Add your code anywhere in the PHP page you created. It can then be executed on that page.

rayw 08-27-2007 03:10 AM

It only displays what is in the template though. How do I get it to display on the page?

EDIT: Here is what it is currently doing! - look in the top left.

Kirk Y 08-27-2007 03:27 AM

Post up the code you're using in the script.

rayw 08-27-2007 03:38 AM

Code:

<?php
$_ip = $_SERVER['REMOTE_ADDR'];
echo "Enter the IP Address or domain name of the server that you want to ping.<br>";
echo "<form method='post' action='ping.php?do=ping'><input type='text' name='domain' value=''>&nbsp;<input type='submit' value='Ping'></form>";
if($_GET['do'] == 'ping')
{
$_domain = $_POST['domain'];
                echo "<pre>";
                  system ("ping -w 10 -c 5 $_domain");

                  echo "</pre>";
}
echo "<br>";
 ?>


Kirk Y 08-27-2007 03:42 AM

Okay you can't echo anything out, anything you're using echo statements for needs to be set to a variable or directly placed in your template.

For example, this could be removed from the script and placed in the template:
Code:

Enter the IP Address or domain name of the server that you want to ping.<br>

<form method='post' action='ping.php?do=ping'><input type='text' name='domain' value=''>&nbsp;<input type='submit' value='Ping'></form>


RetroDreams 08-27-2007 03:56 AM

I hate to hijack, but can this be done with dynamic pages that pass variables?

rayw 08-27-2007 04:28 AM

The ping is now working, but the results are being outputted to the top of the screen.

I'm assuming now to get the results to appear underneath the form rather then at the top I need to turn something into a variable (as you mentioned) but I can't get this working.

I seriously wish I was better at PHP coding - I'm just not meant to be a programmer though!!! Took me long enough to get the ping script working. :(


All times are GMT. The time now is 10:12 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00970 seconds
  • Memory Usage 1,725KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete