PDA

Click to See Complete Forum and Search --> : Register Problem


simon66
Jun 14th, 2010, 02:32 PM
Hi im trying to make a website and I want people to register to my site. So I made a registration form (in php duh) and the design is good, but now is the coding part.

<div id="reg">
<p>
In order to be able to gain access to the UFC stream, you must first register. Please
enter your desired user name, your email address and other required details in the
form below.</p>
<form action="" method="post">
<p>
<strong>User Name:</strong><br />
<input name="user" type="text" size="50" />
</p>
<fieldset style="width: 100%;">
<legend>Password</legend>
<table style="text-align: left;" cellpadding="0">
<tr>
<td colspan="2">
Please enter a password for your user account. Note that passwords are case-sensitive.
</td>
</tr>
<tr>
<td width="186">
Password:
</td>
<td width="319">
Confirm Password:
</td>
</tr>
<tr>
<td>
<input name="pass" type="password" size="30" />
</td>
<td>
<input name="pass_again" type="password" size="30" />
</td>
</tr>
</table>
</fieldset>
<br />
<fieldset style="width: 100%;">
<legend>Email Address</legend>
<table style="text-align: left;" cellpadding="0">
<tr>
<td colspan="2">
Please enter a valid email address for yourself.
</td>
</tr>
<tr>
<td width="186">
Email Address::
</td>
<td width="319">
Confirm Email Address:
</td>
</tr>
<tr>
<td>
<input name="email" type="text" size="30" id="email" />
</td>
<td>
<input name="email_again" type="text" size="30" id="email_again" />
</td>
</tr>
</table>
</fieldset>
<br />
<fieldset style="width: 100%;">
<legend>Captcha Verification</legend>
<?
require_once('captcha/recaptchalib.php');
$publickey = "6Lev0roSAAAAAPmNWWtRTbeLzmCHMuIQz7Ly4Wop "; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>
</fieldset>
<br />
<center>
<input type="submit" value="Complete Registration" class="button"/>
<input type="reset" value="Reset Fields" name="Reset" class="button" />
</center>
</form>
</div>

thats the login area, you can take a look at it live here

http://www.smartinuzzi.com/register.php

Right now there is no validation and I want to add some basic validation.

How can I validate if the password and password_conf is the same?
I don't want a page to open, I need a popup saying "password must be the same" like the javascript ALERT fundtion.

kows
Jun 14th, 2010, 05:16 PM
if you want JavaScript validation, you may be better off posting here (http://www.vbforums.com/forumdisplay.php?f=11).

also, the link you posted doesn't work.

penagate
Jun 14th, 2010, 09:01 PM
Client-side validation is all well and good, but remember to always validate everything on the server side as well. Assume no validation took place on the client at all, because it might not have. I write client-side stuff last because it's a mere convenience.

There are lots of tutorials on the basics of user registration and authentication around.

TDQWERTY
Jun 15th, 2010, 05:45 PM
Most ppl use javascript in order to validate if both passwords are the same but even if you do so, do not forget to check on serverside if both passwords are actually equal. A lot of ppl turn off java and javascript for security reasons most of times.

Here is a detailed and well explained tutorial:
http://www.devshed.com/c/a/PHP/Creating-a-Secure-PHP-Login-Script/
and here
http://php.about.com/od/finishedphp1/ss/php_login_code.htm
and here
http://www.phpeasystep.com/workshopview.php?id=6

google is your friend but have a look at php.net also