forked from ferchang/reg8log
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode_prevent_xsrf.php
More file actions
20 lines (18 loc) · 860 Bytes
/
Copy pathcode_prevent_xsrf.php
File metadata and controls
20 lines (18 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?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>");
if(!empty($_POST)) {
if(!isset($_COOKIE['reg8log_antixsrf_token4post'], $_POST['antixsrf_token']) or $_COOKIE['reg8log_antixsrf_token4post']!==$_POST['antixsrf_token']) {
$failure_msg='<h3>'.tr('XSRF prevention mechanism triggered!').'</h3>';
$no_specialchars=true;
require $index_dir.'include/page/page_failure.php';
exit;
}
}
else if(!isset($_COOKIE['reg8log_antixsrf_token4get'], $_GET['antixsrf_token']) or $_COOKIE['reg8log_antixsrf_token4get']!==$_GET['antixsrf_token']) {
$failure_msg='<h3>'.tr('XSRF prevention mechanism triggered!').'</h3>';
$no_specialchars=true;
require $index_dir.'include/page/page_failure.php';
exit;
}
?>