 |
Account Login
|
 |
 |
Latest Articles
|
 |
 |
IRC Channel
|
 |
 |
Associates
|
 |
 |
Associates
|
 |
|
 |
|
 |
|
 |
10-31-2007, 12:07 PM
|
#1 (permalink)
|
|
The Contributor
Join Date: Sep 2007
Posts: 31
Thanks: 0
|
PHP Login Class
I was going to write a tutorial, but it was too hard trying to explain OO concepts so I'm just going to release the script. Should be pretty secure. Also includes functions for validating an e-mail address and grabbing a user's IP address.
Any feedback/comments welcome, thanks.
Edit:
I updated the script to include an install file and made a few other changes. File is too big to upload here so..
http://www.csscoder.net/private/PHP Login Class v2.zip
Last edited by daz : 11-13-2007 at 02:12 AM.
|
|
|
|
|
The Following User Says Thank You to daz For This Useful Post:
|
|
10-31-2007, 05:32 PM
|
#2 (permalink)
|
|
The Acquainted
Join Date: Oct 2007
Posts: 170
Thanks: 18
|
Great! Thanks for sharing. Such an example is great for learning OOP.
I've noticed a few things I've not seen before, like:
PHP Code:
throw new Exception(Login::ERROR_EMPTY_LOGIN);
What's it exactly doing? And why are you doing things like that?
|
|
|
|
|
The Following User Says Thank You to maZtah For This Useful Post:
|
|
10-31-2007, 08:23 PM
|
#4 (permalink)
|
|
The Wanderer
Join Date: Oct 2007
Posts: 21
Thanks: 1
|
Haven't had a chance to really look over much of it, but it might be beneficial to include an sql export to setup the table/field(s). I am sure you will get a lot of beginners complaining that it doesn't work, when in fact they just never set the table/field(s) up.
|
|
|
|
11-12-2007, 05:33 PM
|
#5 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
Yea, a lot of beginners will stumble and fall when it comes to that. When giving script out to the public, if the script interacts with a database then the SQL should be included. If not, your mail inbox will be filling up pretty quickly!
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|
11-13-2007, 02:13 AM
|
#6 (permalink)
|
|
The Contributor
Join Date: Sep 2007
Posts: 31
Thanks: 0
|
Post updated! :)
|
|
|
|
11-13-2007, 02:28 AM
|
#7 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
Good man, Daz :) 2MB limit for ZIP files though. Lots and lots of space!
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|
11-13-2007, 07:02 AM
|
#8 (permalink)
|
|
The Frequenter
Join Date: Sep 2007
Posts: 360
Thanks: 24
|
Thanks for the login class Daz! A good how-to tutorial would be great.
I have an idea for you, make a simple webpage (with your css skills) with link to your login class and a full documentation on how-to use and expand the class. :)
Good linkbait. :D
Erm and Adam, I don't seem to get the PHP5 exceptions. Might want to see your inbox!
|
|
|
|
11-15-2007, 01:59 PM
|
#9 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
Exceptions article has been written for 2 days :) Just sat in proof read forum along with many other juicy articles. So many requests for Daz, don't want to make him start regretting it!
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|
11-17-2007, 01:32 PM
|
#10 (permalink)
|
|
The Frequenter
Join Date: Sep 2007
Posts: 360
Thanks: 24
|
Quote:
Originally Posted by Wildhoney
Exceptions article has been written for 2 days :) Just sat in proof read forum along with many other juicy articles. So many requests for Daz, don't want to make him start regretting it!
|
He will be getting all the popularity and monies! :p
|
|
|
|
12-05-2007, 05:55 PM
|
#11 (permalink)
|
|
The Visitor
Join Date: Dec 2007
Location: Florida
Posts: 2
Thanks: 0
|
Cool
Hey this is a cool script. I'm glad I found it, I was just about to create my own Login class
For the next version I think a class that can handle more than one type of DB would be great. (I'm not sure PHP supports interfaces, but I'm sure there's a way to do it.)
Thanks,
Brian
|
|
|
|
12-05-2007, 10:39 PM
|
#12 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
Yea, PHP can handle interfaces. It would be nice to pass in the type of the database you're wanting to use to the construct, I do admit.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|
12-29-2007, 05:43 AM
|
#13 (permalink)
|
|
The Wanderer
Join Date: Dec 2007
Location: 127.0.0.1
Posts: 19
Thanks: 7
|
Unfortunately the server is not reachable. I'm really interested in that class as I've written something similar.
Thanks in advance.
Last edited by deflated : 07-18-2010 at 01:25 PM.
|
|
|
|
|
The Following User Says Thank You to deflated For This Useful Post:
|
|
03-18-2009, 04:40 PM
|
#14 (permalink)
|
|
The Visitor
Join Date: Mar 2009
Posts: 1
Thanks: 0
|
Hey all, I see there are alot of good things said about Daz login script. I am about to write/find one myself. Does this one have a session/cookie to remember the user, so they dont have to log in each time.? the initial post, has a vers 2 which is not avaialable right now. Is ver2 the one I want or will ver 1 be good. ? is ver 1 without the sql. ? any input? another script perhaps?
__________________
Eldonthian Leeburstroghm McAllister - Have a wonderful day. Its your choice!
Knowledge is the price for freedom www.1215.org
"If you make yourselves sheep, the wolves will eat you." -- Benjamin Franklin
|
|
|
|
03-22-2009, 04:29 PM
|
#15 (permalink)
|
|
The Addict
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
|
daz your link is broke.
|
|
|
|
03-24-2009, 06:00 PM
|
#16 (permalink)
|
|
The Wanderer
Join Date: Mar 2009
Posts: 5
Thanks: 0
|
Daz ,
The link is broken :(
Can you please upload it again ?? This will help a lot of newbies like me ....
Thanks,
Amit
|
|
|
|
03-24-2009, 10:27 PM
|
#17 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Have you guys checked the date of this thread? It's more than 1 year old, surely he must have removed the file by now.
__________________
|
|
|
|
05-02-2009, 07:29 AM
|
#18 (permalink)
|
|
The Acquainted
Join Date: May 2009
Posts: 178
Thanks: 9
|
Help for a Beginner.
Hi,
1st post on the site. I'm a PHP beginner well i've written a number of websites but never used OO before so was starting out and thought this login class looked pretty good. In any case I'm running PHP5, Apache2 and mySQL on Windows (my laptop) and when i try and run this seems the exception is caught and thrown out and all I ever get from the index page is:
getMessage(); } /* Include the HTML for the form */ require_once('./lib/form.php'); ?>
...as the error message. I'm hopelessly new to classes however i fully understand what the class is doing but how to debug it well i;m lost on that. I've done all the mysql set uyp work required. I know this is an old thread but any guidance even general would be much appreciated. 
|
|
|
|
05-02-2009, 01:39 PM
|
#19 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
try changing the start php tag from:
to
It seems the author used php short tags (which is bad practice, in my opinion for a number of reasons) and you dont have it it enabled.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|
05-02-2009, 03:20 PM
|
#20 (permalink)
|
|
The Acquainted
Join Date: May 2009
Posts: 178
Thanks: 9
|
sketchMedia u are a saviour. The fact that it just completely wouldnt work when it had worked for so many others made me think i was going to have to change a setting in my php.ini file or apache config but never crossed my mind about that one. Its now working. Thanks for your help.
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|