Log in

View Full Version : Trouble with a variable


MetalAges
10-23-2005, 08:13 PM
I have this code, which isn't grabbing the variable from the URL string, but if I hard code a forum id it works. Code:


<?php
error_reporting(7);

$templatesused='latest_hostedthreadbits,latest_hos tedthreads';


require('./global.php');

$latest = $db->query_read("SELECT * FROM thread WHERE forumid='$fid' ORDER BY lastpost DESC LIMIT 10");


while ($recent = $db->fetch_array($latest)) {

$title = $recent['title'];
$id = $recent['threadid'];
eval("\$latest_threads .= \"".fetch_template("latest_hostedthreadbits")."\";");
}




eval("print_output(\"".fetch_template('latest_hostedthreads')."\");");

?>

Include in my PHP page:

<?php include('http://www.ultimatemetal.com/forum/hosted10.php?s=&fid=143&size=1&face=verdana&vlink=666699&link=336699&alink=000000&body=&text=000000'); ?>


As I said, everything works if I substitute forumid='$fid' with forumid='143' etc.

Am I doing something wrong or has something change in 3.5.0 that makes it to where I can no longer grab that variable in that format?

EDIT: This script grabs the top ten latest threads in any given forum and allows bands (in my case) to display this on their sites. Everything worked pre-3.5.0 upgrade.

Marco van Herwaarden
10-25-2005, 11:55 AM
You will need to make those variables available first. Add the following after global.php:
$vbulletin->input->clean_array_gpc('r', array(
'fid' => TYPE_UINT,
));
$fid = $vbulletin->GPC['fid'];
The same for other variables you need.

MetalAges
11-01-2005, 06:05 PM
Thank you sir! Works now :)

Marco van Herwaarden
11-01-2005, 08:17 PM
Glad to help you.