-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb.php.dist
More file actions
37 lines (31 loc) · 925 Bytes
/
db.php.dist
File metadata and controls
37 lines (31 loc) · 925 Bytes
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
<?
$PHP_SELF = $_SERVER[PHP_SELF];
$link = mysql_connect("localhost", "XXXXX", "YYYYYYZZZZZZ")
or die("Keine Datenbankverbindung möglich!");
mysql_select_db("webssk_alumni")
or die("Auswahl der Datenbank fehlgeschlagen");
# returns the number of addresses of the given person
function count_addresses_person($pid) {
$query = "SELECT count(adressen.id) FROM personen,adressen WHERE personen.id = '$pid' AND personen.id = personen_id";
return getval($query);
}
# perform SQL query and return single value (first row, first column)
function getval($q) {
$r = mysql_query($q);
if(mysql_num_rows($r) > 0) {
$l = mysql_fetch_row($r);
return $l[0];
}
return;
}
function show_error() {
print "<!-- ".mysql_error()." -->";
}
function checkInjection($fieldValue) {
if(preg_match('/^\s+$/', $fieldValue) ||
preg_match('/[<>";]/', $fieldValue) ) {
return true;
}
return false;
}
?>