<?php
	include("vars.php");
	include("db.php");
	$page_hide = "no";
	$msg = "";
	

if($_SERVER['REQUEST_METHOD'] == "POST")
{//1
	if($your_name && $your_surname && $your_email && $password1 && $sex && $user_id && $bd_day && $bd_month && $bd_year && $user_ip && $with_name && $with_email && $active_code)
	{//2
		$result = mysql_query("SELECT * FROM register WHERE id = '$user_id' AND active_code = '$active_code'",$db);
		if($myrow = mysql_fetch_array($result))
		{
			if($your_email != $myrow['email'])
			{
				$result = mysql_query("SELECT * FROM register WHERE email = '$your_email'",$db);
				if($myrow = mysql_fetch_array($result))
				{
					$msg = "es eleqtronuli fosta arsebobs ukve";
				}
				else
				{
					mysql_query("UPDATE register SET reg_date = '$event_date', name = '$your_name', surname = '$your_surname', email = '$your_email', password = '$password1', sex = '$sex', bd_day = '$bd_day', bd_month = '$bd_month', bd_year = '$bd_year', account_status = '0', active_code = '$random', with_name = '$with_name', with_email = '$with_email' WHERE id = '$user_id' AND active_code = '$active_code'");
					include("register_config.php");
					$svariant = "change_info";
					include($sfile_url);
					$page_hide = "yes";

					$msg = "informacia Secvlilia, Tqven unda gaaqtiuroT kodi erTi dRis ganmavlobaSi, romelic gamogzavnilia<br> Tqvens eleqtronul fostaze [".$font_s2.$your_email.$font_e2."]";
				}
			}
			else
			{
				mysql_query("UPDATE register SET name = '$your_name', surname = '$your_surname', password = '$password1', sex = '$sex', bd_day = '$bd_day', bd_month = '$bd_month', bd_year = '$bd_year', with_name = '$with_name', with_email = '$with_email' WHERE id = '$user_id' AND active_code = '$active_code'");
				$msg = "informacia Secvlilia";
			}
		}
	}//2
	else
	{//2
		$msg = "informacia ar Seicvala";
	}//2
}//1
else
{
	//$msg = "SemodiT nomrebis wignakSi Tavidan";
}
mysql_close();
?>
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title></title>
<link href="../js_css/iframe.css" rel="stylesheet">
</head>

<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" bgcolor="#1AB9F1">
<script language="javascript" src="../js_css/javascript.js"></script>
<form name="form1" action="<?=$_SERVER['REQUEST_URI']?>" method="POST">
<table border="0" width="297" id="table1" cellspacing="0" cellpadding="0">
	<tr>
		<td height="19" colspan="3" width="297">
		<img border="0" src="../img/title/change_my_info.jpg" width="196" height="19"></td>
	</tr>
