473,748 Members | 6,161 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

login session not behaving

27 New Member
HI,

I hope someone can help. I'm trying to show the username of the logged in user on this menu.inc page and certain pages only when logged in.

The result I have with the code below is no username showing, just "Hi !" (the "login" link disappear as planned) and all pages showing (logged and un-logged)

thank you for your help

Expand|Select|Wrap|Line Numbers
  1.            <div style="margin-bottom: 0px; margin-left: auto; margin-right: auto; margin-top: 0px; overflow: visible;">
  2.  
  3.  
  4.             <div align="center">
  5.             <table border="0">
  6.               <tr>
  7.                 <th>
  8.                 <span class="small">
  9.                 <?php if ($_SESSION["loggedInUser"] == $_SESSION["userCakeUser"]) { ?>Hi <strong><?php echo $_SESSION[$userdetails["Username"]]; ?>
  10.  
  11.             !
  12.  
  13.                 <?php } else { ?><a href="login.php">Login</a>
  14.                 <?php } ?>
  15.                 </span>  </th>
  16.  
  17.               </tr>
  18.               <tr>
  19.                 <td> 
  20.                 <span class="small">           
  21.                 <?php if ($_SESSION['loggedInUser'] == $_SESSION["userCakeUser"]) { ?><a href="logout.php">Logout</a>
  22.  
  23.                 <?php } else { ?>Register <a href="register.php" class="text_left">here </a>to download full mixes<?php } ?>
  24.                 </span>
  25.                    </td>
  26.               </tr>
  27.              </table>
  28.              </div>
  29.  
  30.             <hr width=600px>
  31.  
  32.             <a href="<?php echo $main_path; ?>index.php">Welcome</a><a href="
  33.             <?php echo $main_path; ?>Bio.php">Bio</a>
  34.  
  35.               <!--logged-in-->         
  36.             <?php if ($_SESSION['loggedInUser'] == $_SESSION["userCakeUser"]) { ?>
  37.  
  38.             <a href="<?php echo $main_path; ?>Mixes.php">Mixes</a>
  39.  
  40.  
  41.             <a href="<?php echo $main_path; ?>Production.php">Production</a>
  42.  
  43.             <?php } ?>
  44.  
  45.             <!--not-logged-in-->         
  46.             <?php if ($_SESSION['loggedInUser'] == NULL) { ?>
  47.  
  48.             <a href="<?php echo $main_path; ?>mixes_unlogged.php">Mixes</a>
  49.  
  50.             <a href="<?php echo $main_path; ?>production_unlogged.php">Production</a>
  51.  
  52.             <?php } ?>
  53.  
  54.             <a href="<?php echo $main_path; ?>Contact.php">Contact</a>
  55.             <a href="<?php echo $main_path; ?>links.php">Links</a>
  56.             <hr width=500px> 
Jan 6 '10
22 2875
macdalor
27 New Member
ok, is there anything you can suggest for me to get this sorted at all? apologies for my ignorance on the subject...
Jan 6 '10 #21
Dormilich
8,658 Recognized Expert Moderator Expert
not very much, I fear. I’d look, where and why the assignment didn’t work.
Jan 6 '10 #22
macdalor
27 New Member
for everyone's info, this was sorted by replacing $_SESSION["userCakeUs er"] by "1"
Jan 9 '10 #23

Sign in to post your reply or Sign up for a free account.

Similar topics

3
3570
by: Tom | last post by:
Hi I have a web application using asp.net and c#. User has to login to the application with his username and pwd. However, I do not allow other user uses the same username and pwd to login, i.e. one set of login ID cannot be used for twice except the logged in user's session has expired or he exited the system and terminate the session (Session.Clear();). Here is the C# code in my login cs file = obj; //I created a session here after...
19
2541
by: Siobhan | last post by:
Hi What is the recommended way to store a user's database credentials across the pages of a web application so that each time the database is accessed the system doesn't have to ask them for their username and password again We have previously stored these in a session variable (encrypted) and retrieved from their - but are worried about the impact on performance if the number of users increases. Had thought about cookies but worried...
18
3396
by: Gleep | last post by:
I've searched google intensely on this topic and it seems noone really knows how to approch this. The goal I don't want clients to give out their usernames and passwords to friends, since the site relies on subscrption fees. Sessions ID's are matched between the browser and the server. So a users can login with same username and password and those sessions are tracked individually. Some suggest create table fields with the session ID...
6
4696
by: BizWorld | last post by:
Hi, I have a scenario where i need to configure only Login.aspx page to use SSL. All other application will run on HTTP protocol. If someone can guide me how to accomplish this. One of my idea is to keep login.aspx page in a seperate Virtual director and apply SSL only on that directory but i dont know if it will have an impact on session (may be it will create two sessions due to two different virtual directories). If some one can...
0
1141
by: John Meyer | last post by:
index: <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.OleDb" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server">
5
1845
by: simon | last post by:
well i have admin panel and agent panel. when i open admin panel and log in it works fine. but when agent opens agent panel in different pc and login and acts something like open a page or so, both admin panel and agent panel expires session and asks for re-login. What would be possible reason for this? Please anyone can help !!! platform: OS: windows 2000 server, IIS 6.0 Script : ASP, Javascript
9
3593
by: Ben | last post by:
Hello, I'll bet this has been asked a million times but I can't seem to find a thread that gives the clear example I need. This PC has MySQL and IIS configured and running. The MySQL database is "myDB" with a table "myUsers" with fields "Username" and "Password". I also have the MySQL ODBC driver loaded with a DSN "dsnMySQL" setup. First question is can someone direct me to a site or provide a sample code for a login page that...
6
2280
by: =?Utf-8?B?S2VsbHk=?= | last post by:
We just switched our web application from .NET 1.1 to 2. Once client can't login out of several that have been successful. They enter a correct user name and password, click the login button and they are redirected back to login with no errors or login failure. The same login account works fine from other machines at different locations. This client had no problem logging in before we switched. The login procedures are essentially the...
9
7811
by: Josh | last post by:
I run a Joomla website and am familiar with php in some but not all aspects. Currently I am trying to find some solutions related to session handling. Am I correct in saying that "login" is kept in sessions? I can see active sessions in my mysql database, but is that the only place this information is stored? Sessions and cookies I know are related also, but how specifically (session info stored in cookies?)? Right now, when users...
0
8828
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9243
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2213
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.