/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 19:41:34 UTC
  • mto: This revision was merged to the branch mainline in revision 31.
  • Revision ID: gustav.hartvigsson@gmail.com-20130413194134-wjqiqn4815o2elzd
Added profile image to the adduser.php file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
  $password = sha1($_POST['passwd']."salt");
10
10
  //If there is a $_POST that indicates that the add userscript should be run.
11
11
  $query = "";
 
12
  $handel = $_FILES["file"]["temp_file"];
 
13
  $output = "";
 
14
  if ($handle) {
 
15
      while (($buffer = fgets($handle, 4096)) !== false) {
 
16
        $buffer = str_replace("&", "&", $buffer);
 
17
        $buffer = str_replace("<", "&lt;", $buffer);
 
18
        $buffer = str_replace(">", "&gt;", $buffer);
 
19
      $output .= $buffer;
 
20
     }
 
21
      if (!feof($handle)) {
 
22
      $output .= "Error: unexpected fgets() fail\n";
 
23
        }
 
24
    fclose($handle);
 
25
  }
 
26
 
12
27
  if (isset($_SESSION['userType']) && $_POST['isSuperUser'] == true && $_SESSION['userType'] == 1) {
13
28
    $query = "INSERT INTO Users (
14
29
    loginName,
17
32
    surName,
18
33
    eMail,
19
34
    city,
 
35
    profileImage,
20
36
    userType
21
37
    )
22
38
    
27
43
    '{$_POST['surName']}',
28
44
    '{$_POST['eMail']}',
29
45
    '{$_POST['city']}',
 
46
    '{$output}',
30
47
    '1'
31
48
    );";
32
49
  } else {
36
53
    firstName,
37
54
    surName,
38
55
    eMail,
39
 
    city
 
56
    city,
 
57
    profileImage
40
58
    )
41
59
    
42
60
    VALUES(
46
64
    '{$_POST['surName']}',
47
65
    '{$_POST['eMail']}',
48
66
    '{$_POST['city']}'
 
67
    '{$output}'
49
68
    );";
50
69
  }
51
70
  $db->exec($query);
58
77
  <body id="wrapper">
59
78
                <div id="profile">
60
79
    <h1> Create a new user </h1>
61
 
    <hr \>
 
80
    <hr />
62
81
        <form action="./adduser.php" method="POST">
63
82
          <table border="0">
64
83
            <?php
68
87
            ?>
69
88
            <tr>
70
89
              <td> <label for="user"> Is the user a Super User? </label> </td>
71
 
              <td> <input type="checkbox" name="isSuperUser" id="super" \> </td>
 
90
              <td> <input type="checkbox" name="isSuperUser" id="super" /> </td>
72
91
            </tr>
73
92
            <?php
74
93
              }
97
116
              <td> <label for="city"> City </label> </td>
98
117
              <td> <input type="input" name="city" id="city" /> </td>
99
118
            </tr>
100
 
                        <tr>
 
119
            <tr>
 
120
              <td> <label for="file"> City </label> </td>
 
121
              <td> <input type="file" name="file" id="file" /> </td>
 
122
            </tr>
 
123
                              <tr>
101
124
              <td><input name="hiddenStuff" value="Something Strange" type="hidden"/></td>
102
125
              <td><input id="input" type="submit" action="./adduser.php" value="Registera mig"/></td>
103
 
                        </tr>
 
126
                              </tr>
104
127
          </table>
105
128
        </form>
106
129
      <?php