-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpetition_sign.php
More file actions
52 lines (41 loc) · 1.31 KB
/
petition_sign.php
File metadata and controls
52 lines (41 loc) · 1.31 KB
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
<?php
echo "<!-- ";
print_r($_POST);
echo " --> ";
$inputName = $_POST['inputName'];
$inputEmail = $_POST['inputEmail'];
$inputAdresse = $_POST['inputAdresse'];
$inputOrt = $_POST['inputOrt'];
$inputLand = $_POST['inputLand'];
if (!isset($_POST['inputName'])) {
$error = 1;
}
$inputAnonym = 0;
if (isset($_POST['inputAnonym'])) {
$inputAnonym = 1;
}
if (strlen($_POST['email']) > 0) {
// spam, no human would fill in this field
echo "nt";
exit();
}
if (strlen($inputName) < 4) {
$error = 1;
}
if (!($stmt = $mysqli->prepare("INSERT INTO unterzeichner(name, email, ort, adresse, land, anonym) VALUES (?, ?, ?, ?, ?, ?)"))) {
echo "Prepare failed: (" . $stmt->errno . ") " . $stmt->error;
$error = 1;
}
$stmt->bind_param("ssssss", $inputName, $inputEmail, $inputOrt, $inputAdresse, $inputLand, $inputAnonym);
if (!$stmt->execute()) {
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
$error = 1;
}
$mysqli->close();
if (!$error) {
echo "<h2>Vielen Dank für Ihre Unterstützung!</h2>";
echo "<p><a href='//www.kamerascheu.at' title='zu kamerascheu.at' >zurück zur Website</a></p>";
} else {
echo "<h2>Ein unvorhergesehener Fehler ist aufgetreten. :(</h2>";
echo '<p><a href="?t=petition">Zurück</a>.</p>';
}