diff --git a/scp/login.php b/scp/login.php
index 4356aaa615683ce2f1f292fe98cc15fa9773fee5..20f53938e163334af2db7e8f83d2d0e450ac35fa 100644
--- a/scp/login.php
+++ b/scp/login.php
@@ -29,7 +29,8 @@ if($_POST) {
     $username = trim($_POST['userid']);
     if ($user = StaffAuthenticationBackend::process($username,
             $_POST['passwd'], $errors)) {
-        @header("Location: $dest");
+        session_write_close();
+        Http::redirect($dest);
         require_once('index.php'); //Just incase header is messed up.
         exit;
     }
diff --git a/view.php b/view.php
index 2398fff5628b9e0f380d38d53304352e650ecf66..b8590aab4f5ddaa25f004123dbfcbae950965a2a 100644
--- a/view.php
+++ b/view.php
@@ -16,16 +16,13 @@
 **********************************************************************/
 require_once('client.inc.php');
 
+// Try autologin the user
+// Authenticated user can be of type ticket owner or collaborator
+$errors = array();
+$user =  UserAuthenticationBackend::processSignOn($errors);
+if ($user && $user->getTicketId())
+    Http::redirect('tickets.php?id='.$user->getTicketId());
 
-//If the user is NOT logged in - try auto-login (if params exists).
-if (!$thisclient || !$thisclient->isValid()) {
-    // Try autologin the user
-    // Authenticated user can be of type ticket owner or collaborator
-    $errors = array();
-    $user =  UserAuthenticationBackend::processSignOn($errors);
-    if ($user && $user->getTicketId())
-        @header('Location: tickets.php?id='.$user->getTicketId());
-}
 //Simply redirecting to tickets.php until multiview is implemented.
 require('tickets.php');
 ?>