<?php
$url1 = explode('?',$_SERVER['REQUEST_URI']);
$url = basename($_SERVER['PHP_SELF']).'?'.@$url1[1];
$url = htmlspecialchars($url);
$mod = intval(@$_GET['mod']);
if(intval(@$_GET['mod']) != '1' and intval(@$_GET['mod']) != '2')
{
$ua = htmlspecialchars(addslashes(trim(getenv('HTTP_USER_AGENT'))));
if (((strpos ($ua,'M3Gate') !== false) || (strpos ($ua,'Opera') !== false) || (strpos ($ua,'emulator') !== false) || (strpos ($ua,'WinWAP') !== false) || (strpos ($ua,'Wapsilon') !== false) || (strpos ($ua,'Mozilla') !== false) || (strpos ($ua,'M3GATE') !== false))) $mod = '2'; else $mod = '1';
}

if(@$mod == '1')
{
header("Content-type: text/vnd.wap.wml; charset=utf-8");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-relative");   
if(!@$url1[1])
$url = $url.'mod=2';
else
{
if(!strstr($url, 'mod=1'))
$url = $url.'&amp;mod=2';
else
$url = str_replace('mod=1','mod=2', $url);
}
$header = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd"><wml><head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head><card id="index" title="'.$title.'">';
//-----------
$class_d0 = '';
$class_d1 = '';
$class_d2 = '';
$class_d3 = '';
$class_d4 = '';
$class_div = '';
$class_divz = '';
$class_version = 'WML | <a href="'.$url.'">HTML</a><br/>';
$class_endpage = '</p></card></wml>';
}
else
{
header("Content-type: text/html; charset=utf-8");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-relative");
if(!@$url1[1])
$url = $url.'mod=1';
else
{
if(!strstr($url, 'mod=2'))
$url = $url.'&amp;mod=1';
else
$url = str_replace('mod=2','mod=1', $url);
}
//-----------
echo "<title>{$title}</title>";
echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"../01.css\"></head><body><div class=\"../logo\"></div><div>";


$header = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>'.$title.'</title><link rel="stylesheet" href="http://'.$_SERVER['HTTP_HOST'].'../01.css" type="text/css" /></head><body>';
//-----------
$class_d0 = '<div class="title">';
$class_d1 = '<div class="b">';
$class_d2 = '<div class=t>';
$class_d3 = '<div class="title">';
$class_d4 = '<div class="bottom">';
$class_div = '<div>';
$class_divz = '</div>';
$class_version = 'HTML | <a href="'.$url.'">WML</a><br/>';
$class_endpage = '</div></body></html>';
}
?>