473,406 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Problem regarding session..

vikas1111
122 100+
Hi All..

I want to display who has logged in ...Like Logged in as "_______"..
or like the one on the top left corner of your screen.... Hello, xxxxx
For that i have included the following code in my loginpro page..

[PHP]

session_start();
include("session.inc.php");

if (login($_POST['txtname'],$_POST['txtpass']) == TRUE)
{
session_register("username");
$_SESSION['username'] = $_POST['txtname'];
}

[/PHP]


In the other pages i have written this code

[PHP]

<?php
include("session.inc.php");
Logged in as :<?php echo $_SESSION['username']; ?>
?>
[/PHP]

I am not able to display The login Name ..

How can i solve it???
Jun 3 '08 #1
3 1148
Atli
5,058 Expert 4TB
Did you forget the session_start() in the second page?

By the way, the use of the session_register() function is deprecated as of PHP 4.1.0.
You should just add elements to the $_SESSION array.
Jun 3 '08 #2
TheServant
1,168 Expert 1GB
Yeah, session_start() on the second page is all I can see. To follow on from Alti, you should just remove the line to register the variable:

[PHP]
... { session_register("username"); } //Remove this!
$_SESSION['username'] = $_POST['txtname'];
}
[/PHP]
Jun 3 '08 #3
vikas1111
122 100+
Thanks for both of you..

I removed register and included session start().. Now its working..
Jun 4 '08 #4

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

Similar topics

2
by: Mikael Östberg | last post by:
Hello all! I have this login function which doesn't work really well. I tried to do extend the built-in functionality in order to store things such as userName and email address in Session. ...
3
by: Aaron | last post by:
Why do my session values return to nothing on post back? I want to click a button and have the row, as in: dataset.table(0).rows(THIS ROW NUMBER IS WHAT I AM TALKING ABOUT), either increment or...
2
by: Dean R. Henderson | last post by:
For an ASP.NET web application, is there a way for one session (with appropriate security authorization) to set a HttpSessionState variable to point to another session and execute the Abandon...
8
by: Roger | last post by:
I have a question regarding the behaviour of sql with OR and fetch first 1 rows only : I have a table with data : ACNO NAME TELNO CITY ZIP 1000 ...
2
by: shivapadma | last post by:
The following is the front end code for searching , it takes data and searches from the database by the second code. FRONT END CODE: <html> <head> <meta http-equiv="Content-Language"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.