miracle_potential Posted April 18, 2008 Share Posted April 18, 2008 <? 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 More sharing options...
miracle_potential Posted April 19, 2008 Author Share Posted April 19, 2008 bumppp Link to comment https://forums.phpfreaks.com/topic/101773-problem-in-my-class/#findComment-521104 Share on other sites More sharing options...
chigley Posted April 19, 2008 Share Posted April 19, 2008 Post the usage code? Link to comment https://forums.phpfreaks.com/topic/101773-problem-in-my-class/#findComment-521122 Share on other sites More sharing options...
miracle_potential Posted April 19, 2008 Author Share Posted April 19, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.