From 555f2886080333b10df9812777c36c04ae6b93bc Mon Sep 17 00:00:00 2001 From: Joe Robinson Date: Tue, 5 Aug 2014 17:36:28 +0100 Subject: Set cookie to use current domain, made URL configurable --- index.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index ed2cdc9..2c5af4e 100644 --- a/index.php +++ b/index.php @@ -2,19 +2,20 @@ $pass = 'REPLACE THIS WITH A SHA256 HASH OR SET VARIABLE TO NULL'; $indexignore = array(); $headerfile = "upload.html"; +$url = "http://www.blaupload.co.uk/"; if ($_POST && $pass) { if ((hash("sha256", $_POST['password']) == $pass)) { if (isset($_POST['rememberme'])) { /* Set cookie to last 1 year */ - setcookie('password', hash("sha256", $_POST['password']), time()+60*60*24*365, '/', 'www.blaupload.co.uk'); + setcookie('password', hash("sha256", $_POST['password']), time()+60*60*24*365, '/', $_SERVER['SERVER_NAME'] ); } else { /* Cookie expires when browser closes */ - setcookie('password', hash("sha256", $_POST['password']), false, '/', 'www.blaupload.co.uk'); + setcookie('password', hash("sha256", $_POST['password']), false, '/', $_SERVER['SERVER_NAME'] ); } - header('Location: http://www.blaupload.co.uk/'); + header('Location: ' . $url); } else { - header('Location: http://www.blaupload.co.uk/'); + header('Location: ' . $url); exit(); } } else if ($pass) { -- cgit v1.2.3