/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";
29
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
 
30
37
if(isset($_POST['hiddenStuff']) && $_POST['hiddenStuff'] == "Something Strange") {
31
38
  $password = sha1($_POST['passwd'].$pwd_salt);
32
39
  //If there is a $_POST that indicates that the add userscript should be run.
37
44
    $handle = fopen($tmpFile,"r");
38
45
    $fileSize = $_FILES['image']['size'];
39
46
    $output = fread($handle, filesize($tmpFile));
 
47
    $image = new Imagick();
 
48
    $image->readImageBlob($output);
 
49
    $image = stupid_convert_and_rescale($image, 280, 280, 'png');
40
50
    $output = base64_encode ($output);
41
51
  }
42
52
  if (isset($_SESSION['userType']) && $_POST['isSuperUser'] == true && $_SESSION['userType'] == 1) {
82
92
    '{$output}'
83
93
    );";
84
94
  }
 
95
  $success = NULL;
85
96
  try {
86
 
  $db->exec($query);
 
97
    $db->exec($query);
 
98
    $success = true;
87
99
  } catch (PDOException $err) {
 
100
    echo "<pre>";
88
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");
89
110
  }
90
 
  echo "<body> <h1> New user added! </h1> </body>";
91
 
  sleep(.5);
92
 
  header("Location:./index.php");
93
111
} else {
94
112
 
95
113
?>