4
ExtremeDating - a Hackathon 2013 project.
5
Copyright (C) 2013 Gustav Hartvigsson <gustav.hartvigsson@gmail.com>
6
Copyright (C) 2013 Daniel Johansson <maila@danieljohansson.nu>
9
This program is free software: you can redistribute it and/or modify
10
it under the terms of the GNU Affero General Public License as
11
published by the Free Software Foundation, either version 3 of the
12
License, or (at your option) any later version.
14
This program is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
GNU Affero General Public License for more details.
19
You should have received a copy of the GNU Affero General Public License
20
along with this program. If not, see <http://www.gnu.org/licenses/>.
23
<title>Extreme Dating - Create User</title>
24
<link rel="stylesheet" type="text/css" href="css/main.css"/>
25
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
29
include "php/salt.php";
30
if(isset($_POST['hiddenStuff']) && $_POST['hiddenStuff'] == "Something Strange") {
31
$password = sha1($_POST['passwd'].$pwd_salt);
32
//If there is a $_POST that indicates that the add userscript should be run.
35
if(isset($_FILES["image"]["tmp_name"])){
36
$tmpFile = $_FILES["image"]["tmp_name"];
37
$handle = fopen($tmpFile,"r");
38
$fileSize = $_FILES['image']['size'];
39
$output = fread($handle, filesize($tmpFile));
40
$output = base64_encode ($output);
42
if (isset($_SESSION['userType']) && $_POST['isSuperUser'] == true && $_SESSION['userType'] == 1) {
43
$query = "INSERT INTO Users (
57
'{$_POST['firstName']}',
58
'{$_POST['surName']}',
65
$query = "INSERT INTO Users (
78
'{$_POST['firstName']}',
79
'{$_POST['surName']}',
87
} catch (PDOException $err) {
90
echo "<body> <h1> New user added! </h1> </body>";
92
header("Location:./index.php");
99
<h1> Create a new user </h1>
101
<form action="./adduser.php" method="POST" enctype="multipart/form-data">
104
if(isset($_SESSION['userType']) && $_SESSION['userType'] == 1 ) {
105
//you are a superuser!
106
//you can add other superusers.
109
<td> <label for="user"> Is the user a Super User? </label> </td>
110
<td> <input type="checkbox" name="isSuperUser" id="super" /> </td>
116
<td> <label for="name"> User Name </label> </td>
117
<td> <input type="input" name="name" id="name" /> </td>
120
<td> <label for="passwd"> Password </label> </td>
121
<td> <input type="password" name="passwd" id="passwd" /> </td>
124
<td> <label for="firstname"> First Name </label> </td>
125
<td> <input type="input" name="firstName" id="firstname" /> </td>
128
<td> <label for="surname"> Sur Name </label> </td>
129
<td> <input type="input" name="surName" id="surname" /> </td>
132
<td> <label for="email"> E-mail </label> </td>
133
<td> <input type="input" name="eMail" id="email" /> </td>
136
<td> <label for="city"> City </label> </td>
137
<td> <input type="input" name="city" id="city" /> </td>
140
<td> <label for="file"> City </label> </td>
141
<td> <input type="file" name="image" id="image" /> </td>
144
<td><input name="hiddenStuff" value="Something Strange" type="hidden"/></td>
145
<td><input id="inputbutton1" type="submit" action="./adduser.php" value="Registera mig"/></td>