Welcome Guest ( Log In | Register )



2 Pages V  < 1 2  
Reply to this topicStart new topic
> Very Simple Login-script, This is a very simple and secure login-script
Jeigh
post Apr 22 2008, 05:43 PM
Post #11


Whitest Black Mage
Group Icon

Group: [MODERATOR]
Posts: 1,371
Joined: 20-May 05
From: NB, Canada
Member No.: 5,281
myCENTs:65.99



I assume the md5 function is just an encryption technique? I know another option is to use the sha1() encryption that seems to do a good job. Not sure if either has a vast benefit over the other or not but figured it was worth mentioning lol
Go to the top of the page
 
+Quote Post
jlhaslip
post Apr 24 2008, 03:55 AM
Post #12


Advanced Member
Group Icon

Group: Members
Posts: 189
Joined: 15-November 05
From: Inland from the Left Coast of Canada
Member No.: 9,627
myCENTs:62.43



http://php.net/require
http://php.net/include

the biggest difference between require() and include() is that require() will throw a fatal error and stop the script if there is an error with the file or the path to the file. it is used when the "required" file is critical to the script functioning, like the DB connection script. If the connection script is not available, stopping the process is a good idea.
Go to the top of the page
 
+Quote Post
FirefoxRocks
post Apr 24 2008, 04:29 AM
Post #13


Super Member
Group Icon

Group: [HOSTED]
Posts: 737
Joined: 12-July 06
From: Ontario, Canada
Member No.: 14,464



This is a very nice tutorial for a login script. I haven't read through it thoroughly but I have skimmed through various sections and it looks a bit more secure than the one that I use currently.

One thing though, what's the difference between require() and require_once()? It seems that both are putting the file in once, so why use require_once()?
Go to the top of the page
 
+Quote Post
Mordent
post Apr 24 2008, 03:46 PM
Post #14


Premium Member
Group Icon

Group: [HOSTED]
Posts: 254
Joined: 30-June 07
From: UK
Member No.: 23,045
myCENTs:19.79



QUOTE(Jeigh @ Apr 22 2008, 06:43 PM) *
I assume the md5 function is just an encryption technique? I know another option is to use the sha1() encryption that seems to do a good job. Not sure if either has a vast benefit over the other or not but figured it was worth mentioning lol

You assume right, although I'm not aware of the benefits of one over another either. Personally I use md5(), simply because it was the one I saw first, I guess. If one was substantially better than the other I'd imagine that there'd be more awareness on the subject.

QUOTE(FirefoxRocks @ Apr 24 2008, 05:29 AM) *
...

One thing though, what's the difference between require() and require_once()? It seems that both are putting the file in once, so why use require_once()?

require() will get the required file each and every time. require_once() will only ever get the required file once in a page, so if it's been required before it won't be done so again. Personally I find this useful for things like database connection includes, as although you may have various different spots where you want to connect to a database in your script, there's no need to connect more than once. The first time the file is required, the database would be connected to. All times after that nothing would happen, and assuming you haven't closed the previous connection for whatever reason then all other database queries will run off of the first one.

In my opinion, if possible you should use require_once() in preference to require(), even if you only use the require once on the page. It just seems like neater code to me, but that's just the way I am.

Overall, not a bad little login script. I had great fun writing my own one a little while back, and once you've cracked your first one the rest do tend to fall in to place a lot quicker. It made for a great opportunity to practice using mysql functions and whatnot as well, and isn't too difficult technically, so I reckon it's not a bad little thing for PHP programmers who've got their heads around the very basics to have a crack at.
Go to the top of the page
 
+Quote Post
Feelay
post Apr 24 2008, 04:18 PM
Post #15


Kinda N00B
Group Icon

Group: Members
Posts: 230
Joined: 13-January 08
From: Sweden
Member No.: 27,579



It was a really long time ago I created a php-script tongue.gif So I have forgotten most of the codes tongue.gif I really have to make a comeback tongue.gif but I am starting to find it kinda boring tongue.gif

Thanks for the comments and tips smile.gif

//Feelay
Go to the top of the page
 
+Quote Post
Ddraiggoch06
post May 22 2008, 05:07 PM
Post #16


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 3
Joined: 22-May 08
Member No.: 30,493



Very nice tutorial. Easy to understand and written for the beginner (like me smile.gif). I'll try this out sometime, I've always wanted to have a go at a login system. Simple but effective wink.gif
Go to the top of the page
 
+Quote Post
mafialeg
post May 24 2008, 06:41 PM
Post #17


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 2
Joined: 24-May 08
Member No.: 30,546



Nice, really like it happy.gif
Go to the top of the page
 
+Quote Post
maxmumford
post Jun 26 2008, 10:56 PM
Post #18


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 1
Joined: 26-June 08
Member No.: 31,171



Hi =]

nice tutorial - its so useful having so many notes too.

any idea why im getting this error:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in login2.php on line 18

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in login2.php on line 25
Wrong Username or Password

?

Thanks smile.gif
Max
Go to the top of the page
 
+Quote Post
kanade
post Jun 28 2008, 02:46 PM
Post #19


Member [ Level 1 ]
Group Icon

Group: [HOSTED]
Posts: 34
Joined: 15-May 08
Member No.: 30,356



QUOTE(Feelay @ Apr 22 2008, 08:17 PM) *
I use require_once when I want to "include" something, but not exactly include it.. it is hard to explain.. I just know, that when you want to check a database file, or something like it, it is better to use the require function instead of include. include is better to use when you want to include a part of a page.

BTW: Sorry for the late answere :P


Nice toutorial, this is verry usefull script and lot of new things to learn. But it will be more usefull if any one explains the script in more details and with some more comments for the script.
Go to the top of the page
 
+Quote Post

2 Pages V  < 1 2
Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. PHP: Writing A Generic Login And Register Script(15)
  2. Creating Your Own Image Gallery With Php(3)
  3. PHP Tutorial: Form Verification And Simple Validation(12)
  4. Simple User Validation Script(5)
  5. Attack Script In Php(5)
  6. A Simple Register Script(3)
  7. Creating A Php Login Script(3)


 



- Lo-Fi Version Time is now: 20th November 2008 - 06:31 PM