Cannot Get the user to stay ACTIVE! can't get "home" button to return "home"
Hello All! So when I created a "home" button and a "Return to member page" button, BUT when the user clicks on the button it doesn't go back to their page, it logs them out and returns them to the index page. Why? How do I keep a user active so that they can be returned to their page?
Thank you so much, this is one of the last hurtles I have.
PHP Code:
#!/usr/lib/php5/bin/php
<?php
session_start();
// If magic quotes is turned on then strip slashes
if (get_magic_quotes_gpc()) {
foreach ($_POST as $key => $value) {
$_POST[$key] = stripslashes($value);
}
}
$message="";
if(isset($_POST["login"])){
// Extract form submission
$theusername = (isset($_POST["username"]))?$_POST["username"]:"";
$thepassword = (isset($_POST["password"]))?$_POST["password"]:"";
include("socialfunctions.php");
if (is_valid_login($theusername, $thepassword)) {
// store username obtained from the form as a session variable
$_SESSION['username'] = $theusername;
// store ip of the client as a session variable
$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
// any other data needed to navigate the site or
// to authenticate the user can be added here
login($theusername);
// include member page
include("socialmemberpage.inc");
}
else{
// redirect user to index page
header("location:index.php");
}
}
else if(isset($_POST["postMessage"]) && strcmp($_SESSION['ip'], $_SERVER['REMOTE_ADDR']) == 0){
It looks like this script sends the user to index.php if no action is specified, if it isn't a login, post message, delete, or logout. Is that what it's supposed to do?
This line is usually used for command line scripts. Is it in all your scripts?
I really don't know too much about that line and the command line scripts; however, I believe you are correct about the if statements. I was wondering if you know how to write an if statement with those that says logically
If I am away from the member page and want to get back, I click on the link in the above navigation, if that link is clicked (socialmemberpage.php) then load that social member page and do not load the index.php.
I am wondering if this is possible if I have a href for the link...