-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfmreg.php
75 lines (75 loc) · 1.79 KB
/
fmreg.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
if (isset($_POST['submit']))
{
$username = $_POST['username'];
$nama_lengkap = $_POST['nama_lengkap'];
$e_mail = $_POST['e_mail'];
$password = $_POST['password'];
$alamat = $_POST['alamat'];
include('koneksi.php');
//cek apakah username kosong
if (trim($username)=='' OR trim($password)=='')
{
echo "User name atau password belum berisi data, registrasi gagal...";
}
else
{
//cek apakah kata kunci sudah ada di database
$sql = "select * from tbpengguna where username = '$username'";
$data = mysql_query($sql);
if (mysql_num_rows($data)>0)
{
echo "Username ini sudah dipakai oleh orang lain. coba ulangi dengan username lain";
}
else
{
$sql = "insert into tbpengguna set username = '$username',
nama_lengkap ='$nama_lengkap',
e_mail = '$e_mail',
password = '$password',
alamat = '$alamat'";
mysql_query($sql);
echo "Data pengguna baru sudah di simpan";
}
}
}
else
{
?>
<form action="registrasi.php" method="post">
<table>
<tr>
<td>User Name</td>
<td>:</td>
<td><input type="text" maxlength="30" size="30" name="username"/></td>
</tr>
<tr>
<td>Nama Lengkap</td>
<td>:</td>
<td><input type="text" maxlength="30" size="30" name="nama_lengkap"/></td>
</tr>
<tr>
<td>E-Mail</td>
<td>:</td>
<td><input type="text" maxlength="30" size="30" name="e_mail"/></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input type="password" maxlength="30" size="30" name="password"/></td>
</tr>
<tr>
<td>Alamat</td>
<td>:</td>
<td><input type="text" maxlength="30" size="30" name="alamat"/></td>
</tr>
<tr>
<td></td>
<td></td>
<td><input type="submit" maxlength="20" size="20" name="submit"/></td>
</tr>
</table>
</form>
<?php
}
?>