Jump to content

[SOLVED] Having a bit of trouble with this,


jscix

Recommended Posts

Basically what this does is retrive the $_get variable 'list', then if it's empty assign it an array of 0, 10 as default, otherwise grab the values on either side of the - delimiter.

 

The problem is, when the default numbers are processed and I print the array I get:

Array ( [0] => 0 [1] => 10 )

 

This works and it prints out 0 and 10. However.. when I specify the numbers, using  "blah.php?list=0-10"

I get the exact same array:

 

Array ( [0] => 0 [1] => 10 )

 

However it is not printing out the numbers... It prints a null value... what is happening? anyone?

 


$limitres = ($_GET['list']);
if (!isset($limitres)) { $dirty2 = Array(0, 10); }
else {
$dirty  = strip_tags($limitres);
$dirty2 = explode("-", $dirty);
}

if (is_array($dirty2)) {
$numof = count($dirty2);
if ($numof != "2") { die("Invalid page limiter"); }
$pone = $dirty2[0];
$ptwo = $dirty2[1];
if (is_int($pone) && is_int($ptwo)) {
$clean1 = ($pone);
$clean2 = ($ptwo);
}
if ($clean1 > clean2) { die("Page limiter format must be lesser number-greater number."); }
} 

print $clean1 . "<br>";
print $clean2 . "<br>";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.