<?php
if($user_id != "" && $active_code != "" && $page_hide == "no") 
{
	$result = mysql_query("SELECT * FROM register WHERE id = '$user_id' AND active_code = '$active_code'",$db);
	if($myrow = mysql_fetch_array($result))
	{
?>
	<tr>
		<td width="120" class="geo" align="right">&nbsp;Tqveni saxeli</td>
		<td width="10">&nbsp;</td>
		<td width="167" class="geo"><input type=text class="in_geo" name="your_name" size="16" value="<?=$myrow['name']?>" maxlength="10">&nbsp;</td>
	</tr>
	<tr>
		<td width="120" class="geo" align="right">&nbsp;gvari</td>
		<td width="10">&nbsp;</td>
		<td width="167" class="geo"><input type=text class="in_geo" name="your_surname" size="16" value="<?=$myrow['surname']?>" maxlength="20">&nbsp;</td>
	</tr>
	<tr>
		<td width="120" class="geo" align="right">&nbsp;eleqtronuli fosta</td>
		<td width="10">&nbsp;</td>
		<td width="167" class="geo"><input type=text class="in_eng" name="your_email" size="15" value="<?=$myrow['email']?>" maxlength="35">&nbsp;&nbsp;ar SecvaloT</td>
	</tr>
	<tr>
		<td width="120" class="geo" align="right">&nbsp;paroli</td>
		<td width="10">&nbsp;</td>
		<td width="167" class="eng"><input type=password class="in_eng" name="password1" size="15" value="<?=$myrow['password']?>" maxlength="15">&nbsp;[a-z][0-9]</td>
	</tr>
	<tr>
		<td width="120" class="geo" align="right">&nbsp;gaimeore paroli</td>
		<td width="10">&nbsp;</td>
		<td width="167" class="geo"><input type=password class="in_eng" name="password2" size="15" value="<?=$myrow['password']?>" maxlength="15">&nbsp;</td>
	</tr>
	<tr>
		<td width="120" class="geo" align="right">&nbsp;sqesi</td>
		<td width="10">&nbsp;</td>
		<td width="167" class="geo">
		<select name="sex" class="in_geo">
		<option value="00" class="in_geo">amoirCie</option>
		<option value="male" <? if($myrow['sex']=="male"){echo(" selected ");}?>>biWi</option>
		<option value="female" <? if($myrow['sex']=="female"){echo(" selected ");}?>>gogo</option>
		</select>&nbsp;</td>
	</tr>
	<tr>
		<td width="120" class="geo" align="right">&nbsp;dabadebis TariRi</td>
		<td width="10">&nbsp;</td>
		<td width="167" class="geo"><input type=text class="in_geo" name="bd_day" size="2" value="<?=$myrow['bd_day']?>" maxlength="2">&nbsp;<input type=text class="in_geo" name="bd_month" size="2" value="<?=$myrow['bd_month']?>" maxlength="2">&nbsp;<input type=text class="in_geo" name="bd_year" size="4" value="<?=$myrow['bd_year']?>" maxlength="4">&nbsp;[dR]&nbsp;[Tv]&nbsp;[weli]</td>
	</tr>
	<tr>
		<td width="120" class="geo" align="right">&nbsp;miyvebodes <font face="Tahoma,Arial,Verdana" size="1">SMS</font>-s ?</td>
		<td width="10">&nbsp;</td>
		<td width="167" class="geo">
		<select name="with_name" class="in_geo">
		<option value="00" class="in_geo2">saxeli</option>
		<option value="yes" <? if($myrow['with_name']=="yes"){echo(" selected ");}?>>ki</option>
		<option value="no" <? if($myrow['with_name']=="no"){echo(" selected ");}?>>ara</option>
		</select>&nbsp;
		<select name="with_email" class="in_geo">
		<option value="00" class="in_geo2">el. fosta</option>
		<option value="yes" <? if($myrow['with_email']=="yes"){echo(" selected ");}?>>ki</option>
		<option value="no" <? if($myrow['with_email']=="no"){echo(" selected ");}?>>ara</option>
		</select>
		<input name="active_code" value="<?=$active_code?>" type="hidden">
		<input name="user_id" value="<?=$user_id?>" type="hidden">
		<input name="u_event" value="sms" type="hidden">
		<input name="u_secure" value="<?=$u_secure?>" type="hidden">
		</td>
	</tr>
	<tr>
		<td width="120" class="geo" align="right">&nbsp;<a href="home_book.php?user_id=<?=$user_id?>&active_code=<?=$active_code?>&u_event=sms&u_secure=<?=$u_secure?>" class="link_geo4" target="_self">ukan dabruneba</a></td>
		<td width="10">&nbsp;</td>
		<td width="167" class="geo"><input type=button class="bu_geo3" name="send" value="  Secvla" style="cursor:hand;" onclick="update_register();">&nbsp;</td>
	</tr>
<?
	}
	else
	{
		$msg = "SemodiT nomrebis wignakSi Tavidan";
	}
}
else
{
	if($msg=="")
	{
		$msg = "SemodiT nomrebis wignakSi Tavidan";
	}
}
if($page_hide == "yes")
{
	echo('<tr>');
	echo('<td height="19" colspan="3" width="297" class="geo" align="center">&nbsp;</td>');
	echo('</tr>');
	echo('<tr>');
	echo('<td height="19" colspan="3" width="297" class="geo" align="center">&nbsp;</td>');
	echo('</tr>');
}
?>
	<tr>
		<td height="19" colspan="3" width="297" class="geo" align="center">&nbsp;<?=@$msg?></td>
	</tr>
</table>
</form>
</body>

</html>