include_once 'classes/database_edits.class.php'; session_start(); if (strlen($_SESSION['username']) > 1) { header('Location: '.$_SESSION['account_type']); } if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) { if ( !empty($_POST['form_login_username']) && !empty($_POST['form_login_password']) ) { $func = new database_edits(); list($login_return_username, $login_return_type) = $func->login_main($_POST['form_login_username'], $_POST['form_login_password']); if ( strlen($login_return_username) > 0 ) { $_SESSION['username'] = $login_return_username; $_SESSION['account_type'] = $login_return_type; if ($login_return_type == 'youtuber') { header('Location: youtuber'); } else { header('Location: company'); } } else { $error_msg = 'Please check details!'; } } else { $error_msg = 'Please fill in details!'; } } ?>