<?php
	$clanguage	= addslashes($_GET['language']);
	if(! empty($clanguage)){
		if(! is_numeric($clanguage) OR @mysql_num_rows(@mysql_query("SELECT `id` FROM `languages` WHERE `id`='".$clanguage."'")) == 0){
		}else{
			$query	= mysql_query("SELECT `id`,`language` FROM `languages` WHERE `id`='".$clanguage."'");
			$f_lang	= mysql_fetch_array($query);
			setcookie('language',$f_lang['id'],time()+86400,"/");
			$smarty->clear_compiled_tpl();
				if($member['member'] == 1){
					$update	= mysql_query("UPDATE `members` SET `language`='".$clanguage."' WHERE `id`='".$member['id']."'");
				}
		}
	}
?>