<?php require_once('Connections/login.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO tb_login (Username, Password, Name, Sex, address) VALUES (%s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['Username'], "text"),
                       GetSQLValueString($_POST['Password'], "text"),
                       GetSQLValueString($_POST['Name'], "text"),
                       GetSQLValueString($_POST['Sex'], "text"),
                       GetSQLValueString($_POST['address'], "text"));

  mysql_select_db($database_login, $login);
  $Result1 = mysql_query($insertSQL, $login) or die(mysql_error());

  $insertGoTo = "fr_regiter_T.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?>
<html>
<head>
<title>&#3624;&#3634;&#3621;&#3648;&#3592;&#3657;&#3634;&#3611;&#3641;&#3656; - &#3618;&#3656;&#3634;</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
<style type="text/css">
body {
	background-color: #FBF3DE;
}
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/page1_02---.gif','images/page1_03---.gif','images/page1_04---.gif','images/page1_05---.gif','images/page1_06---.gif')"><div align="center">
<!-- Save for Web Slices (page1.psd) -->
<table id="Table_01" width="1024" height="1366" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td colspan="9">
			<img src="images/index_01.gif" width="1024" height="522" alt=""></td>
	</tr>
	<tr>
		<td colspan="5"><a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image26','','images/page1_02---.gif',1)"><img src="images/index_02.gif" name="Image26" width="207" height="140" border="0"></a></td>
		<td><a href="p1.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image27','','images/page1_03---.gif',1)"><img src="images/index_03.gif" name="Image27" width="204" height="140" border="0"></a></td>
		<td><a href="p2.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image28','','images/page1_04---.gif',1)"><img src="images/index_04.gif" name="Image28" width="203" height="140" border="0"></a></td>
		<td><a href="p3.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image29','','images/page1_05---.gif',1)"><img src="images/index_05.gif" name="Image29" width="203" height="140" border="0"></a></td>
		<td><a href="p4.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image30','','images/page1_06---.gif',1)"><img src="images/index_06.gif" name="Image30" width="207" height="140" border="0"></a></td>
	</tr>
	<tr>
		<td colspan="5">
		  <img src="images/index_07.gif" width="207" height="36" alt=""></td>
		<td colspan="4" rowspan="6" align="center" valign="top"><form action="<?php echo $editFormAction; ?>" name="form1" method="POST">
		  <p>&nbsp;</p>
		  <p>Username
		    <label for="Username"></label>
		    <input type="text" name="Username" id="Username">
		  </p>
		  <p>Password
		    <label for="Password"></label>
		    <input type="password" name="Password" id="Password">
		  </p>
		  <p>&#3594;&#3639;&#3656;&#3629; - &#3626;&#3585;&#3640;&#3621;
		    <label for="Name"></label>
		    <input type="text" name="Name" id="Name">
		  </p>
		  <p>&#3648;&#3614;&#3624;
		    <label for="Sex"></label>
		    <input type="text" name="Sex" id="Sex">
		  </p>
		  <p>&#3607;&#3637;&#3656;&#3629;&#3618;&#3641;&#3656;
		    <label for="address"></label>
		    <textarea name="address" id="address" cols="45" rows="5"></textarea>
		    <br>
	      </p>
		  <p>
		    <input type="submit" name="button" id="button" value="Ok">
		    &nbsp; 
		    &nbsp; 
		    &nbsp; 
		    &nbsp; 
		    &nbsp; 
		     <input type="reset" name="button2" id="button2" value="Cancel">
		  </p>
		  <input type="hidden" name="MM_insert" value="form1">
        </form></td>
	</tr>
	<tr>
		<td colspan="2" rowspan="2">
		  <img src="images/index_09.gif" width="25" height="91" alt=""></td>
		<td><a href="fr_login.php"><img src="images/index_10.gif" width="156" height="54" alt=""></a></td>
		<td colspan="2" rowspan="2">
			<img src="images/index_11.gif" width="26" height="91" alt=""></td>
	</tr>
	<tr>
		<td>
			<img src="images/index_12.gif" width="156" height="37" alt=""></td>
	</tr>
	<tr>
		<td rowspan="2">
			<img src="images/index_13.gif" width="14" height="77" alt=""></td>
		<td colspan="3">
		  <img src="images/index_14.gif" width="181" height="48" alt=""></td>
		<td rowspan="2">
			<img src="images/index_15.gif" width="12" height="77" alt=""></td>
	</tr>
	<tr>
		<td colspan="3">
			<img src="images/index_16.gif" width="181" height="29" alt=""></td>
	</tr>
	<tr>
		<td colspan="5">
			<img src="images/index_17.gif" width="207" height="432" alt=""></td>
	</tr>
	<tr>
		<td colspan="9">
			<img src="images/index_18.gif" width="1024" height="67" alt=""></td>
	</tr>
	<tr>
		<td>
			<img src="all/images/spacer.gif" width="14" height="1" alt=""></td>
		<td>
			<img src="all/images/spacer.gif" width="11" height="1" alt=""></td>
		<td>
			<img src="all/images/spacer.gif" width="156" height="1" alt=""></td>
		<td>
			<img src="all/images/spacer.gif" width="14" height="1" alt=""></td>
		<td>
			<img src="all/images/spacer.gif" width="12" height="1" alt=""></td>
		<td>
			<img src="all/images/spacer.gif" width="204" height="1" alt=""></td>
		<td>
			<img src="all/images/spacer.gif" width="203" height="1" alt=""></td>
		<td>
			<img src="all/images/spacer.gif" width="203" height="1" alt=""></td>
		<td>
			<img src="all/images/spacer.gif" width="207" height="1" alt=""></td>
	</tr>
</table>
<!-- End Save for Web Slices -->
</div>
</body>
</html>