rborc415 Posted October 29, 2008 Share Posted October 29, 2008 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 https://forums.phpfreaks.com/topic/130617-need-help-w-php-registration-page/ Share on other sites More sharing options...
corbin Posted October 29, 2008 Share Posted October 29, 2008 OMG YOU NEED HELP WITH REGISTRATION PAGE?!?!?!?! Blerh I hate all caps. Anyway, look into SQL syntax (SELECT/UPDATE). Also, you'll want to look into $_POST and $_GET. Link to comment https://forums.phpfreaks.com/topic/130617-need-help-w-php-registration-page/#findComment-677832 Share on other sites More sharing options...
legohead6 Posted November 9, 2008 Share Posted November 9, 2008 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 <[email protected]>' . "\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 https://forums.phpfreaks.com/topic/130617-need-help-w-php-registration-page/#findComment-685772 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.