-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader.php
More file actions
42 lines (38 loc) · 1.05 KB
/
header.php
File metadata and controls
42 lines (38 loc) · 1.05 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
<?php
require_once("rb.php");
require_once("config.php");
R::setup("mysql:host=$dbhost;dbname=$dbname",$dbuser,$dbpass);
session_start();
function get_url_vars()
{
$params = array();
$parts = explode('/',$_SERVER['REQUEST_URI']);
for($i=3;$i<count($parts)-1;$i+=2){
$params[$parts[$i]]=$parts[$i+1];
}
$params["mode"]=$_SERVER['REQUEST_METHOD'];
return $params;
}
function strip_slashes_recursive($mixed){
if(is_string($mixed))
return stripslashes($mixed);
if(is_array($mixed))
foreach($mixed as $i=>$value)
$mixed[$i]=strip_slashes_recursive($value);
return $mixed;
}
function hasher($p){
$salt="";
for($i=0;$i<16;$i++)
$salt.=chr(rand(ord('@'),ord('~'))); //create a random 16 char string from ascii @ to ~
return crypt($p,'$5$rounds=5000$'.$salt.'$'); //$5 = SHA_256
}
function check_hash($p,$h){
return $h==crypt($p,$h);
}
if (get_magic_quotes_gpc()){ //!! ideally disable the magic
$_GET=strip_slashes_recursive($_GET);
$_POST=strip_slashes_recursive($_POST);
$_COOKIE=strip_slashes_recursive($_COOKIE);
}
?>