|
|
|
ช่วยดู code กำหนด password กรอกได้ 4-8 ตัวอักษร หน่อยครับ |
|
|
|
|
|
|
|
ช่วยดู code กำหนด password กรอกได้ 4-8 ตัวอักษร หน่อยครับ ปัญหามีอยู่ว่า โปรแกรมแจ้งว่ากรอก password ไม่ครบ แต่บันทึกไปในตารางได้ครับ
Code (PHP)
<?php require_once('Connections/stu.php'); ?>
<?php
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_stu, $stu);
mysql_query("SET NAMES 'UTF8'");
$query_Recordset1 = "SELECT * FROM telephone WHERE Status ='USER' ";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $stu) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
</head>
<script language="JavaScript" type="text/javascript">
function chkdel(){if(confirm(' กรุณายืนยันการลบอีกครั้ง !!! ')){
return true;
}else{
return false;
}
}
</script -->
<body>
<?
$objConnect = mysql_connect("localhost","xxxx","xxxx") or die("Error Connect to Database");
$objDB = mysql_select_db("xxxx");
//*** Add Condition ***//
if($_POST["hdnCmd"] == "Add")
{
$strSQL = "INSERT INTO telephone ";
mysql_query("SET NAMES TIS620");
$strSQL .="(telephone_ID,user,pass,t_name,t_surname,Status) ";
$strSQL .="VALUES ";
$strSQL .="('".$_POST["txtAddtelephone_ID"]."','".$_POST["txtAdduser"]."','".$_POST["txtAddpass"]."' ";
$strSQL .=",'".$_POST["txtAddt_name"]."','".$_POST["txtAddt_surname"]."','".$_POST["txtAddStatus"]."') ";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
$updateGoTo = "main.php?case_i=6";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
?>
</TD></TR>
<TR>
<TD align="middle">
<TABLE width="100%" border="0">
<TBODY>
<TR>
<TD align="middle">
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="2">
<tr>
<td><fieldset><legend> <b>» กำหนดผู้ใช้งาน</b></legend>
<table width="100%" border="1" align="center" cellpadding="3" cellspacing="0">
<tr>
<td height="5%" background="images/bg2.gif"><div align="center">ลำดับ</div></td>
<td background="images/bg2.gif"><div align="center">Username</div></td>
<td background="images/bg2.gif"><div align="center">Password</div></td>
<td background="images/bg2.gif"><div align="center">ชื่อ-สกุล</div></td>
<td background="images/bg2.gif"><div align="center">ตำแหน่ง</div></td>
<td background="images/bg2.gif"><div align="center">สถานะ</div></td>
<td colspan="2" background="images/bg2.gif"><div align="center">Edit</div> <div align="center"></div></td>
</tr>
<?php do { ?>
<tr>
<td height="30"><div align="center"><?php echo $row_Recordset1['Telephone_ID']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1['user']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1['pass']; ?></div></td>
<td><?php echo $row_Recordset1['t_name']; ?></td>
<td><?php echo $row_Recordset1['t_surname']; ?></td>
<td><div align="center"><?php echo $row_Recordset1['Status']; ?></div></td>
<td><div align="center"><a href="main.php?case_i=7&Telephone_ID=<?php echo $row_Recordset1['Telephone_ID']; ?>">Edit</a></div></td>
<td><div align="center">
<a href="main.php?case_i=8&Telephone_ID=<?php echo $row_Recordset1['Telephone_ID']; ?>"onclick="return confirm('กรุณายืนยันการลบอีกครั้ง !!!')">ลบ </a>
</div></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
</fieldset></td>
</tr>
</table></TD>
</TR>
<TR>
<TD valign="bottom" align="right"></TD></TR></TBODY></TABLE></TD></TR>
<TR valign="top">
<TD height="1" valign="top">
<form name="frmMain" action="main.php?case_i=6" method="post" OnSubmit="return chkString();">
<script language="JavaScript">
function chkString()
{
if(document.frmMain.txtAddpass.value.length < 4 || document.frmMain.txtAddpass.value.length > 10)
{
alert('Please input String [4-10 Character] .');
return false;
}
}
</script>
<input type="hidden" name="hdnCmd" value="">
<TR>
<TD align="middle">
<TABLE width="100%" border="0">
<TBODY>
<TR>
<TD align="middle">
<table width="50%" border="0" align="center" cellpadding="0" cellspacing="2">
<tr>
<td><fieldset><legend> <b>» เพิ่มผู้ใช้งาน</b></legend>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td width="20%" height="30" align="right" valign="baseline" nowrap="nowrap" bgcolor="#CCCCCC">Username :</td>
<td align="left"width="80%"> <input type="text" name="txtAdduser" size="32"> </td>
</tr>
<tr>
<td height="30" align="right" valign="baseline" nowrap="nowrap" bgcolor="#CCCCCC">Password :</td>
<td align="left"><input name="txtAddpass" type="text" id="txtAddpass" value="" size="32"></td>
</tr>
<tr>
<td height="30" align="right" valign="baseline" nowrap="nowrap" bgcolor="#CCCCCC">ชื่อ-สกุล :</td>
<td align="left"><input type="text" name="txtAddt_name" size="32"></td>
</tr>
<tr>
<td height="30" align="right" valign="baseline" nowrap="nowrap" bgcolor="#CCCCCC">ตำแหน่ง :</td>
<td align="left"><input type="text" name="txtAddt_surname" size="32"></td>
</tr>
<tr>
<td height="25" align="right" valign="baseline" nowrap="nowrap" bgcolor="#CCCCCC">สถานะ :</td>
<td align="left"><select name="txtAddStatus" id="txtAddStatus">
<option value="USER">USER</option>
</select></td>
</tr>
<tr>
<td height="30" bgcolor="#CCCCCC"> </td>
<td align="left"><input name="btnAdd" type="submit" id="btnAdd" value="บันทึก" onClick="frmMain.hdnCmd.value='Add';frmMain.submit('');">
<input type="reset" name="Reset" value="ยกเลิก">
</td>
</tr>
</table>
</fieldset></td>
</tr>
</table>
</TD>
</TR>
<TR>
<TD valign="bottom" align="right"></TD></TR></TBODY></TABLE></TD></TR>
<TR valign="top">
</form>
<?
mysql_close($objConnect);
?>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
Tag : PHP
|
|
|
|
|
|
Date :
2015-05-25 15:22:16 |
By :
panyaadd |
View :
3515 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JavaScript Count String Length
|
|
|
|
|
Date :
2015-05-25 20:45:05 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|