<?
	include("config/connect.php");
	include("session.php");
	include("functions.php");

	$uid = $_SESSION["userid"];
	if($_POST["submit"]!="")
	{
		$qrysel = "select * from registration r left join countries c on r.country=c.countryId where id='".$uid."'";
		$ressel = mysql_query($qrysel);
		$objsel = mysql_fetch_object($ressel);
		
		if($objsel->sms_flag=='0' && $_POST["smscheck"]!="")
		{
			
			if($objsel->mobile_no=="" && $_POST["mobileno"]=="")
			{
				header("location: smssetting.html?msg=2");
				exit;
			}
			elseif($_POST["mobileno"]!="")
			{
				$qryupd = "update registration set sms_flag='1',mobile_no='".$_POST["mobileno"]."',full_mobileno='+".$objsel->countrycode.$_POST["mobileno"]."' where id='".$uid."'";
				mysql_query($qryupd) or die(mysql_error());
				header("location: smssetting.html?msg=1");
				exit;
			}
			else
			{
				$qryupd = "update registration set sms_flag='1' where id='".$uid."'";
				mysql_query($qryupd) or die(mysql_error());
				header("location: smssetting.html?msg=1");
				exit;
			}
		}
		else
		{
			if($_POST["smscheck"]=="" && $objsel->sms_flag=='1')
			{
				$qryupd = "update registration set sms_flag='0' where id='".$uid."'";
				mysql_query($qryupd) or die(mysql_error());
				header("location: smssetting.html?msg=3");
				exit;
			}
		}
	}
	
	$qr = "select * from registration where id='".$uid."'";
	$rs = mysql_query($qr);
	$ob = mysql_fetch_object($rs);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?=$lng_characset;?>" />
<title><?=$AllPageTitle;?></title>
<link href="css/style_youbid.css" rel="stylesheet" type="text/css" />
<link href="css/menu.css" rel="stylesheet" type="text/css" />
<!--[if lte IE 6]>
<link href="css/menu_ie.css" rel="stylesheet" type="text/css" />
<![endif]-->
<script language="javascript" type="text/javascript" src="function.js"></script>
<script language="javascript" src="basic.js"></script>
</head>


<body>
<div id="main_div">
<?
	include("d1.php");
?>
		<div id="middle_div">
			<? include("leftside.php"); ?>
			<div class="inner-container">
				<div class="titlebar">
					<div class="leftbar"></div>
					<div class="middlebar"><div class="page_title_font"><?=$lng_myauctionsavenue;?> - <?=$lng_accsmssetting;?></div></div>
					<div class="rightbar"></div>
				</div>
				<div class="bodypart" style="text-align: left; min-height: 300px;">	
				<form name="f1" action="" method="post">
					<? if($_GET["msg"]==1){ ?>
					<div style="margin-top: 30px; margin-left: 40px;" class="greenfont"><B><?=$lng_smsturnon;?></B></div>
					<? } elseif($_GET["msg"]==3){ ?>
					<div style="margin-top: 30px; margin-left: 40px;" class="red-text-12-b"><B><?=$lng_smsturnoff;?></B></div>
					<? } ?>
				<div id="middle" style="margin-top: 20px; margin-left: 40px;">
					<h4 class="grayboldfont"><?=$lng_receivesms;?></h4>
					<? if($_GET["msg"]==2){ ?>
						<div style="margin-top: 15px;" class="red-text-12-b"><?=$lng_plsentermobile;?></div>
						<div style="margin-top: 15px;" class="normal_text"><?=$lng_mobilenumber;?> : <input type="text" class="textboxclas" name="mobileno" /></div>
					<? } ?>
					<div style="margin-top: 15px;" class="normal_text"><input type="checkbox" name="smscheck" value="smscheck" <?=$_GET["msg"]==2 || $ob->sms_flag=='1'?"checked":"";?> /> <?=$lng_yesreceivesms;?></div>
					<div style="margin-top: 25px;">&nbsp;&nbsp;&nbsp;&nbsp;<input type="image" name="submitimage" value="Close" src="<?=$lng_imagepath;?>submit_hover_btn.png" onmouseover="this.src='<?=$lng_imagepath;?>submit_btn.png'" onmouseout="this.src='<?=$lng_imagepath;?>submit_hover_btn.png'" /></div>
					<input type="hidden" name="submit" value="submit" />
					<div style="height: 20px; clear:both">&nbsp;</div>
				</div>
				</form>				
				</div>
				<div class="bottomline">
					<div class="leftsidecorner"></div>
					<div class="middlecorner"></div>
					<div class="rightsidecorner"></div>
				</div>
			</div>
		</div>
<?
	include("footer2.php");
?>		
</div>
</body>
</html>
