<?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, 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_login, $login);
  $Result1 = mysql_query($insertSQL, $login) or die(mysql_error());

  $insertGoTo = "p1.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">
<!-- ImageReady Preload Script (index.psd) -->
<script type="text/javascript">
<!--

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		index_Shape_2_over = newImage("images/index_Shape-2-over.gif");
		index_Shape_2_over021 = newImage("images/index_Shape-2-over-21.gif");
		index_Shape_2_over023 = newImage("images/index_Shape-2-over-23.gif");
		index_Shape_2_over026 = newImage("images/index_Shape-2-over-26.gif");
		index_Shape_2_over031 = newImage("images/index_Shape-2-over-31.gif");
		index_Shape_2_over035 = newImage("images/index_Shape-2-over-35.gif");
		preloadFlag = true;
	}
}

// -->
</script>
<!-- End Preload Script -->
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="preloadImages();">
<!-- ImageReady Slices (index.psd) -->
<table width="1417" border="1">
  <tr>
    <td width="1407" bgcolor="#FFCCFF"><table width="801" height="1001" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_">
      <tr>
        <td colspan="13"><img src="images/index_01.gif" width="800" height="252" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="252" alt=""></td>
      </tr>
      <tr>
        <td colspan="2" rowspan="6"><img src="images/index_02.gif" width="6" height="194" alt=""></td>
        <td colspan="5" rowspan="2"><img src="images/index_Layer-5.gif" width="188" height="34" alt=""></td>
        <td colspan="6"><img src="images/index_04.gif" width="606" height="17" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="17" alt=""></td>
      </tr>
      <tr>
        <td colspan="4" rowspan="2"><img src="images/index_05.gif" width="84" height="40" alt=""></td>
        <td rowspan="15" align="center" valign="top" bgcolor="#FFFFFF"><p>&#3626;&#3617;&#3633;&#3588;&#3619;&#3626;&#3617;&#3634;&#3594;&#3636;&#3585;&#3651;&#3627;&#3617;&#3656;</p>
          <form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
            <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" id="address"></textarea>
            </p>
            <p>&#3648;&#3610;&#3629;&#3619;&#3660;&#3650;&#3607;&#3619;
              <label for="address"></label>
              <input type="text" name="tel" id="textfield2">
            </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="button" id="button" value="&#3605;&#3585;&#3621;&#3591;">
              <input type="reset" name="button2" id="button2" value="&#3618;&#3585;&#3648;&#3621;&#3636;&#3585;">
            </p>
            <input type="hidden" name="MM_insert" value="form1">
          </form>
          <p>&nbsp;</p></td>
        <td rowspan="17"><img src="images/index_07.gif" width="82" height="731" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="17" alt=""></td>
      </tr>
      <tr>
        <td colspan="5"><img src="images/index_08.gif" width="188" height="23" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="23" alt=""></td>
      </tr>
      <tr>
        <td rowspan="3"><img src="images/index_09.gif" width="1" height="137" alt=""></td>
        <td colspan="5"><img src="images/index_Layer-6.gif" width="188" height="35" alt=""></td>
        <td colspan="3" rowspan="6"><img src="images/index_11.gif" width="83" height="278" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="35" alt=""></td>
      </tr>
      <tr>
        <td rowspan="2"><img src="images/index_12.gif" width="1" height="102" alt=""></td>
        <td><img src="images/index_13.gif" width="180" height="42" alt=""></td>
        <td colspan="3" rowspan="2"><img src="images/index_14.gif" width="7" height="102" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="42" alt=""></td>
      </tr>
      <tr>
        <td><img src="images/index_15.gif" width="180" height="60" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="60" alt=""></td>
      </tr>
      <tr>
        <td rowspan="12"><img src="images/index_16.gif" width="5" height="554" alt=""></td>
        <td colspan="7"><a href="#"
				onmouseover="changeImages('index_Shape_2', 'images/index_Shape-2-over.gif'); return true;"
				onmouseout="changeImages('index_Shape_2', 'images/index_Shape-2.gif'); return true;"
				onmousedown="changeImages('index_Shape_2', 'images/index_Shape-2-over.gif'); return true;"
				onmouseup="changeImages('index_Shape_2', 'images/index_Shape-2-over.gif'); return true;"> <img name="index_Shape_2" src="images/index_Shape-2.gif" width="190" height="48" border="0" alt=""></a></td>
        <td><img src="images/spacer.gif" width="1" height="48" alt=""></td>
      </tr>
      <tr>
        <td colspan="7"><a href="#"
				onmouseover="changeImages('index_Shape_2020', 'images/index_Shape-2-over-21.gif'); return true;"
				onmouseout="changeImages('index_Shape_2020', 'images/index_Shape-2-20.gif'); return true;"
				onmousedown="changeImages('index_Shape_2020', 'images/index_Shape-2-over-21.gif'); return true;"
				onmouseup="changeImages('index_Shape_2020', 'images/index_Shape-2-over-21.gif'); return true;"> <img name="index_Shape_2020" src="images/index_Shape-2-20.gif" width="190" height="46" border="0" alt=""></a></td>
        <td><img src="images/spacer.gif" width="1" height="46" alt=""></td>
      </tr>
      <tr>
        <td colspan="7"><a href="#"
				onmouseover="changeImages('index_Shape_2022', 'images/index_Shape-2-over-23.gif'); return true;"
				onmouseout="changeImages('index_Shape_2022', 'images/index_Shape-2-22.gif'); return true;"
				onmousedown="changeImages('index_Shape_2022', 'images/index_Shape-2-over-23.gif'); return true;"
				onmouseup="changeImages('index_Shape_2022', 'images/index_Shape-2-over-23.gif'); return true;"> <img name="index_Shape_2022" src="images/index_Shape-2-22.gif" width="190" height="47" border="0" alt=""></a></td>
        <td><img src="images/spacer.gif" width="1" height="47" alt=""></td>
      </tr>
      <tr>
        <td><a href="#"
				onmouseover="changeImages('index_Shape_2022', 'images/index_Shape-2-over-23.gif'); return true;"
				onmouseout="changeImages('index_Shape_2022', 'images/index_Shape-2-22.gif'); return true;"
				onmousedown="changeImages('index_Shape_2022', 'images/index_Shape-2-over-23.gif'); return true;"
				onmouseup="changeImages('index_Shape_2022', 'images/index_Shape-2-over-23.gif'); return true;"> <img src="images/index_Shape-2-24.gif" width="1" height="5" border="0" alt=""></a></td>
        <td colspan="7" rowspan="2"><a href="#"
				onmouseover="changeImages('index_Shape_2025', 'images/index_Shape-2-over-26.gif'); return true;"
				onmouseout="changeImages('index_Shape_2025', 'images/index_Shape-2-25.gif'); return true;"
				onmousedown="changeImages('index_Shape_2025', 'images/index_Shape-2-over-26.gif'); return true;"
				onmouseup="changeImages('index_Shape_2025', 'images/index_Shape-2-over-26.gif'); return true;"> <img name="index_Shape_2025" src="images/index_Shape-2-25.gif" width="190" height="46" border="0" alt=""></a></td>
        <td colspan="2" rowspan="2"><img src="images/index_22.gif" width="82" height="46" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="5" alt=""></td>
      </tr>
      <tr>
        <td rowspan="8"><img src="images/index_23.gif" width="1" height="408" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="41" alt=""></td>
      </tr>
      <tr>
        <td><a href="#"
				onmouseover="changeImages('index_Shape_2025', 'images/index_Shape-2-over-26.gif'); return true;"
				onmouseout="changeImages('index_Shape_2025', 'images/index_Shape-2-25.gif'); return true;"
				onmousedown="changeImages('index_Shape_2025', 'images/index_Shape-2-over-26.gif'); return true;"
				onmouseup="changeImages('index_Shape_2025', 'images/index_Shape-2-over-26.gif'); return true;"> <img src="images/index_Shape-2-29.gif" width="1" height="6" border="0" alt=""></a></td>
        <td colspan="7" rowspan="2"><a href="#"
				onmouseover="changeImages('index_Shape_2030', 'images/index_Shape-2-over-31.gif'); return true;"
				onmouseout="changeImages('index_Shape_2030', 'images/index_Shape-2-30.gif'); return true;"
				onmousedown="changeImages('index_Shape_2030', 'images/index_Shape-2-over-31.gif'); return true;"
				onmouseup="changeImages('index_Shape_2030', 'images/index_Shape-2-over-31.gif'); return true;"> <img name="index_Shape_2030" src="images/index_Shape-2-30.gif" width="190" height="46" border="0" alt=""></a></td>
        <td rowspan="7"><img src="images/index_26.gif" width="81" height="367" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="6" alt=""></td>
      </tr>
      <tr>
        <td rowspan="6"><img src="images/index_27.gif" width="1" height="361" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="40" alt=""></td>
      </tr>
      <tr>
        <td colspan="7"><a href="#"
				onmouseover="changeImages('index_Shape_2034', 'images/index_Shape-2-over-35.gif'); return true;"
				onmouseout="changeImages('index_Shape_2034', 'images/index_Shape-2-34.gif'); return true;"
				onmousedown="changeImages('index_Shape_2034', 'images/index_Shape-2-over-35.gif'); return true;"
				onmouseup="changeImages('index_Shape_2034', 'images/index_Shape-2-over-35.gif'); return true;"> <img name="index_Shape_2034" src="images/index_Shape-2-34.gif" width="190" height="52" border="0" alt=""></a></td>
        <td><img src="images/spacer.gif" width="1" height="52" alt=""></td>
      </tr>
      <tr>
        <td colspan="7"><img src="images/index_29.gif" width="190" height="29" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="29" alt=""></td>
      </tr>
      <tr>
        <td rowspan="3"><img src="images/index_30.gif" width="1" height="240" alt=""></td>
        <td colspan="2" rowspan="2"><img src="images/index_31.gif" width="181" height="136" alt=""></td>
        <td colspan="4" rowspan="3"><img src="images/index_32.gif" width="8" height="240" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="82" alt=""></td>
      </tr>
      <tr>
        <td rowspan="2"><img src="images/index_33.gif" width="440" height="158" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="54" alt=""></td>
      </tr>
      <tr>
        <td colspan="2"><img src="images/index_34.gif" width="181" height="104" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="104" alt=""></td>
      </tr>
      <tr>
        <td><img src="images/spacer.gif" width="5" height="1" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td><img src="images/spacer.gif" width="180" height="1" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td><img src="images/spacer.gif" width="5" height="1" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td><img src="images/spacer.gif" width="81" height="1" alt=""></td>
        <td><img src="images/spacer.gif" width="440" height="1" alt=""></td>
        <td><img src="images/spacer.gif" width="82" height="1" alt=""></td>
        <td></td>
      </tr>
    </table></td>
  </tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>