forked from ferchang/reg8log
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode_gather_request_entropy.php
More file actions
28 lines (18 loc) · 1.21 KB
/
Copy pathcode_gather_request_entropy.php
File metadata and controls
28 lines (18 loc) · 1.21 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
<?php
if(ini_get('register_globals')) exit("<center><h3>Error: Turn that damned register globals off!</h3></center>");
if(!isset($parent_page)) exit("<center><h3>Error: Direct access denied!</h3></center>");
require $index_dir.'include/config/config_crypto.php';
if(isset($store_request_entropy_probability2)) $store_request_entropy_probability=$store_request_entropy_probability2;
@$request_entropy=sha1(microtime().$pepper.$_SERVER['REMOTE_ADDR'].$_SERVER['REMOTE_PORT'].$_SERVER['HTTP_USER_AGENT'].serialize($_POST).serialize($_GET).serialize($_COOKIE));
/* using the entropy of GPC data was the idea of Jim Wigginton
(the author of the phpseclib library)
using them with the serialize function was also his idea.
using sha1 function for combining entropy of all requests was also his idea
see: http://www.frostjedi.com/phpbb/viewtopic.php?f=46&t=30875
*/
if(!$store_request_entropy_probability or !$db_installed) return;
if($store_request_entropy_probability!==1 and mt_rand(1, floor(1/$store_request_entropy_probability))!==1) return;
require_once $index_dir.'include/code/code_db_object.php';
$query="update `site_vars` set `value`=sha1(concat(`value`, '$request_entropy')) where name='entropy'";
$reg8log_db->query($query);
?>