<?php
	include("vars.php");
	include("db.php");
	$your_name_value = "  saxeli";
	
if($_SERVER['REQUEST_METHOD'] == "POST")
{
	if($your_name && $your_name_result && $sms_type && $sms_geo_result && $user_ip)
	{
		//
		$msg = "";
		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))
		{
			$add_sms_count = $myrow["add_sms_count"];
			if($your_name != "admin")
			{
				$add_sms_count = $add_sms_count + 1;
			}
			if($add_sms_count < $max_add_sms)
			{
				mysql_query("UPDATE secure SET add_sms_count = '$add_sms_count' WHERE user_ip = '$user_ip'");
				// add sms total
				$result = mysql_query("SELECT * FROM sms_statics",$db);
				$myrow = mysql_fetch_array($result);
				$sms_text_total = $myrow["sms_text_total"];
				$sms_text_total = $sms_text_total + 1;

				mysql_query("INSERT INTO sms_book values('','$event_date','$your_name','$sms_type','$sms_geo_result','0')");
				//
				//mail($mobile_email,$your_name_result,$sms_geo_result,$headers);
				//mail();
				$msg = "Tqveni <font face='Tahoma,Arial,Verdana' size='1'>SMS</font> Setyobineba damatebuli, admini Seamowmebs (".$send_time.")";
			}
			else
			{
				$msg = "dRes sakmarisia <font face='Tahoma,Arial,Verdana' size='1'>SMS</font>-ebis damateba";
			}
		}
		else
		{
			mysql_query("INSERT INTO secure values('','$user_ip','','','1','','$event_date')");
			// add sms total
			$result = mysql_query("SELECT * FROM sms_statics",$db);
			$myrow = mysql_fetch_array($result);
			$sms_text_total = $myrow["sms_text_total"];
			$sms_text_total = $sms_text_total + 1;
			mysql_query("UPDATE sms_statics SET sms_text_total = '$sms_text_total'");

			mysql_query("INSERT INTO sms_book values('','$event_date','$your_name','$sms_type','$sms_geo_result','0')");
			//
			//mail($mobile_email,$your_name_result,$sms_geo_result,$headers);
			//mail();
			$msg = "Tqveni <font face='Tahoma,Arial,Verdana' size='1'>SMS</font> Setyobineba damatebuli, admini Seamowmebs (".$send_time.")";
		}
		
	}
	else
	{
		$msg = "<font face='Tahoma,Arial,Verdana' size='1'>SMS</font>-i ar daemata";
	}
}
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="2" width="297">
		<img border="0" src="../img/title/add_your_sms.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;</td>
	</tr>
	<tr>
		<td width="10">&nbsp;</td>
		<td width="287" class="geo">
		<input type=text class="in_geo" name="your_name" size="15" value="  avtori" maxlength="10" onfocus="input_empty('your_name','avtori');">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<select name="sms_type" class="in_geo3">
		<option value="00">amoirCie sms rubrika</option>
		<?php
		$result = mysql_query("SELECT * FROM sms_type ORDER BY id ASC",$db);
		if($myrow = mysql_fetch_array($result))
		{
			do{
				echo('<option value="'.$myrow['sms_type'].'">'.$myrow['sms_type'].'</option>'."\n");
			}
			while($myrow = mysql_fetch_array($result));
		}
		?>
		</select>&nbsp;&nbsp;
		</td>
	</tr>
	<tr>
		<td width="10">&nbsp;</td>
		<td width="287" class="geo">
		<textarea name="sms_geo" cols="43" rows="6" class="in_geo" onfocus="input_empty('sms_geo','teqsti');" ondblclick="text_replace_st();"  onfocus="text_replace_st();"  onkeypress="text_replace_st();"  onkeydown="text_replace_st();"  onkeyup="text_replace_st();"  onchange="text_replace_st();"  onblur="text_replace_st();">teqsti</textarea>
		<input type="hidden" name="sms_geo_result" value="">
		<input type="hidden" name="your_name_result" value="">
		<input type="hidden" name="sta_geo" id="sta_geo" value="eng">
		</td>
	</tr>
	<tr>
		<td width="10">&nbsp;</td>
		<td width="287" class="geo">
		&nbsp;<input type=button class="bu_geo3" name="send" value="damateba" style="cursor:hand;" onclick="sms_st();">&nbsp;&nbsp;
		<input type=text class="in_geo" name="symbols_number" size="5" value="" maxlength="3" readonly></td>
	</tr>
	<tr>
		<td width="10">&nbsp;</td>
		<td width="287" class="geo_s" align="center">&nbsp;<?=@$msg?></td>
	</tr>
</table>
</form>
</body>

</html>