473,569 Members | 2,901 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

implementing login/logout (new to php)

hello,

i need to implement a secure web site in php and mysql but i have just
started looking at php a few days ago, and i would appreciate any advice
from the experts.

the site, as i said, will have a login/logout functionality, and no access
will be allowed to any pages (except for the login page) without login.

i have read on various authentication tactics on the web and decided to:
- always force secure connections from each authentication protected page
- have a plain html login page and send the credentials with this form
- when the user submits the form, look the credentials up in the database
and if they match, create a new session for this user
- if the user does not have a session then assume that this user is not
logged in
- to logout, destroy the user's session

my questions are:
- i assume that a session can either exist or not for a user, and there is
an API that i can call explicitly to create and destroy sessions, correct?
- i can store session ids either in cookies or in the url, and i chose to
use non-persistent cookies, can i control the persistence of session cookies
and the way the session id is sent to the client (in a cookie or in a query
string)?
- for more security i will store the user's IP in the session, and blow the
session away if the IP does not match which might indicate that someone else
stole the session cookie or otherwise got someone else's session id, would
this help at all? somethign else to check to see if the session id might be
stolen?
- can one just guess a session id? maybe by generating numbers on a machine
etc?

any suggestions on maybe a better way to achieve this?

would appreciate any advice!
thanks
konstantinos
Jul 17 '05 #1
0 1658

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

Similar topics

3
2841
by: koolyio | last post by:
Hey, could you please tell me what is wrong with my login script. I just started learning php. CODE: login.php <? session_start(); header("Cache-Control: private"); ?>
3
3005
by: sam | last post by:
HI, I installed php4 for apached and restart apache afterward. but my little php script generated error followint error: PHP Notice: Undefined index: myname in /usr/local/www/data-dist/www.authtec.com/php-test.php on line 2 I was trying to run the following php script in apache: <?php
0
1500
by: Peter Brown | last post by:
Hello! I am stepping through a text book that sets up different websites. The one I am testing is user registration. I set up the scripts and this is what I observe: Login (verifying against a mysql db) - no problem. Logout - no problem.
4
4067
tolkienarda
by: tolkienarda | last post by:
Hi all I work for a small webdesign company and we have remote hosting. i built a mysql database with phpmyadmin on the server. i then downloaded and modified a php login page. i am continuing to get the ---invalid username or password--- i am not getting the E_USER_ERROR so i don't know if there is a problem with the php, how i set up the...
12
3566
by: Fareast Adam | last post by:
I want to make sure all users those login are different in a time either on the same or different computer or web browser. Following are sample of my program which consist 4 different pages; #users.php $users = array( 'user1' => md5('password1'), 'user2' => md5('password2') ); $salt = substr(md5(date('F')), 8);
1
3283
by: Adrock952 | last post by:
I have a link on my site which obviously says "Login" where users log in. I would like that link to be changed to "Logout" when the user has successfully logged in and the session has been created and when the user logs out, i would like the link changed back to "Login" without having to refresh the page. here is my login page <?php if...
10
4799
by: DavidPr | last post by:
When I logout as one user and log in under a different user, it opens with the last user's information. User 1 - Unsername: Davey Jones User 2 - Unsername: David Smith I log out from Davey Jones, then login as David Smith the Welcome message below will show "Welcome Davey". And it will be Davey's information that is accessible - not David...
9
7509
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 called mysite.com/test. I coppied this folder a number of times, so I now have mysite.com/test2, mysite.com/test3 etc. Each folder acts as its own...
0
7693
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...
0
7605
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...
0
7917
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
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...
1
7665
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...
0
7962
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...
1
5501
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...
1
2105
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
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.