bzr branch
http://gegoxaren.bato24.eu/bzr/extremedating/trunk
14.1.1
by Gustav Hatvigsson
Started work on the add user form. |
1 |
<!DOCTYPE html>
|
2 |
<html> |
|
3 |
<head> |
|
30
by Daniel Johansson
Derping around |
4 |
<title>Extreme Dating - Create User</title> |
5 |
<link rel="stylesheet" type="text/css" href="css/main.css"/> |
|
6 |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> |
|
14.1.1
by Gustav Hatvigsson
Started work on the add user form. |
7 |
<head> |
8 |
<?php
|
|
9 |
include "php/db.php"; |
|
20.1.1
by Daniel Johansson
Fixed stuffz in adduser.php |
10 |
if(isset($_POST['hiddenStuff']) && $_POST['hiddenStuff'] == "Something Strange") { |
11 |
$password = sha1($_POST['passwd']."salt"); |
|
14.1.1
by Gustav Hatvigsson
Started work on the add user form. |
12 |
//If there is a $_POST that indicates that the add userscript should be run.
|
13 |
$query = ""; |
|
31.1.4
by Daniel Johansson
Merge |
14 |
$handle = @fopen($_FILES["image"]["tmp_name"]); |
15 |
$output = "NULL"; |
|
29.1.1
by Gustav Hatvigsson
Added profile image to the adduser.php file. |
16 |
if ($handle) { |
17 |
while (($buffer = fgets($handle, 4096)) !== false) { |
|
18 |
$buffer = str_replace("&", "&", $buffer); |
|
19 |
$buffer = str_replace("<", "<", $buffer); |
|
20 |
$buffer = str_replace(">", ">", $buffer); |
|
21 |
$output .= $buffer; |
|
22 |
}
|
|
23 |
if (!feof($handle)) { |
|
24 |
$output .= "Error: unexpected fgets() fail\n"; |
|
25 |
}
|
|
26 |
fclose($handle); |
|
27 |
}
|
|
28 |
||
20.1.1
by Daniel Johansson
Fixed stuffz in adduser.php |
29 |
if (isset($_SESSION['userType']) && $_POST['isSuperUser'] == true && $_SESSION['userType'] == 1) { |
14.1.1
by Gustav Hatvigsson
Started work on the add user form. |
30 |
$query = "INSERT INTO Users ( |
31 |
loginName,
|
|
32 |
shadow,
|
|
33 |
firstName,
|
|
34 |
surName,
|
|
35 |
eMail,
|
|
36 |
city,
|
|
29.1.1
by Gustav Hatvigsson
Added profile image to the adduser.php file. |
37 |
profileImage,
|
14.1.1
by Gustav Hatvigsson
Started work on the add user form. |
38 |
userType
|
39 |
)
|
|
40 |
|
|
41 |
VALUES(
|
|
42 |
'{$_POST['name']}', |
|
43 |
'{$password}', |
|
44 |
'{$_POST['firstName']}', |
|
45 |
'{$_POST['surName']}', |
|
46 |
'{$_POST['eMail']}', |
|
24
by Daniel Johansson
Fixed gegos errors |
47 |
'{$_POST['city']}', |
29.1.1
by Gustav Hatvigsson
Added profile image to the adduser.php file. |
48 |
'{$output}', |
14.1.1
by Gustav Hatvigsson
Started work on the add user form. |
49 |
'1'
|
50 |
);"; |
|
51 |
} else { |
|
52 |
$query = "INSERT INTO Users ( |
|
53 |
loginName,
|
|
54 |
shadow,
|
|
55 |
firstName,
|
|
56 |
surName,
|
|
57 |
eMail,
|
|
29.1.1
by Gustav Hatvigsson
Added profile image to the adduser.php file. |
58 |
city,
|
59 |
profileImage
|
|
14.1.1
by Gustav Hatvigsson
Started work on the add user form. |
60 |
)
|
61 |
|
|
62 |
VALUES(
|
|
63 |
'{$_POST['name']}', |
|
64 |
'{$password}', |
|
65 |
'{$_POST['firstName']}', |
|
66 |
'{$_POST['surName']}', |
|
67 |
'{$_POST['eMail']}', |
|
31.1.4
by Daniel Johansson
Merge |
68 |
'{$_POST['city']}', |
29.1.1
by Gustav Hatvigsson
Added profile image to the adduser.php file. |
69 |
'{$output}' |
14.1.1
by Gustav Hatvigsson
Started work on the add user form. |
70 |
);"; |
71 |
}
|
|
22.1.1
by Gustav Hatvigsson
forgot to let the database run the query. |
72 |
$db->exec($query); |
22.1.2
by Gustav Hatvigsson
forgot an ; |
73 |
echo "<body> <h1> New user added! </h1> </body>"; |
22.1.1
by Gustav Hatvigsson
forgot to let the database run the query. |
74 |
sleep(.5); |
24.1.1
by Gustav Hatvigsson
made the adduser page redirect to index.php. |
75 |
header("Location:./index.php"); |
14.1.1
by Gustav Hatvigsson
Started work on the add user form. |
76 |
} else { |
77 |
||
78 |
?>
|
|
79 |
<body id="wrapper"> |
|
30
by Daniel Johansson
Derping around |
80 |
<div id="profile"> |
81 |
<div id="frame"> |
|
14.1.1
by Gustav Hatvigsson
Started work on the add user form. |
82 |
<h1> Create a new user </h1> |
29.1.1
by Gustav Hatvigsson
Added profile image to the adduser.php file. |
83 |
<hr /> |
20.1.1
by Daniel Johansson
Fixed stuffz in adduser.php |
84 |
<form action="./adduser.php" method="POST"> |
14.1.1
by Gustav Hatvigsson
Started work on the add user form. |
85 |
<table border="0"> |
86 |
<?php
|
|
18.1.1
by Gustav Hatvigsson
fixed a few things. |
87 |
if(isset($_SESSION['userType']) && $_SESSION['userType'] == 1 ) { |
14.1.1
by Gustav Hatvigsson
Started work on the add user form. |
88 |
//you are a superuser!
|
89 |
//you can add other superusers.
|
|
90 |
?>
|
|
91 |
<tr> |
|
92 |
<td> <label for="user"> Is the user a Super User? </label> </td> |
|
29.1.1
by Gustav Hatvigsson
Added profile image to the adduser.php file. |
93 |
<td> <input type="checkbox" name="isSuperUser" id="super" /> </td> |
14.1.1
by Gustav Hatvigsson
Started work on the add user form. |
94 |
</tr> |
95 |
<?php
|
|
96 |
}
|
|
97 |
?>
|
|
98 |
<tr> |
|
99 |
<td> <label for="name"> User Name </label> </td> |
|
100 |
<td> <input type="input" name="name" id="name" /> </td> |
|
101 |
</tr> |
|
102 |
<tr> |
|
103 |
<td> <label for="passwd"> Password </label> </td> |
|
104 |
<td> <input type="password" name="passwd" id="passwd" /> </td> |
|
105 |
</tr> |
|
106 |
<tr> |
|
107 |
<td> <label for="firstname"> First Name </label> </td> |
|
108 |
<td> <input type="input" name="firstName" id="firstname" /> </td> |
|
109 |
</tr> |
|
110 |
<tr> |
|
111 |
<td> <label for="surname"> Sur Name </label> </td> |
|
112 |
<td> <input type="input" name="surName" id="surname" /> </td> |
|
113 |
</tr> |
|
114 |
<tr> |
|
115 |
<td> <label for="email"> E-mail </label> </td> |
|
116 |
<td> <input type="input" name="eMail" id="email" /> </td> |
|
117 |
</tr> |
|
118 |
<tr> |
|
119 |
<td> <label for="city"> City </label> </td> |
|
120 |
<td> <input type="input" name="city" id="city" /> </td> |
|
121 |
</tr> |
|
29.1.1
by Gustav Hatvigsson
Added profile image to the adduser.php file. |
122 |
<tr> |
123 |
<td> <label for="file"> City </label> </td> |
|
32
by Gustav Hatvigsson
Fixed a few things... |
124 |
<td> <input type="file" name="image" id="image" /> </td> |
29.1.1
by Gustav Hatvigsson
Added profile image to the adduser.php file. |
125 |
</tr> |
126 |
<tr> |
|
20.1.1
by Daniel Johansson
Fixed stuffz in adduser.php |
127 |
<td><input name="hiddenStuff" value="Something Strange" type="hidden"/></td> |
30
by Daniel Johansson
Derping around |
128 |
<td><input id="inputbutton1" type="submit" action="./adduser.php" value="Registera mig"/></td> |
33
by Gustav Hatvigsson
fixed merge errors, and indentation. |
129 |
</tr> |
14.1.1
by Gustav Hatvigsson
Started work on the add user form. |
130 |
</table> |
131 |
</form> |
|
132 |
<?php
|
|
133 |
}
|
|
134 |
?>
|
|
30
by Daniel Johansson
Derping around |
135 |
</div> |
14.1.1
by Gustav Hatvigsson
Started work on the add user form. |
136 |
</div> |
137 |
</body> |
|
138 |
</html> |