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
4
<title>Extreme Dating - Create User</title>
24
5
<link rel="stylesheet" type="text/css" href="css/main.css"/>
25
6
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
29
9
include "php/db.php";
30
include "php/salt.php";
31
include "php/stupid_image.php";
33
ini_set("post_max_size","16M");
34
ini_set("upload_max_filesize","16M");
35
ini_set("memory_limit","64M");
37
10
if(isset($_POST['hiddenStuff']) && $_POST['hiddenStuff'] == "Something Strange") {
38
$password = sha1($_POST['passwd'].$pwd_salt);
11
$password = sha1($_POST['passwd']."salt");
39
12
//If there is a $_POST that indicates that the add userscript should be run.
42
if(isset($_FILES["image"]["tmp_name"])){
15
if(!isset($_FILES["image"]["tmp_name"])){
43
16
$tmpFile = $_FILES["image"]["tmp_name"];
44
17
$handle = fopen($tmpFile,"r");
45
18
$fileSize = $_FILES['image']['size'];
46
$output = fread($handle, filesize($tmpFile));
47
$image = new Imagick();
48
$image->readImageBlob($output);
49
$image = stupid_convert_and_rescale($image, 280, 280, 'png');
21
//echo $_FILES["image"]["tmp_name"];
22
$output = $content = fread($handle, filesize($tmpFile));
50
23
$output = base64_encode ($output);
28
while (($buffer = fgets($handle, 4096)) !== false) {
29
//$buffer = str_replace("&", "&", $buffer);
30
//$buffer = str_replace("<", "<", $buffer);
31
//$buffer = str_replace(">", ">", $buffer);
35
$output .= "Error: unexpected fgets() fail\n";
52
43
if (isset($_SESSION['userType']) && $_POST['isSuperUser'] == true && $_SESSION['userType'] == 1) {
53
44
$query = "INSERT INTO Users (