/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: Daniel Johansson
  • Date: 2013-04-13 23:34:25 UTC
  • mfrom: (39.1.6 extremedating)
  • Revision ID: maila@danieljohansson.nu-20130413233425-n22i2t83x552leuh
Merger

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