<?php
require_once 'includes/connect.php'; 
$result = mysql_query("SELECT * FROM lang WHERE active=1 AND main=1",$dbh);
$myrow=mysql_fetch_array($result); 
$lang=$myrow['id'];
$dir = mysql_real_escape_string(($_REQUEST['dir']));
if ($dir=='') { 
$dir="";
}else{
$result = mysql_query("SELECT * FROM lang WHERE dir='$dir'",$dbh);
$myrow=mysql_fetch_array($result); 
$lang=$myrow['id'];
$language=$myrow['language'];
$dir=$myrow['dir'];
}
?>
<?php
$sql = "SELECT * FROM langtexts WHERE lang_id='$lang' ORDER BY id";
$result = mysql_query($sql);
while ($myrow=mysql_fetch_array($result)) {
$fname=$myrow['name'];
$ftext=$myrow['text'];
			
$fresult=$$fname="$ftext";
}?>
<?php 
$result = mysql_query("SELECT * FROM colorcombi",$dbh);
$myrow=mysql_fetch_array($result); 
$color1=$myrow['color1'];
$color2=$myrow['color2'];
$color3=$myrow['color3'];
$color4=$myrow['color4'];
$color5=$myrow['color5'];

$result1 = mysql_query("SELECT * FROM siteinfo",$dbh);
$myrow=mysql_fetch_array($result1); 
$domain=$myrow['domain'];
$firma=$myrow['firma'];
$company=$myrow['company'];
$company_en=$myrow['company_en'];
$address=$myrow['address'];
$address_en=$myrow['address_en'];
$field=$myrow['field'];
$field_en=$myrow['field_en'];
$region=$myrow['region'];
$region_en=$myrow['region_en'];
$sitemail=$myrow['sitemail'];
$x=$myrow['x'];
$y=$myrow['y'];
$map=$myrow['map'];
$holiday_id=$myrow['holiday_id'];
$hotel_id=$myrow['hotel_id'];
$resurl=$myrow['resurl'];
$site=$myrow['site'];
$code=$myrow['code'];
$sitescript=$myrow['sitescript'];
$sitescript2=$myrow['sitescript2'];
$sitescript3=$myrow['sitescript3'];
$mobile=$myrow['mobile'];
$sitepath=$myrow['sitepath'];
			
if ($lang==1) { 
$company1=$company;
$address1=$address;
$field1=$field;
$region1=$region;
}else{
$company1=$company_en;
$address1=$address_en;
$field1=$field_en;
$region1=$region_en;	
}
			
$result3 = mysql_query("SELECT * FROM menu",$dbh);
$myrow=mysql_fetch_array($result3);
$guestbook1=$myrow['guestbook'];
?>
<?php $pages = basename (htmlentities($_SERVER['SCRIPT_NAME'], ENT_QUOTES)); ?>
<?php $pageurl = basename (htmlentities($_SERVER['REQUEST_URI'], ENT_QUOTES)); ?>
<?php $pagevars = (htmlentities($_SERVER['QUERY_STRING'], ENT_QUOTES)); ?>
<?php if ($pagevars!='') { $vars = "$pagevars"; }?>
<?php
$ismobile = 0;
$mobcontainer = htmlentities($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES);
$useragents = array ( 

'iPhone' ,
'iPod' ,
'Blackberry' ,
'Android' ,
'Palm',
'Windows\s+ce' ,

); 

foreach ( $useragents as $useragents ) { 
if(strstr($mobcontainer,$useragents)) {
$ismobile = 1;
} 
}
?>
<?php if ($ismobile==1 AND $mobile==1) { ?>
<meta http-equiv="refresh" content="0;URL=http://m.<?php echo $domain ?>">
<?php } ?>