I'm using the following code for a login page in PHP. Everything
works OK until someone else logs in from the same browser. As best I
can tell $mail, $password, and $user_id are not getting updated in the
session.
I tried doing
session_start() ;
session_destroy ();
$_SESSION['email'] = $email;
$_SESSION['password'] = $password;
$_SESSION['user_id'] = $user_id;
which seems to prevent email, password, and user_id from being set.
I'm using 4.1.2, no changes to php.ini (register_globa ls = On)
Any suggestions, help, or comments greatly appriciated.
Thanks!
Thomas
=============== =============== =============== =============
<?php
$email = addslashes($_PO ST['f-email']);
$password = addslashes($_PO ST['f-password']);
// connect to database
# query the database here - if $password and $mail match,
# return $user_id
if (!$user_id) {
// login failure
header('Locatio n: login_error.php ');
} else {
// login is good. start a session for this user
session_start() ;
$_SESSION['email'] = $email;
$_SESSION['password'] = $password;
$_SESSION['user_id'] = $user_id;
// and send them on their way
header('Locatio n: home.php');
}
?> 2 1856 su*********@hot mail.com wrote: I'm using the following code for a login page in PHP. Everything works OK until someone else logs in from the same browser. As best I can tell $mail, $password, and $user_id are not getting updated in the session.
I tried doing
session_start() ; session_destroy ();
$_SESSION['email'] = $email; $_SESSION['password'] = $password; $_SESSION['user_id'] = $user_id;
which seems to prevent email, password, and user_id from being set.
I'm using 4.1.2, no changes to php.ini (register_globa ls = On)
Any suggestions, help, or comments greatly appriciated.
Thanks!
Thomas
=============== =============== =============== =============
<?php
$email = addslashes($_PO ST['f-email']); $password = addslashes($_PO ST['f-password']);
// connect to database
# query the database here - if $password and $mail match, # return $user_id
if (!$user_id) {
// login failure
header('Locatio n: login_error.php ');
} else {
// login is good. start a session for this user
session_start() ;
$_SESSION['email'] = $email; $_SESSION['password'] = $password; $_SESSION['user_id'] = $user_id;
// and send them on their way
header('Locatio n: home.php');
}
?>
Thomas,
It seems to me like you are hitting the same bug I encountered a while
back on PHP 4.1.2. This is a documented bug and I would advise you to
upgrade your PHP4 version to the latest one. Here is a link to the bug
report: http://bugs.php.net/bug.php?id=16102
Amir.
--
Rules are written for those who lack the ability to truly reason, But for
those who can, the rules become nothing more than guidelines, And live
their lives governed not by rules but by reason.
- James McGuigan
<su*********@ho tmail.com> escreveu na mensagem
news:40******** ******@news.son ic.net... I'm using the following code for a login page in PHP. Everything works OK until someone else logs in from the same browser. As best I can tell $mail, $password, and $user_id are not getting updated in the session.
I tried doing
session_start() ; session_destroy ();
But you didnt do the two of them together right? You should *only* do the
"session_destro y();" when you want the user to log out and not before trying
to change "$_SESSION" fields. $_SESSION['email'] = $email; $_SESSION['password'] = $password; $_SESSION['user_id'] = $user_id; This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Craig Bailey |
last post by:
Anyone recommend a good script editor for Mac OS X?
Just finished a 4-day PHP class in front of a Windows machine, and liked
the editor we used. Don't recall the name, but it gave line numbers as
well as some color coding, etc.
Having trouble finding the same in an editor that'll run on OS X.
--
Floydian Slip(tm) - "Broadcasting from the dark side of the moon"
|
by: Chris |
last post by:
Sorry to post so much code all at once but I'm banging my head against
the wall trying to get this to work!
Does anyone have any idea where I'm going wrong?
Thanks in advance and sorry again for adding so much code...
<TABLE border="1" bordercolor="#000000" cellspacing="0">
<TR>
|
by: James |
last post by:
My form and results are on one page.
If I use :
if ($Company) {
$query = "Select Company, Contact
From tblworking
Where ID = $Company
Order By Company ASC";
}
|
by: Alan Walkington |
last post by:
Folks:
How can I get an /exec'ed/ process to run in the background on an XP box?
I have a monitor-like process which I am starting as
'exec("something.exe");' and, of course the exec function blocks until
something.exe terminates. Just what I /don't/ want. (Wouldn't an & be
nice here! Sigh)
I need something.exe to disconnect and run in the background while I
|
by: John Ryan |
last post by:
What PHP code would I use to check if submitted sites to my directory
actually exist?? I want to use something that can return the server
code to me, ie HTTP 300 OK, or whatever. Can I do this with sockets??
| |
by: Beowulf |
last post by:
Hi Guru's,
I have a query regarding using PHP to maintain a user profiles list. I
want to be able to have a form where users can fill in their profile
info (Name, hobbies etc) and attach an image, which will upload the
record to a mySql db so users can then either view all profiles or
query.. I.e. show all males in UK, all femails over 35 etc.
Now, I'm not asking for How to do this but more what would be the best
way? I've looked at...
|
by: Lothar Scholz |
last post by:
Because PHP5 does not include the mysql extension any more is there
a chance that we will see more Providers offering webspace with
Firebird or Postgres Databases ?
What is your opinion ? I must say that i like it to see mysql replaced
by a real database (stored procedures etc.)
|
by: joost |
last post by:
Hello,
I'm kind of new to mySQL but more used to Sybase/PHP
What is illegal about this query or can i not use combined query's in mySQL?
DELETE FROM manufacturers
WHERE manufacturers_id NOT IN ( SELECT manufacturers_id
FROM
products )
|
by: presspley |
last post by:
I have bought the book on advanced dreamweaver and PHP recently. I
have installed MySQL and PHP server but am getting an error on the
$GET statement show below. It says there is a problem with the
variable $GET but $GET is not a variable, I thought it came from the
page that calls the PHP file?
if(($_GET)==""){
this gets an error
|
by: sky2070 |
last post by:
i have two file with jobapp.html calling jobapp_action.php
<HTML>
<!-- jobapp.html -->
<BODY>
<H1>Phop's Bicycles Job Application</H1>
<P>Are you looking for an exciting career in the world of cyclery?
Look no further!
</P>
<FORM NAME='frmJobApp' METHOD=post ACTION="jobapp_action.php">
Please enter your name:
|
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...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |