Change Word after login

I really need help I am new to php and would like to know how I could change some words after some1 has finished logging in. Here is the code below.

[php] <?php
if (!isset($_SESSION[‘login’])) {

        ?>
      <li><?php if($_REQUEST['tp'] == '' || $_REQUEST['tp'] == 'home') echo "<img src=\"".$templateFolder."images/icons/golden_offer.png\" valign=\"absmiddle\" border=\"0\"> "; ?><a href="index.php"<?php if($_REQUEST['tp'] == '' || $_REQUEST['tp'] == 'home') echo ' class="active"'; ?>><span>Home</span></a></li>

      <li><?php if($_REQUEST['tp'] == 'news') echo "<img src=\"".$templateFolder."images/icons/hot.png\" valign=\"absmiddle\" border=\"0\"> "; ?><a href="index.php?tp=news"<?php if($_REQUEST['tp'] == 'news') echo ' class="active"'; ?>><span>News</span></a></li>


          } else {

        }

      <li><?php if($_REQUEST['tp'] == 'advertise') echo "<img src=\"".$templateFolder."images/icons/cart.png\" valign=\"absmiddle\" border=\"0\"> "; ?><a href="index.php?tp=advertise"<?php if($_REQUEST['tp'] == 'advertise') echo ' class="active"'; ?>><span>Advertise</span></a></li>


      <li><?php if($_REQUEST['tp'] == 'howtoearn') echo "<img src=\"".$templateFolder."images/icons/dollar.png\" valign=\"absmiddle\" border=\"0\"> "; ?><a href="index.php?tp=howtoearn"<?php if($_REQUEST['tp'] == 'howtoearn') echo ' class="active"'; ?>><span>Ways to Earn</span></a></li>


      <li><?php if(strtolower($_REQUEST['tp']) == 'viewads') echo "<img src=\"".$templateFolder."images/icons/present.png\" valign=\"absmiddle\" border=\"0\"> "; ?><a href="index.php?tp=viewAds"<?php if(strtolower($_REQUEST['tp']) == 'viewads') echo ' class="active"'; ?>><span>View Ads</span></a></li>



           <li><a href="index.php?tp=member" <?php if($_REQUEST['tp'] == 'member' || $_REQUEST['tp'] == 'user') echo "<img src=\"".$templateFolder."images/icons/key.png\" valign=\"absmiddle\" border=\"0\"> "; ?><?php echo ' class="active"';?>><span>Members Area</span></a></li>

        <li><a href="index.php?tp=signup" <?php if($_REQUEST['tp'] == 'signup') echo "<img src=\"".$templateFolder."images/icons/ok.png\" valign=\"absmiddle\" border=\"0\"> ";?>> <span>Get Started</span></a></li>
    </ul>
        }[/php]

This is for my navigation bar I just want to know how to change words after login

Thanks!

P.S I am a beginner =)

Are you looking to do something like have a message on the top that says “Welcome, [Name]!”? If so, you could have something like this:
[php]if (count($_SEESION[‘login’] >= $charCount) { //This a way of checking that someone’s username is at least the minimum length you are allowing. You could use any number of arguments in this statement.
echo “Welcome, $_SESSION[‘login’]! Click Here to Logout”; //Change to match your page
} else {
echo ‘Welcome, guest! Click Here to Login’; //Change to match your page
}[/php]

Even if that was not your intended purpose, it could be used for similar purposes. Let me know if this is at all helpful

im looking to have something like this if some1 is not logged in it says Sign up if some1 is logged in it says Members area.

I use SESSION variables for this. When a user longs in, you set a SESSION variable to indicate this.
Something like:
session_start(); // Start the session…
$_SESSION[‘userid’]=""; // Set this to nothing…
// **** here do login with the current SESSION’s userid set to nothing…
// **** if login is completed…
$_SESSION[‘userid’]=$the_users_id_name; (Obviously, this is in your login page)

That would set a SESSION variable called “userid” to the current user’s id name. Then, you can use it in every
other page for checking if they are logged in. Something like this:
session_start(); // Start the session, must be first PHP line on each PHP page…
if($_SESSION[‘userid’]=""){
echo “You have not logged in…”; Or, use the header command to switch to the login page…
}else{
echo “You are logged in, continue…”; Or, whatever you want to allow them to do…
}

So, this way, you could check to see if the userid is an admin and allow them to hidden pages.
You would do this in your menu area where if the userid was an admin, it would display additional
menu selections…

Well, hope that helps… Good luck!

Sponsor our Newsletter | Privacy Policy | Terms of Service