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

$msg = "";
if($user_id != "" && $active_code != "")
{
	$result = mysql_query("SELECT * FROM register WHERE id = '$user_id' AND active_code = '$active_code'",$db);
	if($myrow = mysql_fetch_array($result))
	{
		$bd_f1 = $myrow['bd_month']."-".$myrow['bd_day'];
		if($bd_f1 == $bd_f2)
		{
			$bd_f4 = $bd_f3 - $myrow['bd_year'];
			$msg .= "gilocavT Tqven ".$bd_f4." wlis Tavs, gisurvebT warmatebebs.<br>\n";
		}
		if($event_date != $myrow['last_enter'] && $myrow['last_enter'] != "0000-00-00")
		{
			// date
			$ydate = substr($myrow['last_enter'], 0, 4);
			$mdate = substr($myrow['last_enter'], 5, 2);
			$ddate = substr($myrow['last_enter'], 8, 2);
			$nddate = substr($ddate, 0, 1);
			if($nddate == 0)
			{
				$ddate = substr($ddate, 1, 1);
			}
			$fulldate = $ddate." ".$mmassiv[$mdate]["geo"].", ".$ydate;
			$msg .= "Tqveni bolo Semovla iyo ".$fulldate."<br>\n";
		}
		//
		mysql_query("UPDATE register SET last_enter = '$event_date' WHERE id = '$user_id'");
		$msg .= "Tqven gaqvT gagzavnili sul ".$myrow['sms_count']." <font face='Tahoma,Arial,Verdana' size='1'>SMS</font>-i.<br>\n";
		//
		if($myrow['with_name']=="yes")
		{
			$msg .= "Tqvens <font face='Tahoma,Arial,Verdana' size='1'>SMS</font> Setyobinebas miyveba Tqveni saxeli.<br>\n";
		}
		else
		{
			//$msg .= "Tqven sms Setyobinebas ar miyveba Tqveni saxeli.<br>\n";
		}
		//
		if($myrow['with_email']=="yes")
		{
			$msg .= "Tqvens <font face='Tahoma,Arial,Verdana' size='1'>SMS</font> Setyobinebas miyveba Tqveni el. fosta.<br>\n";
		}
		else
		{
			//$msg .= "Tqven sms Setyobinebas ar miyveba Tqveni eleqtronuli fostis misamarTi.<br>\n";
		}
		//
		// User bd	
		//
		$result = mysql_query("SELECT * FROM sms_user WHERE user_id = '$user_id'  AND  bd_day = '$cday' AND bd_month = '$cmonth'",$db);
		if($myrow = mysql_fetch_array($result))
		{
			do
			{
				$bd_f4 = $bd_f3 - $myrow['bd_year'];
				$msg .= "dRes ".$myrow['your_name']." ".$myrow['your_surname']." gaxda ".$bd_f4." wlis, <a href='javascript:bd_day(\"".$bd_s.$bd_text.$bd_e."\",\"".$myrow['your_name']." ".$myrow['your_surname']."\");' class='link_geo3' title='gaugzavne es sms Setyobineba - ".$bd_s.$bd_text.$bd_e."'>miuloce</a> <font face='Tahoma,Arial,Verdana' size='1'>SMS</font> SetyobinebiT.<br>\n";
			} 
			while($myrow = mysql_fetch_array($result));
		}
	}
	else
	{
		$msg = "SemodiT nomrebis wignakSi Tavidan";
	}
}
else
{
	$msg = "SemodiT nomrebis wignakSi Tavidan";
}
?>
<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>
<table border="0" width="297" id="table1" cellspacing="0" cellpadding="0">
	<tr>
		<td height="19" colspan="2" width="297">
		<img border="0" src="../img/title/control_panel.jpg" width="196" height="19"></td>
	</tr>
	<tr>
		<td width="10">&nbsp;</td>
		<td width="287" class="geo">&nbsp;</td>
	</tr>
	<tr>
		<td width="10">&nbsp;</td>
		<td width="287" class="geo">&nbsp;<a href="add_number.php?user_id=<?=$user_id?>&u_secure=<?=$u_secure?>&active_code=<?=$active_code?>&u_event=sms" class="link_geo4" target="_self"><img src="../img/icons/8.gif" width="16" height="16" border="0">&nbsp;nomrebis damateba</a></td>
	</tr>
	<tr>
		<td width="10">&nbsp;</td>
		<td width="287" class="geo">&nbsp;<a href="delete_number.php?user_id=<?=$user_id?>&u_secure=<?=$u_secure?>&active_code=<?=$active_code?>&u_event=sms" class="link_geo4" target="_self"><img src="../img/icons/3b.gif" width="16" height="16" border="0">&nbsp;nomrebis waSla</a></td>
	</tr>
	<tr>
		<td width="10">&nbsp;</td>
		<td width="287" class="geo">&nbsp;<a href="change_info.php?user_id=<?=$user_id?>&u_secure=<?=$u_secure?>&active_code=<?=$active_code?>&u_event=sms" class="link_geo4" target="_self"><img src="../img/icons/10.gif" width="16" height="16" border="0">&nbsp;Cemi monacemebis Secvla</a></td>
	</tr>
	<tr>
		<td width="10">&nbsp;</td>
		<td width="287" class="geo">&nbsp;</td>
	</tr>
	<tr>
		<td width="10">&nbsp;</td>
		<td width="287" class="geo"><?=$msg?>&nbsp;</td>
	</tr>
</table>
</body>

</html>
