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

Recommended Answers

All 2 Replies

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

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>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.