Hartley Posted January 14, 2007 Share Posted January 14, 2007 [code]<?phpif (!$p || $p == "" || $p == "latest") { $p = "latest";}?>[/code]Very simple: if someone goes to the site without declaring a page variable, it will automatically bring them to the "Latest News" page (I use $p with includes). It's worked like a charm for a while, until now:I'm working on integrating vBulletin and my site, and I have come across a problem: it's declaring EVERYTHING as latest. I tried adding an else statement to say $p = $p, but it's proven useless. Is there a function that may disable this? I can't post any additional code due to legality reasons (and the fact that it's so many lines).http://www.sedition-gaming.com/test/index.phpI realize this is vague, but I hope there's an off chance someone may have had this issue before. Link to comment https://forums.phpfreaks.com/topic/34176-variable-overstepping-its-boundaries/ Share on other sites More sharing options...
trq Posted January 14, 2007 Share Posted January 14, 2007 [quote]it's declaring EVERYTHING as latest[/quote]No idea what that meens but, you should be using the $_GET array if this is meant to be comming through the url.[code]<?php if (!$_GET['p'] || $_GET['p'] == "" || $_GET['p'] == "latest") { $p = "latest";}[/code] Link to comment https://forums.phpfreaks.com/topic/34176-variable-overstepping-its-boundaries/#findComment-160791 Share on other sites More sharing options...
Hartley Posted January 14, 2007 Author Share Posted January 14, 2007 Fixed that (thanks), but still getting the same error.If I put the code at the very top of a page, it will declare $p as "latest" for EVERYTHING... except if $p=latest (the opposite of what it should do, except for the $p="".I wish I could just put PHP code inside a vBulletin template and use that :( Link to comment https://forums.phpfreaks.com/topic/34176-variable-overstepping-its-boundaries/#findComment-160795 Share on other sites More sharing options...
btherl Posted January 15, 2007 Share Posted January 15, 2007 If $p is "latest", what does it declare $p as?You can simplify it to[code=php:0]if (empty($_GET['p])) { $p = 'latest';} else { $p = $_GET['p'];}[/code]Logically that code will produce the same output, but it's a little neater :) It'll also set $p from $_GET['p'] in all cases. Link to comment https://forums.phpfreaks.com/topic/34176-variable-overstepping-its-boundaries/#findComment-160891 Share on other sites More sharing options...
Hartley Posted January 15, 2007 Author Share Posted January 15, 2007 Oh goodness...So I spent 3 hours taking apart the vBulletin code and successfully extracted what I needed without needing the templates and it still didn't work.Then I looked at my syntax, and my include function had a messed up quotation....Solved =o Link to comment https://forums.phpfreaks.com/topic/34176-variable-overstepping-its-boundaries/#findComment-160969 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.