The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
I need some help with these files.
I have a banner rotation system that I am using with vB version 2.xx and I want to port it over to 3.5
How would I write the following to work with 3.5? Code:
<?php error_reporting(7); require('./global.php'); $timenow = time(); $boarduser = $bbuserinfo['userid']; if(isset($bannerid)) { $banner = $DB_site->query_first("SELECT * FROM banner WHERE id='$bannerid'"); $url = $banner['redirector_url']; if (!empty($boarduser)) { $DB_site->query("UPDATE banner SET userclicks=userclicks+1 WHERE id='$bannerid'"); // is there a user in the table who still has clicked? $clickeduser = $DB_site->query_first("SELECT * FROM userclicks WHERE userid='$boarduser' AND bannerid='$bannerid'"); $clickeduser = $clickeduser['userid']; if(!empty($clickeduser)) $DB_site->query("UPDATE userclicks SET clicks=clicks+1 WHERE userid='$boarduser' AND bannerid='$bannerid'"); else $DB_site->query("INSERT INTO userclicks (userid, bannerid, clicks) VALUES ('$boarduser', '$bannerid', '1')"); } else $DB_site->query("UPDATE banner SET guestclicks=guestclicks+1 WHERE id='$bannerid'"); header("Location:$url"); } else echo ("Please Include an ID!"); ?> Code:
<?php $noheader=1; //require("./global.php"); set_magic_quotes_runtime(0); @error_reporting(7); // ###################### Start init ####################### unset($dbservertype); //load config require('./admin/config.php'); // init db ********************** // load db class $dbservertype = strtolower($dbservertype); $dbclassname="./admin/db_$dbservertype.php"; require($dbclassname); $DB_site=new DB_Sql_vb; $DB_site->appname='vBulletin'; $DB_site->appshortname='vBulletin (forum)'; $DB_site->database=$dbname; $DB_site->server=$servername; $DB_site->user=$dbusername; $DB_site->password=$dbpassword; $DB_site->connect(); $dbpassword=""; $DB_site->password=""; // end init db if(isset($bannerid)) { $banner = $DB_site->query_first("SELECT * FROM banner WHERE id='$bannerid'"); $url = $banner['url_to_banner']; $update = $DB_site->query("UPDATE banner SET views=views+1 WHERE id='$bannerid'"); header("Location:$url"); } else echo ("Please Include an ID!"); ?> Parker |
#2
|
||||
|
||||
Change $bbuserinfo to $vbulletin->userinfo and $DB_site to $vbulletin->db and you should be most of the way there.
|
#3
|
|||
|
|||
For the first file does this look ok?
Code:
<?php // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('THIS_SCRIPT', 'click'); // ######################### REQUIRE BACK-END ############################ require('./global.php'); $timenow = time(); $boarduser = $vbulletin->userinfo['userid']; if(isset($bannerid)) { $banner = $vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX . "banner WHERE id='$bannerid'"); $url = $banner['redirector_url']; if (!empty($boarduser)) { $vbulletin->db->query("UPDATE banner SET " . TABLE_PREFIX . "userclicks=userclicks+1 WHERE id='$bannerid'"); // is there a user in the table who still has clicked? $clickeduser = $vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX . "userclicks WHERE userid='$boarduser' AND bannerid='$bannerid'"); $clickeduser = $clickeduser['userid']; if(!empty($clickeduser)) $vbulletin->db->query_first("UPDATE " . TABLE_PREFIX . "userclicks SET clicks=clicks+1 WHERE userid='$boarduser' AND bannerid='$bannerid'"); else $vbulletin->db->query_first("INSERT INTO " . TABLE_PREFIX . "userclicks (userid, bannerid, clicks) VALUES ('$boarduser', '$bannerid', '1')"); } else $vbulletin->db->query_first("UPDATE banner SET " . TABLE_PREFIX . "guestclicks=guestclicks+1 WHERE id='$bannerid'"); header("Location:$url"); } else echo ("Please Include an ID!"); ?> Code:
<?php // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('THIS_SCRIPT', 'view'); // ###################### Start init ####################### require("../includes/config.php"); $servername=$config['MasterServer']['servername']; $dbusername=$config['MasterServer']['username']; $dbpassword=$config['MasterServer']['password']; $dbname=$config['Database']['dbname']; $db=mysql_connect($servername,$dbusername,$dbpassword) or die("Can't open connection to MySQL"); mysql_select_db($dbname) or die("Can't select database"); if(isset($bannerid)) { $banner = $vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX . "banner WHERE id='$bannerid'"); $url = $banner['url_to_banner']; $update = $vbulletin->db->query_first("UPDATE " . TABLE_PREFIX . "banner SET views=views+1 WHERE id='$bannerid'"); header("Location:$url"); } else echo ("Please Include an ID!"); ?> |
#4
|
|||
|
|||
I am having a problem with $bannerid from a link
For example http://www.mysite.com/click.php?bannerid=50 The click and view files do not see the number 50 and so therefore return the "Please include ID". Any ideas on what could be happening here? Thanks, Parker |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|