473,396 Members | 2,002 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,396 software developers and data experts.

Presevre php variables from login from to every page

Please Help PHP GURS!
I have a login.php form. How do I allow that data on the login.php
form accessible to every page in my applicaton?

Login.php goes to Auth.php. In Auth.php, i can access the username and
password using the $_POST['user'] no problem. But how can I pass the
data that AUTH.php got from the LOGIN.php via a POST call to other
pages?

For instance, login.php passes data to auth.php via a form post. In
auth.php, how do i pass data to other php pages that it got?

in AUTH.php
I can do a header("Location: home.php?login=".$_POST['user'});
However, this will show the login name and password which is unsecure.
DO you have any tips or sample code for this php newb?

Please, if anyone knows how to solve this problem,
Please reply or email me at ne******@gmail.com and if you would like to
see my app please email me and i'll send you my app so that you can
take a look and see where i went wrong.
Thanks in advance Your Humble PHP NEWB!

Jul 17 '05 #1
5 1582
"ne******@gmail.com" <ne******@gmail.com> wrote in
news:11*********************@l41g2000cwc.googlegro ups.com:
Please Help PHP GURS!
I have a login.php form. How do I allow that data on the login.php
form accessible to every page in my applicaton?


Store the data in a database, or a file, or use session variables.

--
Dave Patton
Canadian Coordinator, Degree Confluence Project
http://www.confluence.org/
My website: http://members.shaw.ca/davepatton/
Jul 17 '05 #2
I noticed that Message-ID:
<Xn*********************************@24.71.223.159 > from Dave Patton
contained the following:
I have a login.php form. How do I allow that data on the login.php
form accessible to every page in my applicaton?


Store the data in a database, or a file, or use session variables.


But try session variables first. :-)

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #3
Geoff,
I did store it in the SESSION Variable, but it's not passing the data.
AUTH.php
<?php
session_start();
$_SESSION['loginName'] = $_POST['loginName'];
header("Location: home.php");
?>

HOME.php
<?php
session_start();
$currentUser = $_SESSION['loginName']; <--------- error out on this
line
?>

It says that the index $currentUser is undefiended. I have Sessions
vairalbe enabled because I was able to pass and get the SESSION ID, but
I can't pass values into any session variables.

Please Help

Jul 17 '05 #4

ne******@gmail.com wrote:
Geoff,
I did store it in the SESSION Variable, but it's not passing the data.

AUTH.php
<?php
session_start();
$_SESSION['loginName'] = $_POST['loginName'];
header("Location: home.php");
?>

HOME.php
<?php
session_start();
$currentUser = $_SESSION['loginName']; <--------- error out on this
line
?>

It says that the index $currentUser is undefiended. I have Sessions
vairalbe enabled because I was able to pass and get the SESSION ID, but I can't pass values into any session variables.


If the error message says "index $currentUser is undefiended" then the
code you posted is not the code you're running.

Please post the code you're running when you get the error.

Ken

Jul 17 '05 #5
I noticed that Message-ID:
<11**********************@g14g2000cwa.googlegroups .com> from
ne******@gmail.com contained the following:
It says that the index $currentUser is undefiended. I have Sessions
vairalbe enabled because I was able to pass and get the SESSION ID, but
I can't pass values into any session variables.


Well the first thing I would do is to echo the various variables to see
what is set.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ruben van Engelenburg | last post by:
Hi all, I have a strange problem. I have a login procedure that uses a mysql database in which the users are stored. The login procedure is pretty straightforward. In every page I unclude my...
2
by: thenetflyer | last post by:
<!-- The following sample should authorize the user to log on the site. This works once but after refreshing the browser, it does not prompt again for login until all browser (IE 6) windows are...
2
by: TJ Talluto | last post by:
Hi, I'm using the curl functions in php to scrape the wan ip address from my home router (the router is an SMC product). This is a two step process: 1. post the password value to the login.htm...
18
by: | last post by:
Please help. After a number of wrong turns and experiments I need advice on login management system to secure our web pages without inconveniencing our visitors or our internal staff. What I...
2
by: qaz | last post by:
I have login links on a number of pages in my site. Some of the pages expect variables on the querystring. I want to be able to login from any of these pages. The login link redirects me to a...
2
by: Lewis Edward Moten III | last post by:
I am having an odd problem. Every time I make a change to web.config file on my test servers website, the site restarts. That part is normal. However, the first page that I hit is missing part...
5
by: Rajani | last post by:
Hello, I have a strange problem. I want to check the privilege of the login user on each page and allow to display if has suff. priv. I am storing the privilege is session variable. I am...
11
by: tdmailbox | last post by:
I have a website that I subscribe to that allows me to track tasks. I have an extra computer with a big monitor that i want to always display the task list. the problem is after so many hours I...
9
by: adweaver | last post by:
Hello All, I'm new to the world of php. I've just had a site designed for me by a company, and I'm now trying to manage and grow it, so it will suit my needs. The site was built in a folder...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
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...
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,...

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.