Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-16-2006, 09:09 PM
gbrain gbrain is offline
 
Join Date: Jan 2006
Location: UK
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Generic_shell - php include

ok.
I have a folder that contains web pages in php, these pages, generate results based on sql statements. These can change depending on what $_POST variables are passed to it.

PHP Code:
<table width="800" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr>
    <td>Dark and Light Auction House &gt;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="800" border="1" align="center" cellpadding="2" cellspacing="2">
  <tr>
    <td><table width="600" border="0" align="center" cellpadding="2" cellspacing="2">
        <tr>
          <td width="286">&nbsp;</td>
          <td width="20">&nbsp;</td>
          <td width="274">&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td colspan="3"><hr /></td>
        </tr>
        <tr>
          <td colspan="3"><div align="center">
          <? if ($userdetails["align"] == 0)
          { ?>
              <a href="modules.php?name=auction&amp;file=auctionhouse">Enter the &quot;Dark&quot; Auction House </a>
          <? } else { ?>
                <a href="modules.php?name=auction&amp;file=auctionhouse">Enter the &quot;Light&quot; Auction House </a>
          <? } //end if ?>
            </div></td>
        </tr>
        <tr>
          <td colspan="3"><hr /></td>
        </tr>
        <tr>
        <td>
        <?
        $sql_count_items = mysql_query("select * from auction_items");
    $count_items = mysql_num_rows($sql_count_items);
    
    ?>
            <table width="100%" border="0" align="center" cellpadding="2" cellspacing="2">
              <tr>
                <td colspan="2"><div align="center">Number of &quot;<strong>Dark&quot;</strong> Items for Sale </div></td>
              </tr>
              <tr>
                <td colspan="2"><hr /></td>
              </tr>
              <tr>
                <td width="67%">Melee Weapons </td>
                <? $sql_count = mysql_query("select * from auction_item_weapon where `item_type` = '1' AND `align` = '0'");
           $itemcount = mysql_num_rows($sql_count);?>
                <td width="33%"><div align="right"><? echo $itemcount; ?>&nbsp;</div></td>
              </tr>
              <tr>
                <td>Ranged Weapons </td>
                <? $sql_count = mysql_query("select * from auction_item_weapon where `item_type` = '2' AND `align` = '0'");
           $itemcount = mysql_num_rows($sql_count);?>
                <td><div align="right"><? echo $itemcount; ?>&nbsp;</div></td>
              </tr>
              <tr>
                <td>Shield</td>
                <? $sql_count = mysql_query("select * from auction_item_shield where `item_type` = '1' AND `align` = '0'");
           $itemcount = mysql_num_rows($sql_count);?>
                <td><div align="right"><? echo $itemcount; ?>&nbsp;</div></td>
              </tr>
              <tr>
                <td>Potions</td>
                <? $sql_count = mysql_query("select * from auction_item_potions Where `align` = '0'");
           $itemcount = mysql_num_rows($sql_count);?>
                <td><div align="right"><? echo $itemcount; ?>&nbsp;</div></td>
              </tr>
              <? 
      
      for ($x = 1;$x <= $count_items;$x++) {
        $sql_count = mysql_query("select * from auction_item where `item_type` = '" . $x . "' AND `align` = '0'");
        $itemcount = mysql_num_rows($sql_count);
          
        $sql_itemname = mysql_query("select * from auction_items where `id` = '" . $x . "'");
        $itemname = mysql_fetch_array($sql_itemname);
    
      ?>
              <tr>
                <td><? echo $itemname["item_name"]; ?></td>
                <td><div align="right"><? echo $itemcount; ?>&nbsp;</div></td>
              </tr>

              <?
      } // end for
      ?>
              <tr>
                <td colspan="2"><hr /></td>
              </tr>
              <tr>
                <td colspan="2">&nbsp;</td>
              </tr>
              <tr>
                <td colspan="2">&nbsp;</td>
              </tr>
              <tr>
                <td colspan="2">&nbsp;</td>
              </tr>
          </table>          </td>
        <td>&nbsp;</td>
        <td>
                <?
        $sql_count_items = mysql_query("select * from auction_items");
    $count_items = mysql_num_rows($sql_count_items);
    
    ?>
            <table width="100%" border="0" align="center" cellpadding="2" cellspacing="2">
              <tr>
                <td colspan="2"><div align="center">Number of <strong> &quot;Light</strong>&quot; Items for Sale </div></td>
              </tr>
              <tr>
                <td colspan="2"><hr /></td>
              </tr>
              <tr>
                <td width="67%">Melee Weapons </td>
                <? $sql_count = mysql_query("select * from auction_item_weapon where `item_type` = '1' AND `align` = '1'");
           $itemcount = mysql_num_rows($sql_count);?>
                <td width="33%"><div align="right"><? echo $itemcount; ?>&nbsp;</div></td>
              </tr>
              <tr>
                <td>Ranged Weapons </td>
                <? $sql_count = mysql_query("select * from auction_item_weapon where `item_type` = '2' AND `align` = '1'");
           $itemcount = mysql_num_rows($sql_count);?>
                <td><div align="right"><? echo $itemcount; ?>&nbsp;</div></td>
              </tr>
              <tr>
                <td>Shield</td>
                <? $sql_count = mysql_query("select * from auction_item_shield where `item_type` = '1' AND `align` = '1'");
           $itemcount = mysql_num_rows($sql_count);?>
                <td><div align="right"><? echo $itemcount; ?>&nbsp;</div></td>
              </tr>
              <tr>
                <td>Potions</td>
                <? $sql_count = mysql_query("select * from auction_item_potions Where `align` = '1'");
           $itemcount = mysql_num_rows($sql_count);?>
                <td><div align="right"><? echo $itemcount; ?>&nbsp;</div></td>
              </tr>
              <? 
      
      for ($x = 1;$x <= $count_items;$x++) {
        $sql_count = mysql_query("select * from auction_item where `item_type` = '" . $x . "' AND `align` = '1'");
        $itemcount = mysql_num_rows($sql_count);
          
        $sql_itemname = mysql_query("select * from auction_items where `id` = '" . $x . "'");
        $itemname = mysql_fetch_array($sql_itemname);
    
      ?>
              <tr>
                <td><? echo $itemname["item_name"]; ?></td>
                <td><div align="right"><? echo $itemcount; ?>&nbsp;</div></td>
              </tr>

              <?
      } // end for
      ?>
              <tr>
                <td colspan="2"><hr /></td>
              </tr>
              <tr>
                <td colspan="2">&nbsp;</td>
              </tr>
              <tr>
                <td colspan="2">&nbsp;</td>
              </tr>
              <tr>
                <td colspan="2">&nbsp;</td>
              </tr>
          </table>        </td>
      </tr>
    </table></td>
  </tr>
