<?php require_once('Connections/db_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, address, tel) VALUES (%s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['Username'], "text"),
                       GetSQLValueString($_POST['Password'], "text"),
                       GetSQLValueString($_POST['name'], "text"),
                       GetSQLValueString($_POST['address'], "text"),
                       GetSQLValueString($_POST['tel'], "text"));

  mysql_select_db($database_db_login, $db_login);
  $Result1 = mysql_query($insertSQL, $db_login) or die(mysql_error());

  $insertGoTo = "regis.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?>
<html>
<head>
<title>index</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (index.psd) -->
<table width="1001" height="1001" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
	<tr>
		<td colspan="11">
			<img src="images/index_01.gif" width="1000" height="246" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="1" height="246" alt=""></td>
	</tr>
	<tr>
		<td colspan="7">
			<img src="images/index_02.gif" width="506" height="2" alt=""></td>
		<td rowspan="4">
			<img src="images/index_Layer-23.gif" width="253" height="54" alt=""></td>
		<td colspan="3" rowspan="3">
			<img src="images/index_04.gif" width="241" height="5" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="1" height="2" alt=""></td>
	</tr>
	<tr>
		<td colspan="3" rowspan="5">
			<img src="images/index_Layer-20.gif" width="253" height="56" alt=""></td>
		<td colspan="4">
			<img src="images/index_06.gif" width="253" height="2" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="1" height="2" alt=""></td>
	</tr>
	<tr>
		<td colspan="4" rowspan="4">
			<img src="images/index_Layer-22.gif" width="253" height="54" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="1" height="1" alt=""></td>
	</tr>
	<tr>
		<td rowspan="5">
			<img src="images/index_08.gif" width="1" height="137" alt=""></td>
		<td colspan="2" rowspan="2">
			<img src="images/index_Layer-24.gif" width="240" height="50" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="1" height="49" alt=""></td>
	</tr>
	<tr>
		<td rowspan="4">
			<img src="images/index_10.gif" width="253" height="88" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="1" height="1" alt=""></td>
	</tr>
	<tr>
		<td colspan="2" rowspan="3">
			<img src="images/index_11.gif" width="240" height="87" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="1" height="3" alt=""></td>
	</tr>
	<tr>
		<td colspan="7">
			<img src="images/index_12.gif" width="506" height="67" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="1" height="67" alt=""></td>
	</tr>
	<tr>
		<td colspan="2" rowspan="3">
			<img src="images/index_13.gif" width="42" height="165" alt=""></td>
		<td colspan="2" rowspan="2" align="center" bgcolor="#E7B5B5"><p>username
		  <input type="text" name="textfield" id="textfield">
		  </p>
          <p>password
            <label for="textfield2"></label>
            <input type="text" name="textfield2" id="textfield2">
          </p>
          <p>
            <input type="submit" name="button" id="button" value="&#3605;&#3585;&#3621;&#3591;">
            <input type="reset" name="button2" id="button2" value="&#3618;&#3585;&#3648;&#3621;&#3636;&#3585;">
        </p></td>
		<td colspan="3">
    <img src="images/index_15.gif" width="252" height="17" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="1" height="17" alt=""></td>
	</tr>
	<tr>
		<td colspan="2" rowspan="2">
			<img src="images/index_16.gif" width="50" height="148" alt=""></td>
		<td colspan="4" rowspan="3" align="center" valign="top" bgcolor="#EEC8CD"><p>&#3626;&#3617;&#3633;&#3588;&#3619;&#3626;&#3617;&#3634;&#3594;&#3636;&#3585;&#3651;&#3627;&#3617;&#3656; </p>
          <form action="<?php echo $editFormAction; ?>" name="form1" method="POST">
            <p>&#3594;&#3639;&#3656;&#3629; - &#3626;&#3585;&#3640;&#3621;
              <label for="name"></label>
              <input type="text" name="name" id="name">
            </p>
            <p>&#3607;&#3637;&#3656;&#3629;&#3618;&#3641;&#3656;
              <label for="address"></label>
              <textarea name="address" cols="30" rows="3" id="address"></textarea>
            </p>
            <p>&#3648;&#3610;&#3629;&#3619;&#3660;&#3650;&#3607;&#3619;
              <label for="tel"></label>
              <input type="text" name="tel" id="tel">
            </p>
            <p>&#3594;&#3639;&#3656;&#3629;&#3612;&#3641;&#3657;&#3651;&#3594;&#3657;
              <label for="Username"></label>
              <input type="text" name="Username" id="Username">
            </p>
            <p>&#3619;&#3627;&#3633;&#3626;&#3612;&#3656;&#3634;&#3609;
              <label for="Password"></label>
              <input type="text" name="Password" id="Password">
            </p>
            <p>
              <input type="submit" name="button4" id="button4" value="&#3605;&#3585;&#3621;&#3591;">
              <input type="reset" name="button3" id="button3" value="&#3618;&#3585;&#3648;&#3621;&#3636;&#3585;">
              <input type="hidden" name="MM_insert" value="form1">
            </p>
        </form></td>
		<td rowspan="5">
			<img src="images/index_18.gif" width="94" height="612" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="1" height="112" alt=""></td>
	</tr>
	<tr>
		<td colspan="2">
			<img src="images/index_19.gif" width="212" height="36" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="1" height="36" alt=""></td>
	</tr>
	<tr>
		<td rowspan="3">
			<img src="images/index_20.gif" width="31" height="464" alt=""></td>
		<td colspan="4" rowspan="2" align="center" valign="top"><embed src="http://i287.photobucket.com/albums/ll159/babyyeeyee/28may0903.swf"width="187" height="218" wmode="transparent"></embed></td>
		<td rowspan="3">
    <img src="images/index_22.gif" width="32" height="464" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="1" height="184" alt=""></td>
	</tr>
	<tr>
		<td colspan="4" rowspan="2">
			<img src="images/index_23.gif" width="602" height="280" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="1" height="73" alt=""></td>
	</tr>
	<tr>
		<td colspan="4">
			<img src="images/index_24.gif" width="241" height="207" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="1" height="207" alt=""></td>
	</tr>
	<tr>
		<td>
			<img src="images/spacer.gif" width="31" height="1" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="11" height="1" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="211" height="1" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="1" height="1" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="18" height="1" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="32" height="1" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="202" height="1" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="253" height="1" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="1" height="1" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="146" height="1" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="94" height="1" alt=""></td>
		<td></td>
	</tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>