General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 18th, 2003, 09:59 AM
gat gat is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 24 gat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Very good Login Script...

Hello, Im currently in the begining stages of designing a new web project....

I have scanned about for many LOGIN tutorials, and have followed about 3 so far...

It buggs me that once i have completed the tutorial, i scroll down and read posts from PHP dons, that tear the code appart....!

So........can any one point me in the right direction for a secure PHP login. Using Sessions? Cookies? Whatever is best...

Many Thanks

You can check what i have done so far at

http://art.uk-graffiti.co.uk

www.uk-graffiti.co.uk - being the first PHP site i did.

Reply With Quote
  #2  
Old December 18th, 2003, 10:46 AM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 653 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 52 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
First off, let me say welcome to the forums, gat!

Also, have you tried using the search function in the forum to look for secure login? I'm sure that there were a few threads that had just this exact thing listed..

Also, do you have any code you have worked on that you'd like to post? It's always easier for us to work with projects like these if we have something to go by

I like the layout of that site, what did you use to make it?

Also, for your registration, you may want to have a screen confirming any login information, or have an email sent to the user when they register confirming the username/password, any any instructions for changing the password, logging in, etc, included in that email.. just an idea

Reply With Quote
  #3  
Old December 18th, 2003, 11:46 AM
gat gat is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 24 gat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Well first off "nicat23" thanks for the warm welcome...
It makes a nice change to come to a board where people are friendly and help...

Anyway....

About the design, im ok at that sort of stuff. But i lack on the coding front....this is what i am trying to brush up on.

I Usualy use Fireworks to build up the site structure etc..With this Art site, i made the header in flash, (still needs more work) and the rest of the lay out was made in DW.

Your comments:

What you suggested is exactly what i am after.
I need to take (in the reg form)

Username
Password
confirm password ?
Location
Email
Biog (about them selves)

And ideally i would like an email sent to them with an activation link. Like most forums use. However the book i am currently working from lets anyone register with no validation accept email.

I think now may be the time to splash out on a comprehensive book on PHP, but im sure there must be tutorials out there. someware.

If you have any suggestions as to how i can get started please get back....many thanks

g.

Reply With Quote
  #4  
Old December 18th, 2003, 12:02 PM
gat gat is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 24 gat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
by the way nicat..did you know users can just press submit having entered no details and log in (on your site) ?

Reply With Quote
  #5  
Old December 18th, 2003, 12:12 PM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 653 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 52 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
The confirmation email is just something that I would recomend, that way the end user has a copy of their information, since you may or may not be able to pull that up for them..

Here are my search results for the forum, try reading some of those threads and let me know if you're having an issue after that... Lots of REALLY good info in those results

And yeah, I know that users don't have to enter info.. my site is still a work in progress itself.. been busy with work and planning a wedding, so havent been able to update it.. Thats part of the reason why I recomended that you create a verification email (which is something that I'm working on now )

Reply With Quote
  #6  
Old December 18th, 2003, 01:59 PM
gat gat is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 24 gat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
My current logon does work.

I have a DB USERS

User_ID
Username
Pasword

The login page is here

http://art.uk-graffiti.co.uk/login.php

User = please
pass = help

Try loggin on with the wrong user/pass and with the above ^^

The correct error messages appear. But when i log in successfuly and click "check status" nothing appears.

here is the code for the login:

PHP Code:
if (!isset($username) || !isset($password)) { 
header"Location: [url]http://art.uk-graffiti.co.uk/logedin.php[/url]" ); 

elseif (empty(
$username) || empty($password)) { 
header"Location: [url]http://art.uk-graffiti.co.uk/logedin.php[/url]" ); 

else{ 

$user addslashes($_POST['username']); 
$pass md5($_POST['password']); 

$dbHost "localhost"
$dbUser "ukart"
$dbPass "***"
$dbDatabase "ukart"

$db mysql_connect("$dbHost""$dbUser""$dbPass") or die ("Error connecting to database."); 

mysql_select_db("$dbDatabase"$db) or die ("Couldn't select the database."); 

$result=mysql_query("select * from users where username='$user' AND password='$pass'"$db); 

$rowCheck mysql_num_rows($result); 
if(
$rowCheck 0){ 
while(
$row mysql_fetch_array($result)){ 

  
session_start(); 
  
session_register('username'); 
    echo 
'Success!'
    
header"Location: index.php" ); 
  } 
  } 
  else { 
  echo 
'Incorrect login name or password. Please try again.'
  } 
  } 
  
?> 


here is code for "checkstatus"

PHP Code:
?php 
session_start
(); 

if(
session_is_registered('username')){ 

echo 
'Welcome, you are still logged in.'


else{ 

header"Location: [url]http://art.uk-graffiti.co.uk/login.php[/url]" ); 


?> 


I really appreciate the help and any tips on improvements.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Very good Login Script...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway