|
|
|
จาก Code สามารถทำให้ การยืนยัน Password ตรวจสอบถูกต้องเเละให้มีภาพเครื่องหมายถูกขึ้นด้วย ทำอย่างไรคับ |
|
|
|
|
|
|
|
Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
$cryptinstall="crypt/cryptographp.fct.php";
include $cryptinstall;
// ถ้า user submit ฟอร์มมา
if( $_POST['ispostback'] ){
// ถ้าป้อน captcha มาถูกต้อง
if (chk_crypt($_POST['captcha'])){
echo "ถูกต้อง";
} else{
// ถ้าป้อน captcha ไม่ถูกต้อง
echo "ป้อน captcha ไม่ถูกต้อง ไม่ให้เก็บข้อมูลลงฐาน";
}
}
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>index</title>
<style type="text/css">
<!--
body {
background-image: url(images/Android_.jpg);
}
-->
</style>
<script src="SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" name="form1" method="post" action="check_log.php">
<table width="1052" border="0" align="center">
<tr>
<td width="549"> </td>
<td width="489">Email
<input type="text" name="txtUsername" id="txtUsername" />
Password
<input type="password" name="txtPassword" id="txtPassword" />
<input type="submit" name="button" id="button" value="LOGIN" />
<br />
<br /></td>
</tr>
</table>
</form>
<form id="form2" name="form2" method="post" action="check_reg.php">
<table width="1052" border="จ" align="center">
<tr>
<td width="476"> </td>
<td width="162" align="right">ลงทะเบียน</td>
<td width="400"> </td>
</tr>
<tr>
<td> </td>
<td align="right">Sex</td>
<td>:
<label>
<select name="in_sex" size="1" id="in_sex">
<option>-Sex-</option>
<option>Male</option>
<option>Famale</option>
</select>
</label></td>
</tr>
<tr>
<td> </td>
<td align="right">Name</td>
<td>:
<label><span id="sprytextfield1">
<input type="text" name="in_name" id="in_name" />
<span class="textfieldRequiredMsg">Please input Name.</span></span></label></td>
</tr>
<tr>
<td> </td>
<td align="right">Lastname</td>
<td>:
<label><span id="sprytextfield2">
<input type="text" name="in_last_n" id="in_last_n" />
<span class="textfieldRequiredMsg">Please input Last Name.</span></span></label></td>
</tr>
<tr>
<td> </td>
<td align="right">Date</td>
<td>:
<select name="day">
<option selected="selected">วันที่ </option>
<?
for($y=1;$y<=31;$y++) {
echo "<option value='$y'>$y</option>";
}
echo "</select>";
?>
</select>
<select name="mount">
<option selected="selected">เดือน </option>
<?
$mount = array("1" => "มกราคม",
"2" => "กุมภาพันธ์",
"3" => "มีนาคม",
"4" => "เมษายน",
"5" => "พฤษภาคม",
"6" => "มิถุนายน",
"7" => "กรกฎาคม ",
"8" => "สิงหาคม",
"9" => "กันยายน ",
"10" => "ตุลาคม",
"11" => "พฤศจิกายน",
"12" => "ธันวาคม");
for($im=1;$im<=12;++$im) echo "<option value='{$im}'>$mount[$im]</option>";
echo "selected=$mount ";
?>
</select>
<select name="year">
<option selected="selected">ปี</option>
<?
for($a=1800;$a<=2200;$a++) {
echo "<option value='$a'>$a</option>";
}
echo "</select>";
?>
</select></td>
</tr>
<tr>
<td> </td>
<td align="right">Email</td>
<td>:
<label><span id="sprytextfield4">
<input type="text" name="in_email" id="in_email" />
<span class="textfieldRequiredMsg">Please input Email.</span></span></label></td>
</tr>
<tr>
<td> </td>
<td align="right">Password</td>
<td>:
<label><span id="sprytextfield5">
<input type="password" name="in_pass" id="in_pass" />
<span class="textfieldRequiredMsg">Please input Password.</span></span></label></td>
</tr>
<tr>
<td> </td>
<td align="right">Confirm Password</td>
<td>:
<label><span id="sprytextfield6">
<input type="password" name="in_con_pass" id="in_con_pass" />
<span class="textfieldRequiredMsg">Please input Confirm Password.</span></span></label></td>
</tr>
<tr>
<td height="29"> </td>
<td align="right" valign="top">Captcha Verify </td>
<td align="left" valign="top"><label><?php dsp_crypt(0,1); ?> :
<span id="sprytextfield7">
<input type="text" name="in_captcha" id="in_captcha" />
<span class="textfieldRequiredMsg">Please input Confirm Captcha.</span></span><br />
</label></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><label>
<input type="submit" name="button2" id="button2" value="ลงทะเบียน" />
<input type="reset" name="button3" id="button3" value="Reset" />
</label></td>
</tr>
</table>
<p> </p>
</form>
<script type="text/javascript">
<!--
var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1");
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4");
var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5");
var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6");
var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7");
//-->
</script>
</body>
</html>
Tag : PHP, WebService
|
|
|
|
|
|
Date :
2012-03-27 16:24:56 |
By :
big |
View :
1186 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ส่วนนี้หน้า check_reg.php
Code (PHP)
<?
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>check_reg</title>
<style type="text/css">
<!--
body {
background-image: url(images/Android_.jpg);
}
body, td, th {
font-family: Times New Roman, Times, serif;
font-size: 24px;
color: #0000FF;
font-weight: bold;
}
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<br />
<table width="421" height="83" border="0" align="center">
<tr valign="middle">
<td width="426" align="center"><?
include("config.php");
$sex=$_POST["in_sex"];
$name=$_POST["in_name"];
$last_n=$_POST["in_last_n"];
$day=$_POST["day"];
$mont=$_POST["mount"];
$year=$_POST["year"];
$date="$day/$mont/$year";
$mail=$_POST["in_email"];
$pass=$_POST["in_pass"];
$con_pass=$_POST["in_con_pass"];
if($pass==$con_pass && isset($pass)){
$sql = "insert into member(Sex,Name,Lastname,Date,Email,Password)
values ('$sex','$name','$last_n','$date','$mail','$pass')";
$result = mysql_query($sql) or die (mysql_error());
if($result){
echo "บันทึกข้อมูลเรียบร้อยแล้ว";
?>
<meta http-equiv="refresh" content="3;URL=index.php" />
<?
}else {
echo "เกิดข้อผิดพลาดในการบันทึกข้อมูล กรุณาลงทะเบียนใหม่";
?>
<meta http-equiv="refresh" content="3;URL=index.php" />
<?
}
}//end if
?>
</td>
</tr>
</table>
</form>
</body>
</html>
|
|
|
|
|
Date :
2012-03-27 16:26:11 |
By :
big |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|