Jump to content
xisto Community
alex1985

Php Code Needed Working Together?

Recommended Posts

Hello, everyone. I need your help again. This forum is quite good for it.Well, I need create a registration form for my web-site using PHP and SQL. The information it should contain: 1) User Name2) First Name3) Last Name4) Password5) e-mail Address6) Security Image: that images helps to protect a random registration, for instance, 56+2=where user have to type an answer in order to finish registration. That's all for today. Anymore things, I will post another post over here.

Share this post


Link to post
Share on other sites

Have you searched through the Tutorials yet?Seems to me that there are a couple of Tutorials that do that. You might need to stitch a few together to do exactly what you want. one for the log-in and another for the captcha question. You would need cookies or sessions for the captcha, I think. And a database for the log-ins.Or look at a Content management System with user Log-ins. Do you need the Log-ins to 'protect' pages from clients who are not registered? Would a Forum software work?

Share this post


Link to post
Share on other sites

So, could you just explain how you do the registration form page by illustrating the sample codes. If there are tutorials, just give those links that I can follow up.[hr=noshade] [/hr]Yes, I need to create some kind of login page to my web-site. Sorry for that, I did not read your reply carefully.

Share this post


Link to post
Share on other sites

Like jlhaslip said there are many tutorials of doing this, and if you need help getting basic sql syntax you can always do a google search and therefore I'll give a quick overview of how to do what you want.

 

First you'll want to set up a database of useres. So make a new table called "users" and make 5 varchars:

Username

First name

Last name

email

Captcha

You can make the lengths of these whatever you feel would be appropriate.

Now make a varchar for the password length 32 (if you want to use md5 encryption).

 

Now the way I would make the captcha is by making a separate table called captcha and have the following fields:

IP

captcha


Now to actually make the dynamic captcha image itself you will have to know a bit about Php GD library. If you follow that link, however, you should get all the info you need to make one.

 

Now here is the basic login functionality explained:

When you login, php first finds the username that matches from the rows in the database, then it encrypts the password you gave it and checks that against the encrypted password in the database, if it is a match then it generates a new session and makes a cookie on the users computer with that session on it. Whenever you navigate a page, it looks up that session id against the server and lets you view the content.

 

Now for the captcha. Whenever that dynamic image is viewed, look up the row with the user's IP address and give it a new random captcha, or if the users IP doesn't exist then make a new row, and display the captcha. Then when registering make sure the captcha entered is the same as the one in the database. If it is a match then you're good!

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

×
×
  • 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.