Jump to content
xisto Community
Sign in to follow this  
Alex1331

Need Help With A Login Script Login script

Recommended Posts

I am new in php an want to make a browserbased online game.. But i do have som problems wit the login and registrer script! Just wonder if anyone can make a compleate login/register script for me? It would also bee cool if you could make the sql files also.. See ya later!Thanks to the person ho will do this for me... its not a smal task!

Edited by Alex1331 (see edit history)

Share this post


Link to post
Share on other sites

I am new in php an want to make a browserbased online game.. But i do have som problems wit the login and registrer script! Just wonder if anyone can make a compleate login/register script for me? It would also bee cool if you could make the sql files also..
See ya later!

Thanks to the person ho will do this for me... its not a smal task!


user wakeupcall mad loginscript when helping me in my project..

here download zip file.. i think he wouldn't mind

http://forums.xisto.com/no_longer_exists/

Share this post


Link to post
Share on other sites

To ad my two cents, here is the standard answer I usually give when people are starting and that try and build one in order to get a better understanding by going ot this tutorial site.http://www.pixel2life.com/

Share this post


Link to post
Share on other sites

Also the website TechTuts has a extremely good user system and a lot of adons for it including admin panel, messaging system etc.

A must checkout website for people!

-Tom.

Share this post


Link to post
Share on other sites

well, now really, I don`t want to discourage you or anything like this, but if you don`t know how to build a simple login system, how will you be able to build an entire web-based game script? just wondering..:P

Share this post


Link to post
Share on other sites

Heh i started off the same way, not knowing any php, but making Realm of forts has really helped me learn it, and unlike you I had to figure out my own log in script. My first log in script was quite exploitable, I created my own string encryption function (it replaced letters around a became u and e became 7 etc...) and for the longest time, when you logged in it would make a cookie with your user id and "encrypted" password, heh, well that was only when there were 2 other admins with me, so nobody's password was exploited, but then i learned what a session id was, and i changed it around to be much more secure.If your anything like me you won't like to take other people's code not knowing how "messy" it is, or if there are any unnecessary parts, even though it doesn't matter, I still like writing everything myself, so anyway, If you are like that, and want to write the script yourself Ill give you a quick tutorial:------------------------First of all you'll want an SQL table where you can hold all of your accounts, and their info, so have some basic stuff like username, password (ill go over how to encrypt the password later), and any info the game needs to function.Next you'll want to make a second table for session Id's, you'll want at least 2 columns here, but with 3 it will make your site less exploitable:Php session idPerson's IDPersons' IP address (optional)Now the fun part, for the log-in script, check the username and password that were given to the log-in page, and if they match one of the rows in the users (or players) table, have it make a new row in the phpsessionid table. Have the php session id be a random string of letters numbers or even symbols if you want, set the person's id, and if you want to protect your site against cookie stealers, the person's IP address. And set a cookie on the persons computer with the php session id (the random string of numbers and letters).Now on every page that somebody needs to be logged in to see, have php grab the cookie, find the php session id with that string, check their IP against the IP row(if you have one), and display all the info for the player's Id in the php session id. You also may want to add a script that executes every hour or so, and deletes phpsession id's that aren't in use, for this you'll need to add a time row to the php session id of the last time the person loaded a page.For the log off page, either have php delete the person's cookie, or delete the php session id row that the person is using, or you could do both.Now for registration:All you have to do is have the register page add a row to the players table, with the username they selected, and have the ID be one higher than the previous one(this can be done in sql so you don't have to bother coding this in php), and for the password, you may or may not want to use a hash. Depends on how honest you want to be. Since you are most likely the only person who has access to your SQL accounts, you can leave the passwords un-encrypted, so you can read them, I guess if that makes you feel special or something, but If you want to be honest, and encrypt the passwords from yourself, others who have SQL access, and even hackers who may try SQL injection to get the passwords, using a hash is very easy in php. The basic hash encryption function in php is "MD5", this takes in a string and encrypts it. Pretty easy huh?Example:echo md5("test")this will echo an encrypted hash of the string "test". Yes hashes can be broken with apps, but I prefer to use it. There are more complicated ways of making it more secure, but this is a great start.I hope you enjoyed my tutorial, if you have any questions feel free to PM me.----------------By the way, my game isn't done yet, but when it is its going to change all of those stupid text/MUD games, it's 99% js, flash, java, and graphics so watch out!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.