This repository has been archived by the owner on Mar 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tmp.php
48 lines (36 loc) · 1.58 KB
/
tmp.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
<?php
session_start();
include_once 'dbconnect.php';
connectDB();
parse_str($_SERVER["QUERY_STRING"], $data);
$data['client'] = $data['customerName']; // FIXME hack
$chars = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ';
$data['hash'] = substr(str_shuffle($chars), 0, 5);
## Get the username from the userId
$q1 = "select name from users where id = '" . $_SESSION['usr_id'] . "'";
$res = mysqli_query($db, $q1);
$row = mysqli_fetch_assoc($res);
$data['user'] = $row['name'];
$fields = array('user','client','rhEmail','country','lob','o1','o2','o3','o4','o5','d1','d2','d3','d4','d5','hash','share','contact','project','comments','comments_transparency','comments_inclusivity','comments_adaptability','comments_collaboration','comments_community');
foreach ($fields as $field) {
$$field = mysqli_real_escape_string($db, $data[$field]);
}
if (!isset ($share)) {
$share = "off";
}
$qq = "INSERT INTO open_data (" . implode(',', $fields).") VALUES ('$user','$client','$rhEmail','$country','$lob',$o1,$o2,$o3,$o4,$o5,$d1,$d2,$d3,$d4,$d5,'$hash','$share','$contact','$project','$comments','$comments_transparency','$comments_inclusivity','$comments_adaptability','$comments_collaboration','$comments_community')";
$result = mysqli_query($db, $qq);
if (!$result) {
printf("Errormessage: %s\n", mysqli_error($db));
exit;
}
# Check the referer to see if we need to go to english or russian
if (preg_match('/lang=ru/', $_SERVER['HTTP_REFERER'])) {
## Russian
header("Location: results-ru.php?hash=$hash");
} else {
## English
header("Location: results.php?hash=$hash");
}
#header("Location: results.php?hash=$hash");
?>