/
neu.php
187 lines (160 loc) · 6.38 KB
/
neu.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?php
if($_GET)
{
session_start($_GET['PHPSESSID']);
}
require_once('classes/Database.class.php');
$update = 0 + $_GET['update'];
if($update)
{
$db = new Database();
$con = $db->connect();
$tmp = $db->userdatenselect($con, $_SESSION['userid']);
$result = $tmp->fetch_assoc();
}
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
// alle Variablen übernehmen
if($_POST['update']) $update = 0 + $_POST['update'];
$vorname = $_POST['Vorname'];
$name = $_POST['Name'];
$klasse = $_POST['Klasse'];
$raum = $_POST['Raum'];
$status = $_POST['Status'];
$email = strtolower($_POST['Email']);
$vorbildung = $_POST['Vorbildung'];
$passwort = $_POST['Passwort'];
$passwort2 = $_POST['Passwort2'];
$telefonnummer= $_POST['Telefonnummer'];
// Pflichtfelder prüfen
$ok=true;
if( $vorname=='' ) { $ok=false; $vornamefehlt = "<font color='red'>Bitte ausfüllen</font>"; }
if( $name=='' ) { $ok=false; $namefehlt = "<font color='red'>Bitte ausfüllen</font>"; }
if( $email=='' ) { $ok=false; $emailfehlt = "<font color='red'>Bitte ausfüllen</font>"; }
if( $passwort=='') { $ok=false; $passwortfehlt = "<font color='red'>Bitte ausfüllen</font>"; }
if( $passwort!=$passwort2 ) { $ok=false; $passwortfehlt = "<font color='red'>Bitte ausfüllen</font>"; }
// Ablegen in Datenbank
if( $ok==true )
{
$db = new Database();
$con = $db->connect();
$db->saniUpdaten($con, $update,
$_POST['Vorname'],
$_POST['Name'],
$_POST['Klasse'],
$_POST['Raum'],
$status,
$_POST['Telefonnummer'],
strtolower($_POST['Email']),
$_POST['Vorbildung'],
md5($_POST['Passwort']),
$_SESSION['userid']);
$result = $_POST;
}
else
{
$result = $_POST;
}
//header("Location: profilBearbeiten.php?PHPSESSID=" . $_GET['PHPSESSID']);
}
include_once('header.php');
echo '
<div class="container">
<form action="neu.php?PHPSESSID='. $_GET['PHPSESSID'].'" method="post">
<div class="form-group">
<label>Vorname* (Pflichtfeld) '. $vornamefehlt .'</label>
<input type="text" class="form-control" name="Vorname" value="'.$result['Vorname'].'">
</div>
<div class="form-group">
<label>Name* (Pflichtfeld) '. $namefehlt .'</label>
<input type="text" class="form-control" name="Name" value="'.$result['Name'].'">
</div>
<div class="form-group">
<label>Klasse</label>
<input type="date" class="form-control" name="Klasse" value="'.$result['Klasse'].'">
</div>
<div class="form-group">
<label>Raum <font color=green size=1> Neu</font> </label>
<input type="text" class="form-control" name="Raum" value="'.$result['Raum'].'">
</div>';
echo '
<div class="form-group">
<label>Status: </label> <i> TagessprecherIn für:</i> ';
echo '<input type="radio" name="Status" value="1" ';
if ($result['Status'] == 1) echo ' checked="checked" ';
echo '> Mo </input> ';
echo '<input type="radio" name="Status" value="2" ';
if ($result['Status'] == 2) echo ' checked="checked" ';
echo '> Di </input> ';
echo '<input type="radio" name="Status" value="3" ';
if ($result['Status'] == 3) echo ' checked="checked" ';
echo '> Mi </input> ';
echo '<input type="radio" name="Status" value="4" ';
if ($result['Status'] == 4) echo ' checked="checked" ';
echo '> Do </input> ';
echo '<input type="radio" name="Status" value="5" ';
if ($result['Status'] == 5) echo ' checked="checked" ';
echo '> Fr </input> ';
//echo '<input type="radio" name="Status" value="0" ';
//if ($result['Status'] == NULL or $result['Status'] == 0 ) echo ' checked="checked" ';
//echo '> bin kein Tagessprecher </input> ';
echo ' <b>...bzw...</b> <input type="radio" name="Status" value="-1" ';
if ($result['Status'] == -1) echo ' checked="checked" ';
echo '> freiwilliges aktives SMV-Mitglied</input> ';
echo '<input type="radio" name="Status" value="-2" ';
if ($result['Status'] == -2) echo ' checked="checked" ';
echo '> externer SMV-Supporter</input> ';
echo '<input type="radio" name="Status" value="-3" ';
if ($result['Status'] == -3) echo ' checked="checked" ';
echo '> Lehrer</input> ';
echo '<font color=green size=1> Neu </font>';
echo '
<div class="form-group">
<label>Teams: </label>';
$db = new Database();
$con = $db->connect();
$kw_result = $db->select_all_teams($con);
while ($row = $kw_result->fetch_assoc())
{
$tid = $row['tid'];
$team = $row['bezeichnung'];
echo '<input type="checkbox" name="Teams[]" value="'.$tid.'"> '.$team.' </input> ';
/*
if (0)
{
echo '<input selected="selected" value="'.$team'">'.$team.' </option>';
}
else
{
echo '<option value="'.$team.'">'.$team.' </option>';
}
*/
}
echo '<font color=red size=1> Teams funktionieren noch nicht ... ich arbeite dran :)</font>';
echo '
</div>
<div class="form-group">
<label>Bemerkungen</label>
<input type="text" class="form-control" name="Vorbildung" value="'.$result['Vorbildung'].'">
</div>
<div class="form-group">
<label>private Handynummer</label>
<input type="text" class="form-control" name="Telefonnummer" value="'.$result['Telefonnummer'].'">
</div>
<div class="form-group">
<label>Email* (Pflichtfeld) '. $emailfehlt .'</label>
<input type="email" class="form-control" name="Email" value="'.$result['Email'].'">
</div>
<div class="form-group">
<label>Neues oder altes Passwort* (Pflichtfeld) '. $passwortfehlt .' ... hier kann man das Passwort ändern</label>
<input type="password" class="form-control" name="Passwort">
</div>
<div class="form-group">
<label>Passwort wiederholen* (Pflichtfeld) '. $passwortfehlt .' </label>
<input type="password" class="form-control" name="Passwort2">
</div>
<input type="hidden" name=update value=' . $update . '>
<button type="submit" class="btn btn-primary" name="speichern" value="speichern">Speichern</button>
</form>
</div>';
require_once('footer.php');
?>