function CheckAuthentication($checkLoggedIn = true) { if ($checkLoggedIn && !IsAuthenticated()) { print '<script type="text/javascript">'; print 'alert("You are not authenticated. Redirecting to home page.");'; print 'window.location.replace("index.php");'; print '</script>'; InvalidateAuth(); die; } else { if (!$checkLoggedIn && IsAuthenticated()) { print '<script type="text/javascript">'; print 'alert("You are authenticated. Redirecting you to the panel.");'; print 'window.location.replace("panel.php");'; print '</script>'; } } }
<?php /** * Created by PhpStorm. * User: Nima * Date: 7/23/2015 * Time: 10:11 AM */ include_once 'inc/auth.php'; InvalidateAuth(); print "<script type=\"text/javascript\">alert(\"You have been successfully logged out!\");</script>"; print "<script type=\"text/javascript\">window.location.replace(\"index.php\");</script>";