0

Hey,

I know this is a stupid way of doing it, hence the question..:

How can i do this smarter:

if (($url == 'billeder') or ($url == 'billeder=1' or $url == 'billeder=2' or $url == 'billeder=3' or $url == 'billeder=4'))
{
include("includes/billeder.php");
}

I just want to see if the number behind the ? in the $_GET is an integer, and if it is then include the file.

'billeder="value"', could increase or decrease, and therefor it is the most lame solution i have found, since, the script i not dynamic, and changes to whatever the get value is.

But i think as long as i tjeck if it is an integer at the very end, it would be fine.

Hope someone can lead the way, as my logic is not helping me at the moment!

3
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by HITMANOF44th
0
// get last digit from url
$grablast = substr($url, -1);

// test url if it equals billeder or if last digit is 0 or greater then zero 
	if ($url == "billeder") {$check = "yes";} 
	if(is_numeric($grablast)){
	if ($grablast >= 0) {$check = "yes";}
	}

// if check is yes that the variable is billeder or a number include page
  if ($check == "yes")
  {
   include("includes/billeder.php");
   }

Edited by HITMANOF44th: n/a

0

haha one day struggling and figthing with crasy ajax requests, and the next day I cant find the value of a link :-)

Solved, thanks for helping pritaeas..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.