/extremedating/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/extremedating/trunk

« back to all changes in this revision

Viewing changes to adduser.php

  • Committer: Gustav Hartvigsson
  • Date: 2013-04-15 16:46:05 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20130415164605-wnyjleu697qa5fc7
Made the uploaded files take less space in the databas, though the use of
a stupid scaling and croping algorithem.
Old files images stored in the database are cropped and farmated when outputed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
26
26
<head>
27
27
<?php
 
28
set_time_limit(0);
28
29
include "php/db.php";
 
30
include "php/salt.php";
 
31
include "php/stupid_image.php";
 
32
set_time_limit(60);
 
33
ini_set("post_max_size","16M");
 
34
ini_set("upload_max_filesize","16M");
 
35
ini_set("memory_limit","64M");
 
36
 
29
37
if(isset($_POST['hiddenStuff']) && $_POST['hiddenStuff'] == "Something Strange") {
30
 
  $password = sha1($_POST['passwd']."salt");
 
38
  $password = sha1($_POST['passwd'].$pwd_salt);
31
39
  //If there is a $_POST that indicates that the add userscript should be run.
32
40
  $query = "";
33
41
  $output = "";
36
44
    $handle = fopen($tmpFile,"r");
37
45
    $fileSize = $_FILES['image']['size'];
38
46
    $output = fread($handle, filesize($tmpFile));
 
47
    $image = new Imagick();
 
48
    $image->readImageBlob($output);
 
49
    $image = stupid_convert_and_rescale($image, 280, 280, 'png');
39
50
    $output = base64_encode ($output);
40
51
  }
41
52
  if (isset($_SESSION['userType']) && $_POST['isSuperUser'] == true && $_SESSION['userType'] == 1) {
81
92
    '{$output}'
82
93
    );";
83
94
  }
 
95
  $success = NULL;
84
96
  try {
85
 
  $db->exec($query);
 
97
    $db->exec($query);
 
98
    $success = true;
86
99
  } catch (PDOException $err) {
 
100
    echo "<pre>";
87
101
    var_dump($err);
 
102
    var_dump($query);
 
103
    echo "</pre>";
 
104
    $db->rollBack();
 
105
    $success = false;
 
106
  } if ($success) {
 
107
    echo "<body> <h1> New user added! </h1> </body>";
 
108
    sleep(1);
 
109
    header("Location:./index.php");
88
110
  }
89
 
  echo "<body> <h1> New user added! </h1> </body>";
90
 
  sleep(.5);
91
 
  header("Location:./index.php");
92
111
} else {
93
112
 
94
113
?>
136
155
              <td> <input type="input" name="city" id="city" /> </td>
137
156
            </tr>
138
157
            <tr>
139
 
              <td> <label for="file"> City </label> </td>
 
158
              <td> <label for="file"> Profile Image </label> </td>
140
159
              <td> <input type="file" name="image" id="image" /> </td>
141
160
            </tr>
142
161
                              <tr>