-
Notifications
You must be signed in to change notification settings - Fork 0
/
reg.php
executable file
·90 lines (72 loc) · 1.53 KB
/
reg.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<html>
<title> REGISTRATION RESULT</title>
<body>
<?php
//include 'sql.php';
include 'stdinc.php';
$user=$_POST["username"];
$pw=$_POST["password"];
$pw2 = $_POST["password2"];
$firstname=$_POST["firstname"];
$lastname=$_POST["lastname"];
$age=$_POST["age"];
$SUCCESS=1;
if ($pw == "" )
{
print "ERROR!!! password can not be blank<br>";
$SUCCESS=0;
}
if ($user == "" )
{
print "ERROR!!! must enter a username<br>";
$SUCCESS=0;
}
if( $pw != $pw2 )
{
print "password missmatch<br>";
$SUCCESS=0;
}
if ($firstname == "" )
{
print "ERROR!!! must enter a first name<br>";
$SUCCESS=0;
}
if ($lastname == "" )
{
print "ERROR!!! must enter a last name<br>";
$SUCCESS=0;
}
if ($age == "" )
{
print "ERROR!!! must enter an age<br>";
$SUCCESS=0;
}
if( $SUCCESS == 0 )
{
plogin();
exit;
}
$query='select max(id) from users';
//print $query;
$result=mysql_query($query);
if($row1=mysql_fetch_array($result))
{
$newid = $row1[0]+1;
$query2="insert into users values (" . $newid . ",'" . $user . "','" . $pw . "','" . $firstname . "','" . $lastname . "'," . $age . ")";
// print $query2;
$exists = mysql_query("select * from users where username = '" . $user . "'" );
if (mysql_fetch_array($exists))
{
print "ERROR!!!! user exists!!!<br>";
plogin();
exit;
}
mysql_query($query2);
print "SUCCESSFULLY REGISTERED " . $user . " as " . $lastname . ", " . $firstname . " age: " . $age;
//print "userid = " . $row1['id'] . "<br>";
}
?>
<br>
<a href="login.php"> Logout</a>
</body>
</html>