View Single Post
  #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
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01700 seconds
  • Memory Usage 1,872KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)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 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete