Jump to content

problem in my class


miracle_potential

Recommended Posts

<?
class getURL {

function getURL(){//VERY simple function to get the catagory from the URL

$cat = $_GET['cat'];
$this->CatagoryCheck($cat);
}

function CatagoryCheck($cat){//checks the catagory specified in the url against an array of the catagories
$catagory_array = array("earings","necklaces","bracelets","anklets","hair accessories","alchemy gothic range","brooches");
if(!in_array($cat, $catagory_array)){
//if the catagory in the URL 
//is not in the array then 
//redirect to the error page
header("Location: http://" . $_SERVER['HTTP_HOST'] . "/errors/p/_1.html");
	}
else{
$this->query($cat);
	}
}

function query($cat){
echo "works ".$cat;
}
}
?>

 

I cant get it to relocate when someone edits the catagory in the URL

Basically the array is all of the catagories and I need to compare the $_GET with it and if someones edited it it needs to relocate to the error page but it doesnt it just comes up with no errors and no information or anything. Can anyone help me why it wont relocate.

Link to comment
https://forums.phpfreaks.com/topic/101773-problem-in-my-class/
Share on other sites

I just have links set in the page that refers to the one I want

 

<a href="products.php?cat=earings">earings</a>

 

Which goes through the code posted before hand and is then determined by the array results whether its a catagory in the array or not.

 

If not it relocates to the error page but it doesnt, it just comes up with a blank space.

Link to comment
https://forums.phpfreaks.com/topic/101773-problem-in-my-class/#findComment-521309
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.