Skip to content

Instantly share code, notes, and snippets.

@lucas-marciano
Last active July 12, 2017 00:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucas-marciano/c5c1b55341b8ce1789743ade3a01d08e to your computer and use it in GitHub Desktop.
Save lucas-marciano/c5c1b55341b8ce1789743ade3a01d08e to your computer and use it in GitHub Desktop.
<?
/*Codigo original*/
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
header("Location: http://www.google.com");
exit();
} elseif (isset($_COOKIE['Loggedin']) && $_COOKIE['Loggedin'] == true) {
header("Location: http://www.google.com");
exit();
}
?>
<?php
/*Codigo refatorado*/
if ((isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) ||
isset($_COOKIE['Loggedin']) && $_COOKIE['Loggedin'] == true) {
header("Location: http://www.google.com");
exit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment