/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 16:08:02 UTC
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: gustav.hartvigsson@gmail.com-20130413160802-jkas2lmtm8u3zsyh
Started work on the add user form.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html>
 
2
<html>
 
3
<head>
 
4
    <title>Extreme Dating - Create User</title>
 
5
<head>
 
6
<?php
 
7
include "php/db.php";
 
8
if($_POST['hiddenStuff'] == "Something Strange") {
 
9
  $password = sha1($_POST['password']."salt");
 
10
  //If there is a $_POST that indicates that the add userscript should be run.
 
11
  $query = "";
 
12
  if ($_POST['isSuperUser'] == true && $_SESSION['userType'] == 1) {
 
13
    $query = "INSERT INTO Users (
 
14
    loginName,
 
15
    shadow,
 
16
    firstName,
 
17
    surName,
 
18
    eMail,
 
19
    city,
 
20
    userType
 
21
    )
 
22
    
 
23
    VALUES(
 
24
    '{$_POST['name']}',
 
25
    '{$password}',
 
26
    '{$_POST['firstName']}',
 
27
    '{$_POST['surName']}',
 
28
    '{$_POST['eMail']}',
 
29
    '{$_POST['city']},
 
30
    '1'
 
31
    );";
 
32
  } else {
 
33
    $query = "INSERT INTO Users (
 
34
    loginName,
 
35
    shadow,
 
36
    firstName,
 
37
    surName,
 
38
    eMail,
 
39
    city
 
40
    )
 
41
    
 
42
    VALUES(
 
43
    '{$_POST['name']}',
 
44
    '{$password}',
 
45
    '{$_POST['firstName']}',
 
46
    '{$_POST['surName']}',
 
47
    '{$_POST['eMail']}',
 
48
    '{$_POST['city']}
 
49
    );";
 
50
  }
 
51
} else {
 
52
 
 
53
?>
 
54
  <body id="wrapper">
 
55
                <div id="profile">
 
56
    <h1> Create a new user </h1>
 
57
    <hr \>
 
58
        <form action="./adduser.php">
 
59
          <table border="0">
 
60
            <?php
 
61
              if($_SESSION['userType'] == 1 ) {
 
62
                //you are a superuser!
 
63
                //you can add other superusers.
 
64
            ?>
 
65
            <tr>
 
66
              <td> <label for="user"> Is the user a Super User? </label> </td>
 
67
              <td> <input type="checkbox" name="isSuperUser" id="super" \> </td>
 
68
            </tr>
 
69
            <?php
 
70
              }
 
71
            ?>
 
72
            <tr>
 
73
              <td> <label for="name"> User Name </label> </td>
 
74
              <td> <input type="input" name="name" id="name" /> </td>
 
75
            </tr>
 
76
            <tr>
 
77
              <td> <label for="passwd"> Password </label> </td>
 
78
              <td> <input type="password" name="passwd" id="passwd" /> </td>
 
79
            </tr>
 
80
            <tr>
 
81
              <td> <label for="firstname"> First Name </label> </td>
 
82
              <td> <input type="input" name="firstName" id="firstname" /> </td>
 
83
            </tr>
 
84
            <tr>
 
85
              <td> <label for="surname"> Sur Name </label> </td>
 
86
              <td> <input type="input" name="surName" id="surname" /> </td>
 
87
            </tr>
 
88
            <tr>
 
89
              <td> <label for="email"> E-mail </label> </td>
 
90
              <td> <input type="input" name="eMail" id="email" /> </td>
 
91
            </tr>
 
92
            <tr>
 
93
              <td> <label for="city"> City </label> </td>
 
94
              <td> <input type="input" name="city" id="city" /> </td>
 
95
            </tr>
 
96
            <input name="hiddenStuff" value="Something Strange" type="hidden" \>
 
97
            <input id="input" type="submit" action="./adduser.php" />
 
98
          </table>
 
99
        </form>
 
100
      <?php
 
101
}
 
102
      ?>
 
103
    </div>
 
104
  </body>
 
105
</html>