From a00c1b4c9d5b10f19619b423bbb3a279177e1850 Mon Sep 17 00:00:00 2001 From: Timothy Allen Date: Thu, 24 Apr 2014 09:56:25 +0200 Subject: [PATCH] Fix some issues with secure cookies being overwritten by insecure site. Now, /publish/{edit,addeditor,login,logout} must be accessed via https://; other pages should not be (but can be). --- bottombar.inc.php | 1 + publish/addeditor.php | 3 +++ publish/edit.php | 5 ++++- publish/login.php | 16 ++++++++++++---- publish/logout.php | 5 ++++- publish/style.css | 1 + session.lib.php | 28 ++++++++++++++++------------ 7 files changed, 41 insertions(+), 18 deletions(-) diff --git a/bottombar.inc.php b/bottombar.inc.php index a1ff496..32da418 100644 --- a/bottombar.inc.php +++ b/bottombar.inc.php @@ -1,4 +1,5 @@

All stories and submissions © 2003– their respective authors.

+ diff --git a/publish/addeditor.php b/publish/addeditor.php index b56e319..5acc5b2 100644 --- a/publish/addeditor.php +++ b/publish/addeditor.php @@ -1,4 +1,7 @@ -
diff --git a/publish/login.php b/publish/login.php index 0a227cd..8e44cc1 100644 --- a/publish/login.php +++ b/publish/login.php @@ -1,11 +1,15 @@ query($query) or die("Query failed: ".$db->error()); $row = $getid->fetch_assoc(); - if (isset($row)) $stored_password = $row['password']; + if (isset($row)) + $stored_password = $row['password']; else $denied = TRUE; $getid->close(); open_db('close'); @@ -35,10 +40,13 @@ if (isset($_SESSION['editor'])) { $url .= $_SERVER['HTTP_HOST']; $url .= $_SESSION['referrer']; unset($_SESSION['referrer']); + session_write_close(); header("Location: $url"); return; } else { - header("Location: http://xxx.org.za/publish/edit"); + session_write_close(); + header("Location: https://xxx.org.za/publish/edit"); + return; } } } diff --git a/publish/logout.php b/publish/logout.php index 1e22545..c11235a 100644 --- a/publish/logout.php +++ b/publish/logout.php @@ -1,4 +1,7 @@ diff --git a/publish/style.css b/publish/style.css index 3e9b40c..43bb79c 100644 --- a/publish/style.css +++ b/publish/style.css @@ -10,6 +10,7 @@ input#remember { margin-left: -2px; margin-top: 7px; + width: inherit; } #story { diff --git a/session.lib.php b/session.lib.php index bac3504..651d2f3 100644 --- a/session.lib.php +++ b/session.lib.php @@ -1,17 +1,21 @@