473,663 Members | 2,877 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Remember Username & Password

15 New Member
At present I'm using $_SESSION['UserName'] to create and store the login details. But I'm not able to access this session variable. Is there any way for the website to remember these details?

[PHP]$count=mysql_nu m_rows($result) ;
// If result matched $myusername and $mypassword, table row must be 1 row

if($count==1){
// Register $myusername, $mypassword and redirect to file "LoginOK.ph p"
session_start() ;
session_registe r("myusername") ;
session_registe r("mypassword") ;
$_SESSION['loginname'] = $myusername;
//echo $_session['loginname'];
header("locatio n:index.php");
}[/PHP]

I'm using <?php echo $_session['loginname']; in index.php. Is there anything wrong with the code?
Mar 15 '08 #1
5 2596
Markus
6,050 Recognized Expert Expert
Like was said in your last post: if you dont start the session on index.php you weill not be able to retrieve the session variables.
Mar 15 '08 #2
webgenius
15 New Member
Like was said in your last post: if you dont start the session on index.php you weill not be able to retrieve the session variables.
I've started the session in all the pages now. Still it doesn't work.
Mar 15 '08 #3
ronverdonk
4,258 Recognized Expert Specialist
What makes you so sure that [php]if($count==1){[/code] return true?

Ronald
Mar 16 '08 #4
webgenius
15 New Member
problem solved. Had used $_session instead of $_SESSION. Didn't know it was case-sensitive.
Mar 16 '08 #5
ronverdonk
4,258 Recognized Expert Specialist
Good you found that out yourself. See you around.

Ronald
Mar 16 '08 #6

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

Similar topics

15
7651
by: Joshua Beall | last post by:
Hi All, What is the best way to use a cookie to remember a logged in user? Would you store the username and password in two separate cookies? Should the password be plain text? Hashed? Not there at all? Any feedback would be helpful. Thanks! -Josh
4
6062
by: Lobang Trader | last post by:
Hi all, I am trying to create a username and a password class. I would like to know what are the RECOMMENDED minimum and maximum length for both fields? These fields will be something like this: private static final int DEFAULT_MINIMUM_LENGTH = ??????
3
2408
by: laredotornado | last post by:
Hello, I have a simple login script. I have the pages login.php login_response.php login_success.php login_failure.php What I want to do is have a checkbox on the login.php page where if the user checks it and logs in successfully, upon closing the browser and returning to the login.php page, they are automatically redirected to
2
3036
by: Shakun | last post by:
Hi All, This is my 1st posting to this group. Can any1 help me with the "Remember Me" which is there in a login form. Im pasting the code below. Im not able to set a cookie.. Thanks, Shakun Vohra
0
1178
by: gujarsachin2001 | last post by:
hello friends i m connecting to http or https url programatically through console application using follwoing methods of credentilas but if there is username & password for that url through this code I m able to download files from that url using "DefaultCredentials" but i want to use password and username to access resources if tht url contains. & if for tht specific url if user enters wrong username & password so tht he must not able...
1
1631
by: gujarsachin2001 | last post by:
hello friends i m connecting to http or https url programatically through console application using follwoing methods of credentilas but if there is username & password for that url through this code I m able to download files from that url using "DefaultCredentials" but i want to use password and username to access resources if tht url contains. & if for tht specific url if user enters wrong username & password so tht he must not...
0
2989
by: sanbm79 | last post by:
Hi All, I am facing a problem in posting Web request with username and password credentials. I am working on migrating Java client application to .Net which will send request to Java servlet. Java Client application code: HttpClient httpclient; httpclient = new HttpClient();
0
1308
by: Frank Miverk | last post by:
Hi, I am not understanding how the Remember Me checkbox is supposed to work here. I have a LoginCtrl (asp.net 2.0, framework 2.0) and all I want to do is remember the user the next time if they previously checked the Remember Me checkbox. By default, on subsequent visits the Remember Me checkbox does not stay checked. I understand that checking this checkbox, allows me to create a cookie using FormsAuthentication.SetAuthCookie(...
13
6071
by: Dhiru1009 | last post by:
Hi guys, I have created a login system where user can enter their username and password which when validated will take user to new page with his or her name displayed on the screen, now I want to create a "Remember me" feature in my login screen so that when user select remember me it will remember user name everytime he or she opens the browser and remained logged in until they click on logout. I know it can be accomplished by using Session...
0
8436
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
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
8771
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
7371
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5657
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
4349
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2763
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
2000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1757
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.