<?php
	include("vars.php");
	include("db.php");
	

if($_SERVER['REQUEST_METHOD'] == "POST")
{//1
	if($your_name && $your_surname && $your_email && $password1 && $sex && $user_ip && $bd_day && $bd_month && $bd_year && $user_ip)
	{//2
		// delete
		mysql_query("DELETE FROM register WHERE reg_date < '$cur_min_date' AND account_status = 0");
		// account
		$msg = "";
		$result = mysql_query("SELECT * FROM register WHERE email = '$your_email'",$db);
		if($myrow = mysql_fetch_array($result))
		{//3
			$msg = "ar daregistrirdiT, aseTi momxmarebeli ukve arsebobs, <a href='javascript:history.back(1);' class='link_geo4'>ukan dabruneba</a>";
		}//3
		else
		{//3
		//
			mysql_query("DELETE FROM secure WHERE event_date <> '$event_date'");
			$result = mysql_query("SELECT * FROM secure WHERE user_ip = '$user_ip'",$db);

			if($myrow = mysql_fetch_array($result))
			{//4
				$reg_count = $myrow["reg_count"];
				$reg_count = $reg_count + 1;
				if($reg_count < $max_reg)
				{//5
					mysql_query("UPDATE secure SET reg_count = '$reg_count' WHERE user_ip = '$user_ip'");
					// reg total
					$result = mysql_query("SELECT * FROM sms_statics",$db);
					$myrow = mysql_fetch_array($result);
					$reg_total = $myrow["reg_total"];
					$reg_total = $reg_total + 1;
					mysql_query("UPDATE sms_statics SET reg_total = '$reg_total'");
					//mail();
					mysql_query("INSERT INTO register values('','$event_date','$your_name','$your_surname','$your_email','$password1','$sex','$bd_day','$bd_month','$bd_year','0','0','','$random','no','yes')");
					$msg = "Tqven daregistrirdebiT <font face='Tahoma,Arial,Verdana' size='1'>SMS</font> portalSi, roca gaaqtiurebT kods erTi dRis ganmavlobaSi, romelic gamogzavnilia Tqvens eleqtronul fostaze [".$font_s2.$your_email.$font_e2."]";
					//submit mail
					include("register_config.php");
					$svariant = "reg";
					include($sfile_url);

				}//5
				else
				{//5
					$msg = "dRes sakmarisia momxmareblebis daregistrireba";
				}//5
			}//4
			else
			{//4
				mysql_query("INSERT INTO secure values('','$user_ip','','1','','','$event_date')");
				// email total
				$result = mysql_query("SELECT * FROM sms_statics",$db);
				$myrow = mysql_fetch_array($result);
				$reg_total = $myrow["$reg_total"];
				$reg_total = $reg_total + 1;
				mysql_query("UPDATE sms_statics SET reg_total = '$reg_total'");
				include("register_config.php");
				$svariant = "reg";
				include($sfile_url);
				mysql_query("INSERT INTO register values('','$event_date','$your_name','$your_surname','$your_email','$password1','$sex','$bd_day','$bd_month','$bd_year','0','0','','$random','no','yes')");
				$msg = "Tqven daregistrirdebiT <font face='Tahoma,Arial,Verdana' size='1'>SMS</font> portalSi, roca gaaqtiurebT kods erTi dRis ganmavlobaSi, romelic gamogzavnilia Tqvens eleqtronul fostaze [".$font_s2.$your_email.$font_e2."]";
			}//4
		}//3
	}//2
	else
	{//2
		$msg = "ar daregistrirdiT";
	}//2
}//1
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/registration.jpg" width="196" height="19"></td>
	</tr>
	<tr>
		<td width="120" class="geo" align="right">&nbsp;</td>
		<td width="10">&nbsp;</td>
		<td width="167" class="geo">&nbsp;</td>
	</tr>
<?php
if($_SERVER['REQUEST_METHOD'] != "POST") 
{?>
	<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="" 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="" 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="" maxlength="35">&nbsp;</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="" 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="" 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">amoirCie</option>
		<option value="male">biWi</option>
		<option value="female">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="" maxlength="2">&nbsp;<input type=text class="in_geo" name="bd_month" size="2" value="" maxlength="2">&nbsp;<input type=text class="in_geo" name="bd_year" size="4" value="" maxlength="4">&nbsp;[dR]&nbsp;[Tv]&nbsp;[weli]</td>
	</tr>
	<tr>
		<td width="120" class="geo" align="right">&nbsp;<a href="javascript:open_popup('300','250','cesebi.php');" class="link_geo4">gaecaniT wesebs</a></td>
		<td width="10">&nbsp;</td>
		<td width="167" class="geo">&nbsp;<input type=button class="bu_geo3" name="send" value="registracia" style="cursor:hand;" onclick="register();">&nbsp;</td>
	</tr>
<?}?>
	<tr>
		<td height="19" colspan="3" width="297" class="geo" align="center">&nbsp;<?=@$msg?></td>
	</tr>
</table>
</form>
</body>

</html>