<?php
session_start();ob_start();
    include("include/db.inc.php");
	if($_SESSION['lang']=='')
	{
		$_SESSION['lang'] = "en";
	}	
	include 'languages/lang.'.$_SESSION['lang'].'.php';	
	include_once("include/bit_functions.inc.php");
    $db1=new db;
    $db1->open();mysql_query("SET NAMES 'utf8'");
	check_login();
	$uid=$_SESSION[uid];  
	
	
	if($_POST['on_off'])
	{	
	mysql_query("update user set user_online='".$_POST['on_off_value']."' where id=$uid")or die(mysql_error());	
	
     $chatrec=mysql_fetch_array(mysql_query("select user_online from user where id='".$uid."'"));
     if($chatrec['user_online']=='1'){?>
          <?=_U_ONLN1_?> <a href="#" onclick="on_off_line('0'); return false;"><?=_GO_OFFLN1_?></a>
          <? }
		  else
		  { ?>
          <?=_U_OFFLN1_?> <a href="#" onclick="on_off_line('1'); return false;"><?=_GO_ONLN1_?></a>
		<? }
	}
	if($_POST['status'])
	{
	mysql_query("update user set user_curstat='".$_POST[status]."',stat_date=now() where id=$uid")or die(mysql_error());	
	
	$chatrec=mysql_fetch_array(mysql_query("select user_curstat,stat_date from user where id='$uid'"));
				if($chatrec['user_curstat']!='cleared status')
			{?>
			
				<div style="float:left">
				 <span id="su_name">
				 &nbsp;<?=_IS_?>
				 </span> <span id="su_text">
				 <?=$chatrec['user_curstat']?>
				 </span></div>
				 
				 <div style="clear:left">
				 <span class="normaltextnotbold"><small><?=_UPDT_CHT_?>
				 <?
					$dt=explode(" ",$chatrec['stat_date']);
					$notedate=formated_time($dt[0],$dt[1]);
					//echo $notedate;
					?>
				 </small></span>    
				 <? if($uid==$_SESSION['uid']){?>
				 <a id="su_edit" class="su_edit smalla1old" href="#" onClick="editStatus_chat();return false;">
				 <?=_EDT_?>
				 </a>
				 <? }?>
				</div>
			
				 <?
			}else if($chatrec['user_curstat']=='cleared status')
			{
			?>
				 <br /><a id="su_edit" class="su_edit smalla1old" href="#" onClick="editStatus_chat();return false;">
				 <?=_UPDT_YR_STATS_?>
				 </a>
				 <?
			} 
	
	
	}
	
	
	?>
