PHP redirect

Advert test
#1
Hi, I am adding a HTML/CSS version to a flash website. I didn't design the website - www.shaneblack.ie

I want to change the following PHP code so that if the browser is an iPod or iPad that it will go to my CSS/HTML version of the website - http://www.shaneblack.ie/indeHTML.html

Here's the code. Does anyone know how to change this to do what is needed, please.

<?php


// Include application details

include("_classes/Application.php");



//define("CONFIG_WEBCRAWLER_TEST", 1);



_import("local.WebCrawler");



// Create crawler object

$crawler = new WebCrawler("homepage");



// If crawler, get contents to display

if($crawler->isCrawler) {

$crawler->setXmlPage("content_get.php?id=homepage");



$crawler->addField("Title", "/", "title");

$crawler->addField("Content", "/", "", "html");

}

else {

/*

Only show enter page if flash isn't installed

// Set cookie to skip intro (keep cookie for 2 weeks)

_import("Cookies");

// Set cookie each time

Cookies::set("skip_enter_page", 1, 14);

*/

}



// Display flash or crawler html (requiredFlashVersion)

$crawler->display(8);

?>​
 
#2
Well, that's really not enough... what is include("_classes/Application.php"); ? You don't need to paste the content here if it's some open source class that can be downloaded from the web, but we need more details to be able to help you out.

The only way to redirect the page for mobiles using only PHP is if that flash sets a cookie when it starts. Thus, the iPod or iPad won't set the cookie as they can't run flash, at least that's what I can make out of your code. Yes, there are other PHP only options, but still, I would reconsider using this one.

If you want to stick to PHP, I'm guessing $_SERVER['HTTP_USER_AGENT'] should be enough to check if you're dealing with a mobile or not. Look into that. Unfortunatelly I don't own an iPad or iPod myself so can't help you out here.

P.S: Can an iPod open websites? What about the iPhone?
 
Top