0

in index.php i have 3 urls
<li><a href="categories.php">Categories</a></li>
<li><a href="Register.php">Register</a></li>
<li><a href="login.php">Login</a></li>

how do i change the text when i login, the "Register" will change into "Control Panel" and "Login" will become "Logout"?

when i click logout, the control panel & logout will change back to register & login

Edited by pocix

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by pocix
0

Well, have you got a login script that handles if the user has entered the correct details? If this is the case, you can use sessions to determine whether or not the user is signed in, or not.. And then which link/data you want the user to see

0

yes i have it

<?php 
require "config.php";


if($_SERVER['REQUEST_METHOD'] == "POST") 
{
     $result = mysql_query("SELECT * FROM user WHERE username='" . $_POST['username'] . "'AND password='" . $_POST['password'] . "' ");
     if(mysql_num_rows($result) > 0)
     {
     $_SESSION['is_logged_in'] = 1;
     }
}

if(!isset($_SESSION['is_logged_in'])) 
{
    // i'm still confuse how to change the text in this part 
} 
else 
{
    header("location:index.php");

if(empty($_SESSION['inputcaptcha'] ) ||
      strcasecmp($_SESSION['inputcaptcha'], $_POST['inputcaptcha']) != 0)
    {       
     print("<script language='javascript'>alert('error: The validation code does not match!'); location.href='login.php';</script>");
    }

}
?>

this is the text in index page, i want change the register and login button to control panel & logout when the user has signed in

<li><a href="categories.php">Categories</a></li>
<li><a href="Register.php">Register</a></li>
<li><a href="login.php">Login</a></li>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.