Jump to content

NEED HELP w/ PHP REGISTRATION PAGE!!


rborc415

Recommended Posts

Hi, I've tried this many times but have come to no real solution, so here goes:

I have a mysql database with a table in phpadmin. The table contains the following member data fields:

 

record

last_name

first_name

d_o_b (date of birth)

ssn (last 4 digits)

usr_name

pswrd

email01

access_level

 

what I am trying to do (unsuccessfully, up to now), is construct a member registration system for our secure web page (similar to the way a credit card company lets you register to use their online service, since they already have your data).

I want to be able to have the user enter the following:

 

Last Name, First Name, Date of Birth, Last 4 Digits of Soc. Sec. #

 

Once this is verified, they will be sent to an update page, where they will be able to enter a user name, password, and optional email address.

 

Once the database is updated successfully, they will be sent to the login page to enter the secure site.

 

My Problem is this:

How do I I go about setting this up? I am not a coder, and I feel I may be in a little over my head with this one. But if I can get past this stage, the rest should be a piece of cake, comparatively speaking.

 

Thanks,

rborc415

Link to comment
Share on other sites

  • 2 weeks later...

you can make a pretty simple registration page fairly quicky, and its not too difficult, but once you start validating it it can be time consuming and sometimes tricky(making sure emails are formatted correctly/email activation, making sure emails/usernames are not already registered)

 

 

here is a code from a relativily simple registration i have. take what you want..

 

if(!empty($_SESSION['user'])){
echo "<p align=center><b>You cannot register Multiple accounts!</b></p>";
include 'footer.php';
exit;
}
if(isset($_POST['reg']))

{

$connect=mysql_connect ("*****", "******", "**********") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("matts15_forum"); 



$errors = array();

$i=0;


if(empty($_POST['fname'])){

	$first1 = '<font color=red size=2>*Please enter your first Name!</font>';

	$e++;

}else{ 
if(!eregi ('^[a-zA-Z]{2,}$', $_POST['fname'])){
$first1 = '<font color=red size=2>*Please enter a valid first name!</font>';
$e++;
}else{
$fi=$_POST['fname'];

}
}
if(empty($_POST['lname'])){

	$last1 = '<font color=red size=2>*Please enter your last Name!</font>';

$e++;

	}else{
if(!eregi ('^[a-zA-Z]{2,15}$', $_POST['lname'])){
$e++;
$last1 = '<font color=red size=2>*Please enter a true last name!</font>';
}else{
	$la=$_POST['lname'];

	}
}
	if(empty($_POST['email'])){

	$email1 = '<font color=red size=2>*Please enter your Email Address!</font>';

$e++;

}else{
if(!eregi ('^[[:alnum:]][a-z0-9\.\-_]*@[a-z0-9\.\-]+\.[a-z]{2,4}$', $_POST['email'])) {
$email1 = '<font color=red size=2>*Email is not in correct Format';
$e++;
}else{
		$cem=$_POST['email'];

		$sql_email_check = @mysql_query("SELECT email FROM Members  

             WHERE email='$cem'"); 

$email_check = mysql_num_rows($sql_email_check); 

}
  

     if($email_check != 0){ 

         $email1 = "<font color=red size=2>*This Email Address is already registered!</font>"; 

         $e++;

     } else{

	$em=$_POST['email'];
	}


}
	if(empty($_POST['user'])){

		$user1 = '<font color=red size=2>*Please enter a username!</font>';

$e++;

	}else{
	if(ereg('[^[:space:]a-zA-Z0-9_.-]{1,200}', $_POST['user'])){
	$user1 = '<font color=red size=2>*Please Only use Letters and Numbers for usernames</font>';
	$e++;
	}else{


	$cus=$_POST['user'];

		$sql_username_check = mysql_query("SELECT username FROM Members  

             WHERE username='$cus'"); 

$username_check = mysql_num_rows($sql_username_check); 

}
  

     if($username_check != 0){ 

         $user1 = "<font color=red size=2>*The username Already Exists</font>"; 

         $e++;

     } else{

	$us=$_POST['user'];
	}


}
	if(empty($_POST['pass'])){

		$pass1 = '<font color=red size=2>*Please enter your Password!</font>';

$e++;

		}else{

		if(($_POST['pass']) != ($_POST['cpass'])){

	$pass1 = '<font color=red size=2>*Passwords Dont Match</font>';

	$e++;

	}else{

		$pa=$_POST['pass'];

	}

	}

if($e == 0) {
$active = rand(100000, 99999999);
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: Mattswebpage.com <activate@mattswebpage.com>' . "\r\n";
$sus = base64_encode("$us");
mail("$em", "Account Activation", "
Welcome To Mattswebpage.com. To start using your new account Please Click below.
<br><br><Br><a href=http://beta.mattswebpage.com/active.php?ac=$active&us=$sus>Activate Your Account Now!</a><br><br>

Thankyou,<br>
Mattswebpage.com<hr>This is an automatic message, please do not reply", "$headers");



$query = "INSERT INTO Members VALUES ('','$us','$pa','$em','$fi','$la','$active','0')";

mysql_query($query) or die('We are Experiancing Database Errors, Please Contact The Administrator');
echo "<p align=center>Please Activate Your Account By going to your email and following the directions from there.</p>";
include 'footer.php';
exit;

}else{

$m= $e;

$mistake="<div align=center><p><font color=red>Please Correct ($m) Mistakes</font></p></div>";

}
}

echo "
<form method=POST><table><tr><td colspan=2><p align=center>Create An Account</p></td></tr><tr><td colspan=4>$mistake</td></tr>
<tr><td>First Name</td><td><input type=text name=fname value=$fi></td></tr>
<tr><td colspan=2>$first1</td></tr>
<tr><td>Last Name</td><td><input type=text name=lname value=$la></td></tr>
<tr><td colspan=2>$last1</td></tr>
<tr><td>Desired Username</td><td><input type=text name=user value=$us></td></tr>
<tr><td colspan=2>$user1</td></tr>
<tr><td>Email Address</td><td><input type=text name=email value=$em></td></tr>
<tr><td colspan=2>$email1</td></tr>
<tr><td>Password</td><td><input type=password name=pass></td></tr>
<td>Confirm Password</td><td><input type=password name=cpass></td></tr>
<tr><td colspan=2>$pass1</td></tr>
<tr><td colspan=2><p align=center><input type=submit name=reg value=Continue></td></tr></table></form>


";

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.