/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 Hatvigsson
  • Date: 2013-04-13 22:52:37 UTC
  • mto: This revision was merged to the branch mainline in revision 43.
  • Revision ID: gustav.hartvigsson@gmail.com-20130413225237-jrj7reb6e932zson
fixed the user images! that only took a fow houres -_-...

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
  $password = sha1($_POST['passwd']."salt");
12
12
  //If there is a $_POST that indicates that the add userscript should be run.
13
13
  $query = "";
14
 
  $handle = @fopen($_FILES["image"]["tmp_name"]);
15
 
  $output = "NULL";
 
14
  $tmpFile = $_FILES["image"]["tmp_name"];
 
15
  $handle = fopen($tmpFile,"r");
 
16
  $fileSize = $_FILES['image']['size'];
 
17
  var_dump ($handle);
 
18
  //var_dump($_FILES);
 
19
  //echo $_FILES["image"]["tmp_name"];
 
20
  $output = $content = fread($handle, filesize($tmpFile));
 
21
  $output = base64_encode ($output);
 
22
  //$output = NULL;
 
23
  /*
16
24
  if ($handle) {
17
25
      while (($buffer = fgets($handle, 4096)) !== false) {
18
 
        $buffer = str_replace("&", "&", $buffer);
19
 
        $buffer = str_replace("<", "&lt;", $buffer);
20
 
        $buffer = str_replace(">", "&gt;", $buffer);
 
26
      //$buffer = str_replace("&", "&amp;", $buffer);
 
27
      //$buffer = str_replace("<", "&lt;", $buffer);
 
28
      //$buffer = str_replace(">", "&gt;", $buffer);
21
29
      $output .= $buffer;
22
30
     }
23
31
      if (!feof($handle)) {
24
32
      $output .= "Error: unexpected fgets() fail\n";
25
33
        }
26
34
    fclose($handle);
 
35
    var_dump($output);
27
36
  }
 
37
  */
 
38
  
28
39
 
29
40
  if (isset($_SESSION['userType']) && $_POST['isSuperUser'] == true && $_SESSION['userType'] == 1) {
30
41
    $query = "INSERT INTO Users (
69
80
    '{$output}'
70
81
    );";
71
82
  }
 
83
  try {
72
84
  $db->exec($query);
 
85
  } catch (PDOException $err) {
 
86
    var_dump($err);
 
87
  }
73
88
  echo "<body> <h1> New user added! </h1> </body>";
74
89
  sleep(.5);
75
 
  header("Location:./index.php");
 
90
  //header("Location:./index.php");
76
91
} else {
77
92
 
78
93
?>
81
96
        <div id="frame">
82
97
    <h1> Create a new user </h1>
83
98
    <hr />
84
 
        <form action="./adduser.php" method="POST">
 
99
        <form action="./adduser.php" method="POST"enctype="multipart/form-data">
85
100
          <table border="0">
86
101
            <?php
87
102
              if(isset($_SESSION['userType']) && $_SESSION['userType'] == 1 ) {