-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig.php
More file actions
executable file
·31 lines (26 loc) · 875 Bytes
/
config.php
File metadata and controls
executable file
·31 lines (26 loc) · 875 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
<?php
$con = mysqli_connect('localhost','othproduction', 'oth123');
//if connection fails
if (!$con)
{
echo "cannot connect to database";
}
else
{
//select database
$db = mysqli_select_db($con, 'othproduction') or die("problem selecting database '$MYSQL[DATABASENAME]'");
}
function clean($string) {
$string = preg_replace('/[^A-Za-z0-9\-+ \\\\]/', '', $string); // Removes special chars.
return preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
}
function clean_nospace($string) {
$string = str_replace(' ', '_', $string); // Replaces all spaces with underscore.
$string = preg_replace('/[^A-Za-z0-9\-_]/', '', $string); // Removes special chars.
return preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
}
function redirect($page) {
header('Location: ' . $page);
exit;
}
?>