Redirect the login and signup pages to the dashboard if the user is already logged in

master
Sven Slootweg 11 years ago
parent a8b0aa42fe
commit 533be57cc6

@ -13,6 +13,12 @@
if(!isset($_APP)) { die("Unauthorized."); } if(!isset($_APP)) { die("Unauthorized."); }
if(!empty($_SESSION['user_id']))
{
flash_notice("You are already logged in.");
redirect("/dashboard");
}
if(!empty($_POST['submit'])) if(!empty($_POST['submit']))
{ {
if(empty($_POST['username'])) if(empty($_POST['username']))

@ -13,6 +13,12 @@
if(!isset($_APP)) { die("Unauthorized."); } if(!isset($_APP)) { die("Unauthorized."); }
if(!empty($_SESSION['user_id']))
{
flash_notice("You are already logged in.");
redirect("/dashboard");
}
if(!empty($_POST['submit'])) if(!empty($_POST['submit']))
{ {
if(empty($_POST['username']) || !preg_match("/^[a-zA-Z0-9-.]+$/", $_POST['username'])) if(empty($_POST['username']) || !preg_match("/^[a-zA-Z0-9-.]+$/", $_POST['username']))

Loading…
Cancel
Save