</table>
This simple pages generates a two table list of how many items of each type are in a database.

Can I point vbulletin to this file and show it whithout having to break it up into a VB file and templates.


I have created an index.php file

PHP Code:
<?php 

// ####################### SET PHP ENVIRONMENT ########################### 
error_reporting(E_ALL & ~E_NOTICE); 

// #################### DEFINE IMPORTANT CONSTANTS ####################### 
define('NO_REGISTER_GLOBALS'1); 
define('THIS_SCRIPT''test'); // change this depending on your filename 

// ################### PRE-CACHE TEMPLATES AND DATA ###################### 
// get special phrase groups 
$phrasegroups = array( 

); 

// get special data templates from the datastore 
$specialtemplates = array( 
     
); 

// pre-cache templates used by all actions 
$globaltemplates = array( 
    
'TEST'
); 

// pre-cache templates used by specific actions 
$actiontemplates = array( 

); 

// ######################### REQUIRE BACK-END ############################ 
chdir('/url_location/forums');
require_once(
'./global.php'); 

// ####################################################################### 
// ######################## START MAIN SCRIPT ############################ 
// ####################################################################### 

 
if ($_REQUEST['do'] == 'yes')  
{  
    
$HTML = include("../auction/auction_index.php");


if (
$_REQUEST['do'] == 'no')  
{  
    
$HTML "no";
}  



$navbits = array(); 
$navbits[$parent] = 'Test Page'

$navbits construct_navbits($navbits); 
eval(
'$navbar = "' fetch_template('navbar') . '";'); 
eval(
'print_output("' fetch_template('GENERIC_SHELL') . '");'); 

?>
As you can see its uses the Generic_shell, I have added a Do = yes and no. Yes points to the include, But when you run it , the include is put at the top of the page.

http://dndgamer.gbrain.co.uk/auction/index.php?do=yes

Am I missing something, a hook or something.

thanks

G

Update :

I was given this response and was wondering if anyone knew where to find it. ?

<------------------------------------------------------------------------------>


a) I believe Erwin released a hack on vb.org that pulls the content from other php scripts via a php get contents command and displays it on a vb templated page.


thanks
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:04 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.03482 seconds
  • Memory Usage 2,210KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete