Multi Direct V1.00b By Deviancex

Started on the old forum in December 2006 · view the original in the archive · old links redirect here

13 replies · 1,603 views · started 19 years ago · 1 min read

6 participants
chatabox Senior · 361 posts #1

Here is a new script/idea i have for redirection. I have been using it for some of my sites. I used and updated a short line of code i found in the index.php of one of the old cult scripts External image (may be gone)

Multi Direct - by devianceX

This is a multi redirection script that will detect if a browser can accept html, wml, or both. The theory behind this is simple: if the browser accepts only html it is more than likely to be a web browser, if the browser accepts only wml it must be a wap 1.0 device, if it accepts html and wml it is more than likely a wap 2.0 device/pda/symbian/smartphone, and if its none of the above.. Mmm maybe its a bot script or a hacking attempt?

Install

This script is super simple to install, simply change the variables in index.php and upload to your portal site. If you are already using index.php you could rename the file and just use the PHP INCLUDE command to include it in your index.php or simply copy the code to your existing index.php above the header

To Do

Still need to work out how to determine a symbian device from a wap 2.0 device that don't support symbian apps, if you know how to do this please mail admin@hack.s-60.org or visit me at http://wapforum.uk.to and send a private message to devianceX

© 2001-2006 devianceX

DOWNLOAD MULTI DIRECT BY DEViANCE HERE: http://wapforum.uk.to/files/multi_direct_v1.00b_devX_258.zip

chatabox Senior · 361 posts #3

Mom strange.. To be honest i never tried it, the file is on my site at that location. Maybe my download script protects from hotlinking. I would upload but the cookie settings on this board stop me from staying logged in with opera mobile on my 6630. If someone can grab it from my site an upload it that would be helpfull.

COPYING.txt

	    GNU GENERAL PUBLIC LICENSE
	       Version 2, June 1991

Copyright © 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

		    Preamble

The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.

Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

The precise terms and conditions for copying, distribution and modification follow.

	    GNU GENERAL PUBLIC LICENSE

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  1. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

  1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any
chatabox Senior · 361 posts #4

index.php

<?php
/** 
*
* @package Multi Direct
* @version 1.00 BETA 2006/12/02 12:30:00 devianceX
* @copyright (c) 2001-2006 devianceX 
* @license [url]http://opensource.org/licenses/gpl-license.php[/url] GNU Public License 
*
*/

/**
*/

//EDIT BELOW

//your web url
$WEB_URL = '[url]http://wapforum.uk.to/';[/url]

//your wap 1.0 url
$WAP_URL = '[url]http://wapforum.uk.to/wap/';[/url]

//url for wap 2.0 and similar html and wml compatible browsers
$BOTH_URL = '[url]http://wapforum.uk.to/archive/';[/url]

//a url to redirect strange or unrecognized browsers, its very unlikely this will be needed
$MMM_URL = '[url]http://wapforum.uk.to/';[/url]

//DO NOT EDIT BELOW THIS LINE UNLESS YOUR EXPERIENCED IN PHP

//if browser does NOT accept wml then html variable is true
if ((eregi ("text/vnd.wap.wml", $HTTP_ACCEPT)) != true)
        {
$HTML = 'TRUE';
        }

//lets see if wml is true also or if its a pure web browser
if ((eregi ("text/html", $HTTP_ACCEPT)) != true)
        {
$WML = 'TRUE';
        }

//if wml AND html are true  it must be wap 2.0 phone and we should direct to html lo-fi (or give a choice)
if ($HTML='TRUE' AND $WML='TRUE' AND $S60='FALSE')
{
//both wml and html set true
$BOTH = 'TRUE';
}

//if wml and html true
if ($BOTH='TRUE')
{
//redirect to both url
//exit
        header("Location: $BOTH_URL");
        exit;
}else
{

//if wml is true
if ($WML='TRUE')
{
//redirect to wap url
//exit
        header("Location: $WAP_URL");
        exit;
}else
{

//if web is true
if ($WEB='TRUE')
{
//redirect to web url
//exit
        header("Location: $WEB_URL");
        exit;
}else
{

//if for some strange reason its not any of the above let it carry on to the web site.. Or is it a bot? Pmpl 
//redirect to mmm
//exit
        header("Location: $MMM_URL");
        exit;
}}}

// END OF REDIRECTION - SCRIPT BY DEVIANCEX
// [url]HTTP://WAPFORUM.UK.TO[/url] - THE BEST WAPFORUM
////////////////////////////////
//(c) 2001-2006 devianceX
////////////////////////////////
?>

Mmm.. I was posting a topic.. Do you have to stick you nose in?

GumSlone Administrator Principal · 1,690 posts #5

Mom strange.. To be honest i never tried it, the file is on my site at that location. Maybe my download script protects from hotlinking. I would upload but the cookie settings on this board stop me from staying logged in with opera mobile on my 6630. If someone can grab it from my site an upload it that would be helpfull.

COPYING.txt

      GNU GENERAL PUBLIC LICENSE
         Version 2, June 1991

Why do you put a gnu license to such a simple code?

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

chatabox Senior · 361 posts #7

Mmm ok dj (coming from someone that can't write anything and just uses scripts he stole from blaze, me, and others). GumSlone: because i put it to some script sites and they were asking for license details, also i plan to add more functions to it. Also it makes it look more professional.

cause hes a noob GumSlone, you should know that by now External image (may be gone)

giggles n00b = newbie dj.dance = mcommunity owner who begged to be admin on a mobiilchat site and devoted months to bugging me. Who is the n00b? Pmpl QUOTE=dj.dance "If you don't link to my mcommunity site and make me admin i will bug you forever" ha ha.. Now stop being silly an grow up. I been around wap alot longer than you and many people here.

hardstyle Developer · 154 posts #8

eh wtf? that was ages ago??? also that was in my first 2 months of site building? how da hell can you take that for granted? get a life..

8th wonder of the world

chatabox Senior · 361 posts #9

eh wtf? that was ages ago??? also that was in my first 2 months of site building? how da hell can you take that for granted? get a life..

ages ago or not your clearly as childish now as you were then. Think its you little teenage losers that need a life, i got a great life thanks 😉

crazybrumi Super moderator Principal · 1,064 posts #10
<?php
//Description
//Do not remove the below code. This will lead to violation of Terms Of Use
/****************************************************************************
This script is written by Anurag Singh
Title: Wap Redirect
Version: 1.0
Email: [email]tom.anu007@gmail.com[/email],
Homepage: [url]http://tom.anu007.googlepages.com/wapredirect[/url]
Special thanks to Harald Hope, Website: [url]http://techpatterns.com/[/url]
And also to Joseph George Jacobs , Email [email]joe@spitzbucket.com[/email]
****************************************************************************/
//Configuration
global $userBrowser;

// Your wapsite
//enter the link you want user to be redirected in case of WML browser
$wmllink = "http://bcfc.me.uk/index2.php/";

// Your website
//enter the link you want user to be redirected in case of PC browser
$htmllink = "http://www.wapsilon.com/bcfc.me.uk/index.php";

//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 Mozilla
if(stristr($userBrowser, 'Mozilla')) 
{
  $ub="PC";
}
//Check for Mozilla
elseif(stristr($userBrowser, 'gecko')) 
{
  $ub="PC";
}
//Check for opera

//Check for omniweb
elseif(stristr($userBrowser, 'omniweb')) 
{
  $ub="PC";
}
//Check for msie
elseif(stristr($userBrowser, 'msie')) 
{
  $ub="PC";
}
//Check for konqueror
elseif(stristr($userBrowser, 'konqueror')) 
{
  $ub="PC";
}
//Check for safari
elseif(stristr($userBrowser, 'safari')) 
{
  $ub="PC";
}
//Check for netpositive
elseif(stristr($userBrowser, 'netpositive')) 
{
  $ub="PC";
}
//Check for lynx
elseif(stristr($userBrowser, 'lynx')) 
{
  $ub="PC";
}
//Check for elinks
elseif(stristr($userBrowser, 'elinks')) 
{
  $ub="PC";
}
//Check for Mozilla
elseif(stristr($userBrowser, 'Mozilla')) 
{
  $ub="PC";
}
//Check for links
elseif(stristr($userBrowser, 'links')) 
{
  $ub="PC";
}
//Check for w3m
elseif(stristr($userBrowser, 'w3m')) 
{
  $ub="PC";
}
//Check for webtv
elseif(stristr($userBrowser, 'webtv')) 
{
  $ub="PC";
}
//Check for amaya
elseif(stristr($userBrowser, 'amaya')) 
{
  $ub="PC";
}
//Check for dillo
elseif(stristr($userBrowser, 'dillo')) 
{
  $ub="PC";
}
//Check for ibrowse
elseif(stristr($userBrowser, 'ibrowse')) 
{
  $ub="PC";
}
//Check for icab
elseif(stristr($userBrowser, 'icab')) 
{
  $ub="PC";
}
//Check for crazy browser
elseif(stristr($userBrowser, 'crazy browser')) 
{
  $ub="PC";
}
//Check for IE
elseif(stristr($userBrowser, 'internet explorer')) 
{
  $ub="PC";
}
//If it's not any of the above browsers
//Then it gotta be a WML or very unpopular browser
else
{
  $ub="WML";
  }
//Code for redirecting based upon the results
if($ub == "PC") {
    header("Location: ".$htmllink);
    exit;
    }
    else 
    {
    header("Location: ".$wmllink);
    exit;
    }
    
?>

Want something coded email me at sales@webnwaphost.com for a prices.

http://flagcounter.com/more/W80q

blackhowk Senior · 411 posts #11

its a good idea but not excelent. some phones like motorola L2 or nk 3220 have strage behavior with header location. those phone have option to redirect , and end user chose yes or no in this situation. the end user dont know what is http redirect or what means redirect, its a noob so, in that case when the phone is recognized like wml or xhtml compliant create 2 cases (1 for each wml and xhtml mode) and redirect with meta. look here one simple example.

  1. if ((eregi ("htm", $_SERVER['HTTP_ACCEPT'])) == true){ ?>
  2. <!DOCTYPE html
  3. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  4. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5. <html>
  6. <head>
  7. <meta http-equiv="content-type" content="text/html;charset=utf-8" />
  8. <meta http-equiv="refresh" content="1;url=xhtml.php" />
  9. <title>ngeo chat</title>
  10. <link rel="stylesheet" type="text/css" href="style_logo/style.css" />
  11. </head>
  12. <body>
  13. Please wait... Click below if yo do not wish to wait, or your Mobile Phone don 't make the transfer
  14. enter
  15. </body>
  16. </html>
  17. <?php
  18. exit();
  19. }
  20. else
  21. {
  22. header("Content-type: text/vnd.wap.wml");
  23. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  24. header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  25. header("Cache-Control: no-cache, must-revalidate");
  26. header("Pragma: no-cache");
  27. header("Provided-by:ngeo@ngeo.ro");
  28. echo "<?xml version=\"1.0\"?>
  29. <!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
  30. ." "http://www.wapforum.org/DTD/wml_1.1.xml">\n";
  31. ?>
  32. <wml>
  33. <card id="ngeo" title="ngeo chat" ontimer="wml.php">
  34. <timer value="1"/>
  35. Please wait... Click below if yo do not wish to wait, or your Mobile Phone don 't make the transfer
  36. enter
  37. </card>
  38. </wml>
  39. <?php
  40. exit();
  41. } the meta redirect alow redirection and user dont choose in every redirect if is agree or not. its a best way to redirect.
    (this is just an example)
wizard Senior · 493 posts #12
class Browser {

    public $Browser;

    public function check()
    {
        $this->o = $_GET["o"];

        if($this->o == "wml")
        {
            $this->Browser = 'wml';

        }else if($this->o == "xhtml")
        {
            $this->Browser = 'xhtml';

        }else if($this->o == "html")
        {
            $this->Browser = 'html';

        }else{
            $mobile_Browser = '0';   
  
            if(preg_match('/(up.Browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i',strtolower($_SERVER['HTTP_USER_AGENT'])))
            {   
                    $mobile_Browser++;   
                }   
  
            if((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'text/vnd.wap.wml')>0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE']))))
            {   
                    $mobile_Browser++;   
                }   
  
            $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'],0,4));   
  
            $mobile_agents = array(   
                    'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',   
                    'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',   
                    'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',   
                    'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',   
                    'newt','noki','oper','palm','pana','pant','phil','play','port','prox',   
                    'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',   
                    'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',   
                    'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',   
                    'wapr','webc','winw','winw','xda','xda-');   
  
                if(in_array($mobile_ua,$mobile_agents))
                {   
                    $mobile_Browser++;   
                }   
  
                if (strpos(strtolower($_SERVER['ALL_HTTP']),'OperaMini')>0)
                {   
                    $mobile_Browser++;   
                }   
  
                if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'windows')>0)
                {   
                    $mobile_Browser = 0;   
                }   
  
                  if($mobile_Browser>0)
                {   
                      if(!stristr($_SERVER['HTTP_ACCEPT'],'application/vnd.wap.xhtml+xml'))
                    {
                        // old wml broser
                        $this->Browser = 'wml'; 
                    } else {
                        // new xhtml mobile
                        $this->Browser = 'xhtml'; 
                    }
  
                   } else {   
                      // web Browser
                    $this->Browser = 'html';  
  
                   }
        }
        return $this->Browser;
    }
}

dis is pretty good, i use bits from another detection script to my ideas to make it

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close