/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 09:30:20 UTC
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: maila@danieljohansson.nu-20130413093020-s4t7ci899tigorea
Added csses, index.php and image folder

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(isset($_POST['hiddenStuff']) && $_POST['hiddenStuff'] == "Something Strange") {
9
 
  $password = sha1($_POST['passwd']."salt");
10
 
  //If there is a $_POST that indicates that the add userscript should be run.
11
 
  $query = "";
12
 
  if (isset($_SESSION['userType']) && $_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
 
  $db->exec($query);
52
 
  echo "<body> <h1> New user added! </h1> </body>";
53
 
  sleep(.5);
54
 
} else {
55
 
 
56
 
?>
57
 
  <body id="wrapper">
58
 
                <div id="profile">
59
 
    <h1> Create a new user </h1>
60
 
    <hr \>
61
 
        <form action="./adduser.php" method="POST">
62
 
          <table border="0">
63
 
            <?php
64
 
              if(isset($_SESSION['userType']) && $_SESSION['userType'] == 1 ) {
65
 
                //you are a superuser!
66
 
                //you can add other superusers.
67
 
            ?>
68
 
            <tr>
69
 
              <td> <label for="user"> Is the user a Super User? </label> </td>
70
 
              <td> <input type="checkbox" name="isSuperUser" id="super" \> </td>
71
 
            </tr>
72
 
            <?php
73
 
              }
74
 
            ?>
75
 
            <tr>
76
 
              <td> <label for="name"> User Name </label> </td>
77
 
              <td> <input type="input" name="name" id="name" /> </td>
78
 
            </tr>
79
 
            <tr>
80
 
              <td> <label for="passwd"> Password </label> </td>
81
 
              <td> <input type="password" name="passwd" id="passwd" /> </td>
82
 
            </tr>
83
 
            <tr>
84
 
              <td> <label for="firstname"> First Name </label> </td>
85
 
              <td> <input type="input" name="firstName" id="firstname" /> </td>
86
 
            </tr>
87
 
            <tr>
88
 
              <td> <label for="surname"> Sur Name </label> </td>
89
 
              <td> <input type="input" name="surName" id="surname" /> </td>
90
 
            </tr>
91
 
            <tr>
92
 
              <td> <label for="email"> E-mail </label> </td>
93
 
              <td> <input type="input" name="eMail" id="email" /> </td>
94
 
            </tr>
95
 
            <tr>
96
 
              <td> <label for="city"> City </label> </td>
97
 
              <td> <input type="input" name="city" id="city" /> </td>
98
 
            </tr>
99
 
                        <tr>
100
 
              <td><input name="hiddenStuff" value="Something Strange" type="hidden"/></td>
101
 
              <td><input id="input" type="submit" action="./adduser.php" value="Registera mig"/></td>
102
 
                        </tr>
103
 
          </table>
104
 
        </form>
105
 
      <?php
106
 
}
107
 
      ?>
108
 
    </div>
109
 
  </body>
110
 
</html>