|
|
|
เรื่อง Ajax กับการ เช็ค PASSWORD กับ RE - PASSWORD |
|
|
|
|
|
|
|
<?php
$strUsername = trim($_POST["tUsername"]);
$strPassword = trim($_POST["tPassword"]);
$strName = trim($_POST["tName"]);
$strSurname = trim($_POST["tSurname"]);
$strGender = trim($_POST["rGender"]);
$strAdderss = trim($_POST["tAdderss"]);
$strEmail = trim($_POST["tEmail"]);
$strPhone = trim($_POST["tPhone"]);
//*** Check Username ***//
if(trim($strUsername) == "")
{
echo "<font color=red>**</font> Plase input [Username]";
exit();
}
//*** Check Password ***//
if(trim($strPassword) == "")
{
echo "<font color=red>**</font> Plase input [Password]";
exit();
}
//*** Check Name ***//
if(trim($strName) == "")
{
echo "<font color=red>**</font> Plase input [Name]";
exit();
}
//*** Check Surname ***//
if(trim($strSurname) == "")
{
echo "<font color=red>**</font> Plase input [Surname]";
exit();
}
//*** Check Gender ***//
if(trim($strGender) == "")
{
echo "<font color=red>**</font> Plase input [Gender]";
exit();
}
//*** Check Adderss ***//
if(trim($strAdderss) == "")
{
echo "<font color=red>**</font> Plase input [Adderss]";
exit();
}
//*** Check Email ***//
if(trim($strEmail) == "")
{
echo "<font color=red>**</font> Plase input [Email]";
exit();
}
//*** Check Phone ***//
if(trim($strPhone) == "")
{
echo "<font color=red>**</font> Plase input [Phone]";
exit();
}
$objConnect = mysql_connect("localhost","root","123321") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
//*** Check Username (already exists) ***//
$strSQL = "SELECT * FROM account WHERE Username = '".$strUsername."' ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$objResult = mysql_fetch_array($objQuery);
if($objResult)
{
echo "<font color=red>**</font> Username [$strUsername] already exists";
}
else
{
$strSQL = "INSERT INTO account ";
$strSQL .="(Username,Password,Name,Surname,Gender,Adderss,Email,Phone) ";
$strSQL .="VALUES ";
$strSQL .="('".$strUsername."','".$strPassword."' ";
$strSQL .=",'".$strName."','".$strSurname."','".$strGender."','".$strAdderss."','".$strEmail."','".$strPhone."') ";
$objQuery = mysql_query($strSQL);
if($objQuery)
{
echo "Y"; // Finish Register Return "Y"
}
else
{
echo "<font color=red>**</font> Can not register";
}
}
mysql_close($objConnect);
?>
|
|
|
|
|
Date :
2011-02-02 16:50:06 |
By :
somboon5131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|