Jump to content
xisto Community
Sign in to follow this  
wappy

Wap Redirection Usefull code that all wap site owners should use

Recommended Posts

Use this code to redirect pc users from your wap site to web site:
include above page header this code:

<?php$mywebsite = "forum/index.php";$browser = explode ('/', $HTTP_USER_AGENT);if($browser[0]=="IE"){header ('Location: $mywebsite');}?>

Share this post


Link to post
Share on other sites

Well dj they will have a bit of a problem if using IE as it don't read wap pages which is why i use the code above to redirect them to my WEB site so i DON'T lose traffic...----btw can anyone tell me the id's of other web browsers that don't support wap browsing..?? Like Internet Explorer's id is simply IE. Would be helpfull if someone could list them for me as i don't often work from pc and am ant familiar with the browsers ;-)

Share this post


Link to post
Share on other sites

Wapp I think there are only two types of WEB browsers. There are many different types of WEB browsers but they all identify themselves as someone else. IE says its mozilla and so on but here is a redirection script which I use

<?php//Description//Do not remove the below code. This will lead to violation of Terms Of Use/****************************************************************************This script is written by Anurag SinghTitle: Wap RedirectVersion: 1.0Email: tom.anu007@gmail.com,Homepage: [url=http://tom.anu007.googlepages.com/wapredirect]http://tom.anu007.googlepages.com/wapredirect[/url]Special thanks to Harald Hope, Website: [url=http://techpatterns.com/]http://techpatterns.com/[/url]And also to Joseph George Jacobs , Email joe@spitzbucket.com****************************************************************************///Configurationglobal $userBrowser;// Your wapsite//enter the link you want user to be redirected in case of WML browser$wmllink = "http://wap.yahoo.com/";// Your website//enter the link you want user to be redirected in case of PC browser$htmllink = "http://google.com;;//There is no need to edit any information from this point on//however in case if you want to contribute please do so//please be sure to let me know about the changes//Detect the browser$userBrowser = $_SERVER['HTTP_USER_AGENT']; //Remove the below // qutoes.//It helps to check if there is any error when editing//If everything is all right it will display the browser information//please remember to put // back after testing or no redirection will occur//echo $userBrowser;//Check for Mozillaif(stristr($userBrowser, 'Mozilla')) {  $ub="PC";}//Check for Mozillaelseif(stristr($userBrowser, 'gecko')) {  $ub="PC";}//Check for operaelseif(stristr($userBrowser, 'opera')) {  $ub="PC";}//Check for omniwebelseif(stristr($userBrowser, 'omniweb')) {  $ub="PC";}//Check for msieelseif(stristr($userBrowser, 'msie')) {  $ub="PC";}//Check for konquerorelseif(stristr($userBrowser, 'konqueror')) {  $ub="PC";}//Check for safarielseif(stristr($userBrowser, 'safari')) {  $ub="PC";}//Check for netpositiveelseif(stristr($userBrowser, 'netpositive')) {  $ub="PC";}//Check for lynxelseif(stristr($userBrowser, 'lynx')) {  $ub="PC";}//Check for elinkselseif(stristr($userBrowser, 'elinks')) {  $ub="PC";}//Check for Mozillaelseif(stristr($userBrowser, 'Mozilla')) {  $ub="PC";}//Check for linkselseif(stristr($userBrowser, 'links')) {  $ub="PC";}//Check for w3melseif(stristr($userBrowser, 'w3m')) {  $ub="PC";}//Check for webtvelseif(stristr($userBrowser, 'webtv')) {  $ub="PC";}//Check for amayaelseif(stristr($userBrowser, 'amaya')) {  $ub="PC";}//Check for dilloelseif(stristr($userBrowser, 'dillo')) {  $ub="PC";}//Check for ibrowseelseif(stristr($userBrowser, 'ibrowse')) {  $ub="PC";}//Check for icabelseif(stristr($userBrowser, 'icab')) {  $ub="PC";}//Check for crazy browserelseif(stristr($userBrowser, 'crazy browser')) {  $ub="PC";}//Check for IEelseif(stristr($userBrowser, 'internet explorer')) {  $ub="PC";}//If it's not any of the above browsers//Then it gotta be a WML or very unpopular browserelse{  $ub="WML";  }//Code for redirecting based upon the resultsif($ub == "PC") {	header("Location: ".$htmllink);	exit;	}	else 	{	header("Location: ".$wmllink);	exit;	}?>
Please respect the author of this script and do not pass it on as your own work.

Share this post


Link to post
Share on other sites

i like that alot :-) but there is a few problems i see with it.. For instants alot of my wap users do use opera etc and i don't want them to be redirected. I have added a few more browsers to my script which i will post another time but your code is alot better, i will maybe update it to suit my needs and post the updated copy here. <_<

Share this post


Link to post
Share on other sites

yes same as that it can be very annoying which is why i still let the common phone based web browsers like opera etc still access the wap site. I have deleted my web forum waiting on the release of phpbb v3 but when i do put it back up my site will direct pc's to there but all phones and phone based web browsers will still access the wap (main) site. And if people using these browser do wish to visit the web forum i will be placing a link to it on the index and login pages. I think i will use a modified version of the code posted above as i think i can make it work very well with a bit of alteration :-)

Share this post


Link to post
Share on other sites

I'm glad it came in useful. I can't remember where I actually stumbled upon this script but I'm glad I did <_< .

Share this post


Link to post
Share on other sites

ok maybe i will use your code now as i have just been told mine is not working properly? Im not on pc so can't test, can anyone tell me what is wrong with the below code? I want the commen web browsers to be directed to my web forum.

Here is the code:

<?php$mywebsite = "/forum";$browser = explode ('/', $HTTP_USER_AGENT);if($browser[0]=="IE" OR $browser[0]=="Go!Zilla" OR $browser[0]=="MSIE" OR $browser[0]=="Netscape" OR $browser[0]=="FireFox"){header ('Location: $mywebsite');}?>
thanks in advance for any help with this :-)

---

ok i have created a new redirection system/script. It will direct any pc users away from your wap index (with the exception of opera) to a url of your choice. I have also included a debugger page so in case of people not getting redirected you can point them to the debugger page and find out the browser id/info to update the script, but as far as i know it works a treat. I have also included some install instructions etc..

Edited by wappy (see edit history)

Share this post


Link to post
Share on other sites

I think it's to many OR commands, I would just try and use the original layout but then again I know very little about/of PHP.

Share this post


Link to post
Share on other sites

i don't understand what you mean? The new script i attached works very well (i think lol)... But i should update it with all the browser types in the script you posted. I will do that soon and post the new version here.

---

Ok i have updated the script with all the comment browser ids (added another 15). There should now be no web browsers getting through other than opera (i do this so the wap site can still be accessed by pc but only with opera as its the best pc wap browser and i also use it on my mobile).

You will find full installation instructions and a more complete description in the README.txt in the attachment below. Enjoy

:D

Edited by wappy (see edit history)

Share this post


Link to post
Share on other sites

WOW, it looks as though everyone is being tracked down :) Why do people have to fight online? If you want to settle something do it in person or phone the person for that matter.

Share this post


Link to post
Share on other sites

Posts digressing from this topic have been removed. To counter the off topic discussions, this topic is closed.Please PM a moderator if you would like to continue this discussion and *NOT* go off topic.Thank you.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.