Jump to content


Photo

Php Page Checking.


  • Please log in to reply
5 replies to this topic

#1 scheols

scheols
  • Members
  • PipPipPip
  • Advanced Member
  • 113 posts

Posted 22 June 2006 - 08:42 PM

Alright im editing a IPB forum page <ok

Anyways how would i check to see if im on a page using the if statement.
or how could i check for the file on the IPB index.php page?:heres the index.php part i want to check

//--------------------------------
// Wrap it all up in a nice easy to
// transport super class
//--------------------------------

[b]$ibforums = new info();[/b]

//--------------------------------
// Require our global functions
//--------------------------------

require ROOT_PATH."sources/functions.php";
require ROOT_PATH."sources/classes/class_display.php";
require ROOT_PATH."sources/classes/class_session.php";
require ROOT_PATH."sources/classes/class_forums.php";
require KERNEL_PATH."class_converge.php";

$std    = new FUNC;
$print  = new display();
$sess   = new session();
$forums = new forum_functions();

//--------------------------------
//  Set up our vars
//--------------------------------

$ibforums->input = $std->parse_incoming();

//--------------------------------
//  Set converge
//--------------------------------

Answer either of the questions plz or both thanks. Ive put the bold tags around the Part i want to check for
Dont Piss me Off today

#2 Eric_Ryk

Eric_Ryk
  • Members
  • PipPipPip
  • Advanced Member
  • 104 posts

Posted 22 June 2006 - 08:51 PM

if($_GET['page'] == "foobar")
{
   // your code
}

Just a simple example to show you. Or perhaps if you want a page where there are no URL variables:
if(count($_GET) == 0)


#3 scheols

scheols
  • Members
  • PipPipPip
  • Advanced Member
  • 113 posts

Posted 22 June 2006 - 08:54 PM

[!--quoteo(post=386976:date=Jun 22 2006, 03:51 PM:name=Eric_Ryk)--][div class=\'quotetop\']QUOTE(Eric_Ryk @ Jun 22 2006, 03:51 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
if($_GET['page'] == "foobar")
{
   // your code
}

Just a simple example to show you. Or perhaps if you want a page where there are no URL variables:
if(count($_GET) == 0)
[/quote]
would this get the page that the code is in? like say i upload a file called thispage.php

woould the $_GET["page"] get thispage.php or would i have to tell the code what page im on?
Dont Piss me Off today

#4 Eric_Ryk

Eric_Ryk
  • Members
  • PipPipPip
  • Advanced Member
  • 104 posts

Posted 22 June 2006 - 09:13 PM

Certain pages are loaded based upon what is put inside of the URL. $_GET["page"] may or may not contain a value in this case, I was just giving an example.

What you need to do is find out what all is in the URL when you are on the page you want, then do checks based upon those.

#5 scheols

scheols
  • Members
  • PipPipPip
  • Advanced Member
  • 113 posts

Posted 22 June 2006 - 09:18 PM

if(count($_GET) == 0){

alright what does that do can u plz tell me
Dont Piss me Off today

#6 Eric_Ryk

Eric_Ryk
  • Members
  • PipPipPip
  • Advanced Member
  • 104 posts

Posted 22 June 2006 - 09:22 PM

[!--quoteo(post=386985:date=Jun 22 2006, 05:18 PM:name=scheols)--][div class=\'quotetop\']QUOTE(scheols @ Jun 22 2006, 05:18 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
if(count($_GET) == 0){

alright what does that do can u plz tell me
[/quote]
If there are no variables in the URL then that express will come out to be true.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users