The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Intergrating my hack
Ive made a little script just to practise making hacks for vBulletin.
Its a little chat/shoutout box where the user can submit some text and will display the text on the page. There was no problem intergrating it with the style but a little problem to get it to insert the text into the database or view the text on the page. here is the code, could someone please tell me whats wrong with it. Code:
<?php // ######################## SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // ##################### DEFINE IMPORTANT CONSTANTS ####################### // change the line below to the actual filename without ".php" extention. // the reason for using actual filename without extention as a value of this constant is to ensure uniqueness of the value throughout every PHP file of any given vBulletin installation. define('THIS_SCRIPT', 'chat'); // #################### 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( // change the lines below to the list of actual templates used in the script 'mychat', ); // pre-cache templates used by specific actions $actiontemplates = array(); // ########################## REQUIRE BACK-END ############################ require_once('./global.php'); // #################### HARD CODE JAVASCRIPT PATHS ######################## $headinclude = str_replace('clientscript', $vbulletin->options['bburl'] . '/clientscript', $headinclude); // ######################################################################## // ######################### START MAIN SCRIPT ############################ // ######################################################################## $navbits = array(); // change the line below to contain whatever you want to show in the navbar (title of your custom page) $navbits[$parent] = 'Test Page'; $navbits = construct_navbits($navbits); eval('$navbar = "' . fetch_template('navbar') . '";'); // change the line below to contain the name of the actual main output template used in your script eval('print_output("' . fetch_template('mychat') . '");'); $message=$_POST['message']; $query="INSERT INTO " . TABLE_PREFIX . "mychat VALUES ('$message')"; mysql_query($query); or die(mysql_error()); $query2="SELECT * FROM " . TABLE_PREFIX . "mychat"; $result=mysql_query($query2); $num=mysql_numrows($result); echo "<b><center>Chat history</center></b><br><br>"; $i=0; while ($i < $num) { $message=mysql_result($result,$i,"message"); echo "<b>Message: $message</b><br />"; $i++; } ?> |
#2
|
|||
|
|||
It might help if you specify the exact problems you have with it.
|
#3
|
|||
|
|||
Quote:
bump |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|