01.
<?
02.
mysql_connect(
"localhost"
,
"root"
,
"1234"
);
03.
mysql_select_db(
"projectblack"
);
04.
if
(trim(
$_POST
[
"txtUsername"
]) ==
""
)
05.
{
06.
echo
"Please input Username!"
;
07.
print
"<meta http-equiv=refresh content=2;URL=signup.php>"
;
08.
exit
();
09.
}
10.
11.
if
(trim(
$_POST
[
"txtPassword"
]) ==
""
)
12.
{
13.
echo
"Please input Password!"
;
14.
print
"<meta http-equiv=refresh content=2;URL=signup.php>"
;
15.
exit
(); s
16.
}
17.
18.
if
(
$_POST
[
"txtPassword"
] !=
$_POST
[
"txtConPassword"
])
19.
{
20.
echo
"Password not Match!"
;
21.
print
"<meta http-equiv=refresh content=2;URL=signup.php>"
;
22.
exit
();
23.
}
24.
25.
if
(trim(
$_POST
[
"txtName"
]) ==
""
)
26.
{
27.
echo
"Please input Name!"
;
28.
print
"<meta http-equiv=refresh content=2;URL=signup.php>"
;
29.
exit
();
30.
}
31.
32.
$strSQL
=
"SELECT * FROM signup WHERE Username = '"
.trim(
$_POST
['txtUsername
'])."'
";
33.
$objQuery
= mysql_query(
$strSQL
);
34.
$objResult
= mysql_fetch_array(
$objQuery
);
35.
if
(
$objResult
)
36.
{
37.
echo
"Username already exists!"
;
38.
}
39.
else
40.
{
41.
42.
$strSQL
=
"INSERT INTO signup (Username,Password,Name,Status) VALUES ('"
.
$_POST
[
"txtUsername"
]."',
43.
'".$_POST["txtPassword"]."'
,
'".$_POST["txtName"]."'
,
'".$_POST["Status"]."'
)";
44.
$objQuery
= mysql_query(
$strSQL
);
45.
46.
echo
"Register Completed!<br>"
;
47.
print
"<meta http-equiv=refresh content=1;URL=signup.php>"
;
48.
49.
50.
}
51.
52.
mysql_close();
53.
?>