soulesschild
Supreme [H]ardness
- Joined
- Feb 18, 2007
- Messages
- 6,176
Hey folks!
So I have this piece of code that works on my home.php page, but if I try to add this same code to any other page, it just keeps redirecting to the login page->home page. Any idea why? Is it because the home.php should also POST the userID like the index login page does?
So I have this piece of code that works on my home.php page, but if I try to add this same code to any other page, it just keeps redirecting to the login page->home page. Any idea why? Is it because the home.php should also POST the userID like the index login page does?
Code:
<?php
include('header.php');
//check to see if the user has logged in
if(isset($_POST['userID'])){
// if it works display ID and allow access
$userID = $_POST['userID'];
echo "<strong>User ID: $userID</strong><br>";
}
else{
// if not logged in redirect to login page
header('Location: index.php');
};
?>