samoht Posted February 3, 2010 Share Posted February 3, 2010 Hello all, I need help with a session var. <?php session_start(); //check for searchengine bots and send them to the default USA page $agent = strtolower($_SERVER['HTTP_USER_AGENT']); $bots = array ('googlebot','msn','slurp','scooter','scrubby'); foreach ($bots as $bot) { if(strstr($agent, "$bot")) { $_SESSION['country'] = "USA Website"; header( "HTTP/1.1 301 Moved Permanently" ); header ('Location: http://www.mysite.com'); } } //check if the location is set - if so redirect if(isset($_POST['location']) && !isset($_SESSION['country'])){ $_SESSION['country'] = $_POST['location']; header( "HTTP/1.1 301 Moved Permanently" ); header ('Location: http://www.mysite.com'); } //session var is set so view the whole page if(isset($_SESSION['country'])){ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>" > <head> ... <?php //session not set so view the form to select location }else{ ?> <html> <head> <meta http-equiv="Content-Language" content="en-us" /> <title>mysite Spine Choose Your Site</title> </head> ... <?php } ?> for some reason this produces a "Forbidden Access" (Flooding) error? How can I send the bots safely to the site without this issue?? Thanks for any help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.