I am working on authentication for my schools username and password. The school has its own backend script to use for form POST. It allows some hidden inputs with specific names for customization, for example, page redirecting on success. However, I can't have any session_start()
or any of my php code on that page because after the login.php
, the login page gets redirected to the schools page and then gets redirected back to my index.php
. The post value gets passed through to the index.php
but on page refresh, it goes back to the login page because the session is not saved with the post value.
Any help on this will very helpful.
Index.php
<?php
session_start();
$_SESSION['username'] = $_POST['sid'];
if(!isset($_SESSION['username'])){
header("Location: login.php");
} else {
?>
// HTML here
<?php
}
?>
Login.php
<form action="authenticator.pl" name="form1" method="POST">
// Using hidden inputs I specify which page to redirect to... These are specific hidden inputs that are accepted.
</form>