01.
<?
02.
mysql_connect(
"localhost"
,
"root"
,
"1234"
);
03.
mysql_select_db(
"my"
);
04.
05.
if
(trim(
$_POST
[
"user"
]) ==
""
)
06.
{
07.
echo
"Please input Username!"
;
08.
exit
();
09.
}
10.
11.
if
(trim(
$_POST
[
"pass"
]) ==
""
)
12.
{
13.
echo
"Please input Password!"
;
14.
exit
();
15.
}
16.
17.
if
(
$_POST
[
"cpass"
] !=
$_POST
[
"cpass"
])
18.
{
19.
echo
"Password not Match!"
;
20.
exit
();
21.
}
22.
23.
if
(trim(
$_POST
[
"fname"
]) ==
""
)
24.
{
25.
echo
"Please input Name!"
;
26.
exit
();
27.
}
28.
29.
$strSQL
=
"SELECT * FROM account WHERE acc_user = '"
.trim(
$_POST
['user
'])."'
";
30.
$objQuery
= mysql_query(
$strSQL
);
31.
$objResult
= mysql_fetch_array(
$objQuery
);
32.
if
(
$objResult
)
33.
{
34.
echo
"Username already exists!"
;
35.
}
36.
else
37.
{
38.
39.
if
(
copy
(
$_FILES
[
"picupload"
][
"tmp_name"
],
"picture/"
.
$_FILES
[
"picupload"
][
"name"
]))
40.
{
41.
$strSQL
=
"INSERT INTO account (acc_user,acc_pass,acc_fname,acc_lname,acc_email,acc_tel,acc_address,acc_st,acc_pic) VALUES ('"
.
$_POST
[
"user"
]."',
42.
'".$_POST["pass"]."'
,
43.
'".$_POST["fname"]."'
,
44.
'".$_POST["lname"]."'
,
45.
'".$_POST["email"]."'
,
46.
'".$_POST["tel"]."'
,
47.
'".$_POST["address"]."'
,
48.
'".$_POST["status"]."'
,
49.
'".$_FILES["picupload"]["name"]."'
50.
)";
51.
$objQuery
= mysql_query(
$strSQL
);
52.
}
53.
echo
"Register Completed!<br>"
;
54.
echo
"<br> Go to <a href='login.php'>Login page</a>"
;
55.
56.
}
57.
?>