PHP - Version Upgrade Leads To Broken Registration Form
Hello,
I work for a non-profit agency and I have been up all night trying to fix a registration form that has suddenly stopped working after a php upgrade from v 5.0 to v 5.2. The server admin says it is my coding. When you hit submit the form actually does what it is supposed to however the missing link here is that I am not being emailed after each registration with the registraiton informationl. You can see the form in action at www.nctt.net/coreTest.php I have also cut and pasted the contents of that file below and have attached it to this email. There is also the last version of the form I used still up on the website that I never took down after our summer program. There are a few modifications to this page to meet the program requirements but in July www.nctt.net/SIReg.php was working fine. Any assitance, hints, suggestions, anything at all is welcome and I thnk you in advance for taking a loot. Jennifer <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>NCTT Registration Form</title> <style type="text/css"> body { margin: 10px padding: 0; font-size: 100%; } * { } h1.register { text-align: center; padding: 18px; background: #cc0033; color: #ffffff; font: 160% Arial, Helvetica, sans-serif; font-weight: bold; text-transform: uppercase; } h1.costs { margin: 10px 0 0 0; padding: 0; border-bottom: 5px solid #cccccc; font: 320% Arial, Helvetica, sans-serif; color: #0071b7; font-weight: bold; text-transform: uppercase; line-height: 1.5em; text-align: left; } h1.title { margin: 10px 0 0 0; padding: 0; border-bottom: 5px solid #cccccc; font: 180% Arial, Arial, Helvetica, sans-serif; color:#0071b7; font-weight: bold; text-transform: uppercase; line-height: 1.5em; text-align: left; } h1.regbox { color: #cc0033; font: 200% Trebuchet Ms, Arial; letter-spacing: -1px; margin: 0; padding: 0; text-align: center; } h1.side { letter-spacing: -1px; text-align: center; font: 140% Arial, Helvetica, sans-serif; font-weight: bold; color: #ffffff; padding: 0; margin: 0; } h2 { text-align: left; margin: 0; padding: 0; line-height: 1.8em; color: #cc0033; font-size: 170%; font-family: trebuchet ms; } h2.regbox { color: #0071b7; font: 140% Trebuchet Ms, Arial; letter-spacing: -1px; font-weight: bold; margin: 5px 0 0 0; padding: 0; text-align: center; } h2.enroll { color: #0071b7; font: 120% Trebuchet Ms, Arial; font-weight: bold; text-align: left; border-bottom: 3px solid #cccccc; margin: 15px 0 0 0;} h3 { margin: 0; padding: 0; line-height: 1.8em; color: #cc0033; font-size: 110%; font-family: trebuchet ms; } h4 { margin: 0; padding: 0; line-height: 1.8em; color: #cc0033; font-size: 90%; font-family: trebuchet ms; } p.normal { text-align: left; font: 75% Arial, Helvetica, sans-serif; line-height: 1.4em; margin: 5px; padding: 0; color: #000000; } .prices { border-bottom: 1px solid #ccc; color: #cc0033; line-height: 2em; font: 80% Arial, Helvetica, sans-serif; margin: 0; padding: 5px; } p.special { text-align: left; padding: 10px; margin: 5px 0 5px 0; background-color: #efefef; border: 1px solid #0071b7; font: 80% Arial, Helvetica, sans-serif; line-height: 1.5em; } p.normal1 { text-align: center; font: 75% Arial, Helvetica, sans-serif; line-height: 1.4em; margin: 5px; padding: 0; color: #000000; } span.price { border-bottom: 1px solid #ccc; color: #0071b7; line-height: 2em; font: 80% Arial, Helvetica, sans-serif; margin: 0; padding: 5px; } td.reg { background: #0071b7; border-bottom: 5px solid #0071b7; color: #ffffff; font-family: Arial, Helvetica, sans-serif; font-size: 150%; font-weight: bold; text-transform: uppercase; letter-spacing: -1px; } td.reg-line { border-bottom: 5px solid #0071b7; } td.title { font: 100% Arial, Helvetica, sans-serif; color: #000000; font-weight: bold; } label { font: 100% trebuchet ms, arial; color: #0071b7; font-weight: bold; } input { margin: 0; padding: 5px; } input.sub { padding: 10px; font-family: arial; color: #000033; font-size: 12pt; font-weight: bold; background: #ccc; text-transform: uppercase; } .success { color: #ffffff; background: #0071b7; font-weight: bold; font: 100% arial; border: 1px solid #000; padding: 10px; } .error { color: #fff; background: #FF0000; padding: 10px; border: 1px solid #990000; font: 90% arial; } a:link { text-align: left; font: 125% Arial, Helvetica, sans-serif; line-height: 1.4em; font-weight: bold; padding: 0; color: #cc3333; text-decoration: underline; } a:active {text-align: left; font: 125% Arial, Helvetica, sans-serif; line-height: 1.4em; font-weight: bold; padding: 0; color: #ff9933; text-decoration: none; } a:visited {text-align: left; font: 125% Arial, Helvetica, sans-serif; line-height: 1.4em; font-weight: bold; padding: 0; color: #009933; text-decoration: underline; } a:hover {text-align: left; font: 125% Arial, Helvetica, sans-serif; line-height: 1.4em; font-weight: bold; padding: 0; color: #0099ff; text-decoration: none;} p.check {text-align: left; font: 110% Arial, Helvetica, sans-serif; line-height: 1.4em; font-weight: bolder; padding: 0; color: #cc0033; } </style> </head> <body> <center> <? if($_POST['submit']) { $first = $_POST['first_name']; $last = $_POST['last_name']; $middle = $_POST['middle_name']; $dob = $_POST['dob']; $module_1 = $_POST['module_1']; /*$module_2 = $_POST['module_2'];*/ $province = $_POST['province']; $address_1 = $_POST['address_1']; $address_2 = $_POST['address_2']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $school = $_POST['school']; $country = $_POST['country']; $taught = $_POST['taught']; $grade = $_POST['grade']; $home = $_POST['home']; $work = $_POST['work']; $email = $_POST['email']; if(!empty($first) && !empty($last) && !empty($address_1) && !empty($city) && !empty($state) && !empty($zip) && !empty($home) && !empty($email)) { if($module_1) { $cost = $cost+195; $add_email .= "<li>December 5, 2014: YES ($195)</li>"; } /* if($module_2) { $cost = $cost+1075; $add_email .= "<li>Week II: YES ($1075)</li>"; } if(date("n") <= 15) { $before = $cost*.05; $before = round($before,2); $cost = $cost-$before; } */ $msg .= "<body style=\"font-family: arial; font-size: 10pt; line-height: 1.5em;\">"; $msg .= "<p>These are the registration details submitted from the website.</p>"; $msg .= "<ul>"; $msg .= $add_email; $msg .= "<li><strong>Name:</strong> " . $first . " " . $middle . " " . $last . "</li>"; $msg .= "<li><strong>Address One:</strong> " . $address_1 . "</li>"; $msg .= "<li><strong>Address Two:</strong> " . $address_2 . "</li>"; $msg .= "<li><strong>City:</strong> " . $city . "</li>"; $msg .= "<li><strong>State:</strong> " . $state . "</li>"; $msg .= "<li><strong>Zipcode:</strong> " . $zip . "</li>"; $msg .= "<li><strong>Province:</strong> " . $province . "</li>"; $msg .= "<li><strong>Country:</strong> " . $country . "</li>"; $msg .= "<li><strong>School:</strong> " . $school . "</li>"; $msg .= "<li><strong>Grade Taught:</strong> " . $grade . "</li>"; $msg .= "<li><strong>Field/Subject Taught:</strong> " . $taught . "</li>"; $msg .= "<li><strong>Home Phone:</strong> " . $home . "</li>"; $msg .= "<li><strong>Work Phone:</strong> " . $work . "</li>"; $msg .= "<li><strong>Email:</strong> " . $email . "</li>"; $msg .= "</ul>"; $msg .= "<p>Total Cost: $" . $cost . "</p>"; /* if($before) { $msg .= "<p>This was sent before April 15, 2013, so 5% has been taken off the total.</p>"; }*/ $msg .= "</body>"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; $headers .= 'From: donotreply@nctt.net'; $to = "info@nctt.net"; $subject = "Registration Form | " . $first . " " . $middle . " " . $last; mail($to,$subject,$msg,$headers); ?> <div class="success"> We have successfully sent your registration details to NCTT. Please click on "Add to Cart" below, and checkout with Paypal to complete your resgistration. <strong>Space will not be held for registration without payment unless you have contacted the office at 417-773-1654 and spoken to Jennifer to make special arrangements.</strong> <br /> <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="business" value="info@nctt.net"> <input name="item_name" type="hidden" class="title" value="Registration: Critical Thinking, Reading, Writing and the Common Core "> <input type="hidden" name="amount" value="<? echo $cost; ?>"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="no_shipping" value="1" /> <input type="hidden" name="on0" value="name"> <input type="hidden" name="os0" maxlength="60" value="<? echo $first . " " . $middle . " " . $last; ?>"> <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"> <input type="hidden" name="add" value="1"> </form><!--<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="business" value="info@nctt.net"> <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_viewcart_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"> <input type="hidden" name="display" value="1"> </form>--> </div> <? } else { echo "<div class=\"error\">Sorry, please fill out all of the required fields.</div>"; } } else { ?> <form action="core.php" method="post"> <table border="0" cellpadding="5" cellspacing="0" width="80%"> <tr> <td colspan=3><h1 class="costs"><div align="center">REGISTER ONLINE</div></h1></td> </tr> <tr> <td width=10%></td> <td width="90%" valign="top"> <table border=0 cellpadding=3 cellspacing=0 width="100%"> <tr> <td class="prices" align="left"><a href="core.htm">Critical Thinking, Reading, Writing and the Common Core</a> <br /><p>December 5, 2014</p></td> <td width="30%" align="right" class="prices"><p style="font-weight:bold; color:#cc3300; font-size:14px;">$195.00</p></td> </tr> </table> </td> <td width=20%></td> </tr> </table> <table border="0" cellpadding="5" cellspacing="0" width="80%"> <tr> <td width="50%" align="center" class="reg">Registration</td> </tr> </table> <table border="0" cellpadding="5" cellspacing="0" width="80%"> <tr> <td width=17%></td> <td width="66%" valign="top"> <div align="center"><h1 class="title">Critical Thinking, Reading, Writing and the Common Core</h1></div> <p class="check">You <i>must check</i> the box below for your registration to be valid. Thank you.</p> <input type="checkbox" name="module_1" value="1" /> <label for="module_1">Critical Thinking, Reading, Writing and the Common Core</label> <!--<table border="0" cellpadding="3" cellspacing="1" width="100%"> <tr> <td width="25%" valign="top"> <p style="font-weight:bold; font-size:14px; color:#cc3300;">December 6, 2013 $150.00</p> </td> <td width="25%"></td> </tr> <tr> <td width="25%"><input type="checkbox" name="module_1" value="1" /> <label for="module_1">Critical Thinking, Reading, Writing and the Common Core</label></td> <td></td> </tr> <tr> <td width="25%" valign="top"> <h4>Week II ($1075.00)</h4> </td> <td width="25%"></td> </tr> <tr> <td width="25%"><input type="checkbox" name="module_2" value="1" /> <label for="module_2">Summer Institute Week II</label></td> <td></td> </tr> </table>--> <hr size=1 width=100% noshade /> <table border="0" cellpadding="2" cellspacing="0" width="100%"> <tr> <td width="33%" align="center"><input type="text" name="first_name" size="30" /></td> <td width="33%" align="center"><input type="text" name="middle_name" size="30" /></td> <td width="33%" align="center"><input type="text" name="last_name" size="30" /></td> </tr> <tr> <td width="33%" align="center"><p class="normal1">First Name</p></td> <td width="33%" align="center"><p class="normal1">Middle Initial</p></td> <td width="33%" align="center"><p class="normal1">Last Name</p></td> </tr> </table> <table border="0" cellpadding="5" cellspacing="0" width="100%"> <tr> <td><p class="normal">Address 1</p></td> <td colspan="3" align="left"><input type="text" name="address_1" size="94" /></td> </tr> <tr> <td><p class="normal">Address 2</p></td> <td colspan="3" align="left"><input type="text" name="address_2" size="94" /></td> </tr> <tr> <td><p class="normal">City</p></td> <td align="left"><input type="text" name="city" size="20" /></td> <td><p class="normal">State</p></td> <td align="left"><input type="text" name="state" size="20" /></td> </tr> <tr> <td><p class="normal">Zip</p></td> <td align="left"><input type="text" name="zip" size="20" /></td> <td><p class="normal">Province</p></td> <td><input type="text" name="province" size="20" /></td> </tr> <tr> <td><p class="normal">School/College</p></td> <td align="left"><input type="text" name="school" size="56" /></td> <td><p class="normal">Country</p></td> <td><input type="text" name="country" size="20" /></td> </tr> <tr> <td><p class="normal">Field/Subject Taught</p></td> <td align="left"><input type="text" name="taught" size="56" /></td> <td><p class="normal">Grade</p></td> <td><input type="text" name="grade" size="20" /></td> </tr> <tr> <td><p class="normal">Telephone (H)</p></td> <td align="left"><input type="text" name="home" size="20" /></td> <td><p class="normal">(W)</p></td> <td><input type="text" name="work" size="20" /></td> </tr> <tr> <td><p class="normal">Email Address</p></td> <td colspan="3"><input type="text" name="email" size="94" /></td> </tr> <tr> <td colspan=4 align=center><input type="submit" name="submit" value="Submit Form" class="sub" /></td> </tr> </table> <td width=17%></td> </td> </tr> </table> </form> <? } ?> </center> </body> </html>Attached Files coreTest.php 15.99KB 2 downloads SIReg.php 15.08KB 2 downloads Similar TutorialsI have 2 pages in my flash site that call some PHP files. The pages are a feedback page and a locator page. When my server went from PHP4 to PHP5 both pages stopped displaying the content. When I load the flash pages with Fiddler open, fiddler shows a 500 error on the PHP files that the flash is calling. I'm certain my database connections are good, file paths have not changed since the server maintenance, and I have .htaccess files except they are blank. Can anyone advise what I can do to find where the problem is? I have the PHP code below that showed the 500 errors. Any help would be really appreciated. This is the locator page: Code: [Select] <?php include_once('db_connect.inc.php'); $query = "SELECT state FROM stores group BY state ORDER BY state"; $result = mysql_query($query); if(mysql_num_rows($result)==NULL){ $r_string = '&error=1&msg=No Records Found.'; }else{ $r_string = '&error=0&n='.mysql_num_rows($result) . '&r_states='; $i = 0; $r=''; while ($row = mysql_fetch_assoc($result)) { if($r!='') $r .= '||'; $r .= $row['state']; $i++; } $r_string .= $r; // add extra & to prevent returning extra chars at the end $r_string .='&'; } echo $r_string; ?> This is the feedback page: Code: [Select] <?php include_once('inc/feedbackconn.inc.php'); echo '&rsult='; $query = "SELECT * FROM messages where active!=0"; $result = mysql_query($query); $num = @mysql_num_rows($result); $cfeed=$_POST['sFeed']; $cfeed--; $query = "SELECT * FROM messages where active='1' ORDER BY id LIMIT " . $cfeed . ',1'; $result = mysql_query($query); //$row = mysql_fetch_array($result); if($num==NULL){ echo "No Records."; exit(); } while($row = @mysql_fetch_array($result)){ $b_name = stripslashes($row[strName]); $b_loc = stripslashes($row[strLocation]); $b_mes = stripslashes($row[strMessage]); $b_id = $row[id]; $b_active = $row[active]; $feedArray[] = array("name"=>$b_name,"location"=>$b_loc,"feedback"=>$b_mes,"id"=>$b_id,"active"=>$b_active); } /* /////////////// DISPLAY THE RECORDS ///////////////// */ $numOfMessages = sizeOf($feedArray); for($i=0;$i<$numOfMessages;$i++){ //------------------------------------------------------------------ //echo $feedArray[$i]['id']."<br>\n"; echo '<b><i>' . $feedArray[$i]['feedback']."</i><br><br>"; echo $feedArray[$i]['name']."<br>"; echo $feedArray[$i]['location']."</b>"; //--------------------------------------------------------------------- } echo '&tFeeds=' . $num; echo '&cFeed=' . $_POST['sFeed']; ?> Hi everyone, would be grateful if anyone can help me. I recently changed my hosting package and didnt realize that the new package uses PHP 5. There is no option to use an earlier version but my thumbnail script that worked on PHP 4 just shows a red cross where the thumbnail should be. Can anyone tell me why the script below would not work with PHP 5. I have a basic understanding of how scripts work but I am not an expert so if you could make any replies easy to understand I have checked and the new server does have GD library version 2.0.34 installed - not sure if there is anything else I need to check ? script called: uktn.php Code: [Select] <? $maxwidth = 200; $maxheight = 200; $image_path = $_GET['im']; $ext = explode('.', $image_path); $i = count($ext)-1; if ($ext[$i] == 'jpg' || $ext[$i] == 'jpeg' || $ext[$i] == 'JPG' || $ext[$i] == 'JPEG' ) { $img = @imagecreatefromjpeg($image_path); } else if ($ext[$i] == 'png' || $ext[$i] == 'PNG') { $img = @imagecreatefrompng($image_path); } else if ($ext[$i] == 'gif' || $ext[$i] == 'GIF') { $img = @imagecreatefromgif($image_path); } if ($img) { $width = imagesx($img); $height = imagesy($img); $scale = min($maxwidth/$width, $maxheight/$height); if ($scale < 1) { $new_width = floor($scale*$width); $new_height = floor($scale*$height); $tmp_img = imagecreatetruecolor($new_width, $new_height); imagecopyresized($tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height); imagedestroy($img); $img = $tmp_img; } } if (!$img) { exit ("You must specify an image!"); } header("Content-type: image/png"); imagepng($img,'',100); ?> Many thanks, Dave Hey folks. okay, I took over the admin of a website ( http://www.annualclownsdirectory.com ) a while back. I have changed nothing in the php but there seems to be a problem with account activation. As a total newbie with php (I can work out what things do by reading the code, and can notice obvious mistakes but thats about it...) I have NO idea what is going on here to stop it working. If I make a test account the email is sent to me with the link to click on to activate the account, which looks like this: " http://www.annualclownsdirectory.com/confirm.php?id=330&hash=c6efb8f1d00beef170bd0df223ab87f1 " but when clicked the website throws up this: "Sorry, either this account is already active or it cannot be found, try logging in. If you have just created this account and are getting this error then please wait a couple of minutes and try again" Now when I check in myphpadmin the account is there, it's status is "unconfirmed" and I can't see anything wrong with the code (but as I say I am a total fresher here lol). I have attached register.php so you can see what is there. I can see no "md5" variable in the phpmyadmin section for clown_account. If any other files are needed please just say! And again, apologies for being useless! Sam / Bifford Is jquery/Ajax better than real/raw PHP for form validation ?! What if JavaScript is turned off on the browser?! why after someone refreshing a page on the browser, the variables used to echo error after invalid data is being submitted will return the undefined variables error?! And how to handle form validation including an empty form field, maximum amount of value entered and so on Hi Guys, This is really stumping me here lol i have set my registration page code to email me when a user signs up (once its entered in the database) code: Code: [Select] <?php if (isset($_POST['submitSignUp'])) { // Errors array() $errors = array(); // POST vars $fName = mysql_real_escape_string($_POST['fname']); $lName = mysql_real_escape_string($_POST['lname']); $email = mysql_real_escape_string($_POST['email']); $pass1 = mysql_real_escape_string($_POST['pass1']); $pass2 = mysql_real_escape_string($_POST['pass2']); $cntry = mysql_real_escape_string($_POST['cntry']); // Does passwords match if ($pass1 != $pass2) { $errors[] = "Your passwords don't match."; } // Potential errors // Empty fields if (empty($fName) || empty($lName) || empty($email) || empty($pass1) || empty($pass2)) { $errors[] = "You never filled in all the fields."; } else { // Does user exist? $result = mysql_query("SELECT * FROM `dig_customers` WHERE `email`='$email' LIMIT 1"); if (mysql_num_rows($result) > 0) { $errors[] = "The e-mail address <b>$email</b> has already been registered."; } else { // Empty for now... } } // display errors if any exist if (count($errors) > 0) { print "<div id=\"errorMsg\"><h3>Ooops! There was error(s)</h3><ol>"; foreach($errors as $error) { print "<li>$error</li>"; } print "</ol></div>"; } else { print "<div id=\"okMsg\"><p>All done :) you can now sign in.</p></div>"; // Encrypt the password before insertion $encPass = md5($pass1); // Insert into the database $q = mysql_query("INSERT INTO `dig_customers` (`id`, `password`, `password_unencrypted`, `gender`, `title`, `first_name`, `last_name`, `address`, `city`, `state_county`, `post_zip_code`, `country`, `email`, `home_number`, `mobile_number`, `news_letter`, `special_offers`, `admin_level`, `registered`) VALUES ('', '$encPass', '$pass1', 'NULL', 'NULL', '$fName', '$lName', 'NULL', 'NULL', 'NULL', 'NULL', '$cntry', '$email', 'NULL', 'NULL', 'NULL', 'NULL', 'N', NOW())"); if ($q) { // Alert on signup send_graham_email("User Has Signed Up!"); } } } ?> When i do a test signup on: http://www.digicures.com/sign-up.php everything works great i get an email and the entry is saved in the database, over the paste week or so i have had about 8 emails saying people have signed up but when i check the database there nothing there! i can't understand it, only when the insert query is true should it send me the mail eh? can anyone see any problems with the code at all? cheers guys Graham Currently I'm trying to get a registration form to work adding a username and password into a database. That bit I understand and have managed to do aswell as getting the password to hash using the line below: $hashed = password_hash($password, PASSWORD_DEFAULT);
What I'm trying to do now is have the passwords check to see if they are the same, if so the user is able to register, if not they are sent back to the registration page(which was working before I started tampering with the next bit). I also want to checkto see if the username is taken, the following code is what I have so far: <?php session_start(); /* Attempt MySQL server connection. Assuming you are running MySQL server with default setting (user 'root' with no password) */ $link = mysqli_connect("localhost", "root", "", "rockinrochester"); // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } $sql= mysql_query("SELECT FROM register (username, password) WHERE username=$username"); if(mysql_num_rows($sql)>=1) { echo"name already exists"; } else { $username = $_POST['username']; $password = $_POST['password']; $password2 = $_POST['password2']; $hashed = password_hash($password, PASSWORD_DEFAULT); if($password != $password2) { //checks to see if passwords match, if they don't it redirects person back to registration form header('Location: register.php'); echo "passwords didn't match"; } else { $sql = "INSERT INTO register (username, password) VALUES ( '$username','$hashed')"; // if passwords match inputs them into database } if(mysqli_query($link, $sql)){ header('Location: registered.php'); // if it works relocated person to registered.html } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); // if it fails it prints an error message } // Close connection mysqli_close($link); } ?> <?php session_start(); /* Attempt MySQL server connection. Assuming you are running MySQL server with default setting (user 'root' with no password) */ $link = mysqli_connect("localhost", "root", "", "rockinrochester"); // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } $username = $_POST['username']; $password = $_POST['password']; $password2 = $_POST['password2']; $hashed = password_hash($password, PASSWORD_DEFAULT); $sql = mysql_query("SELECT FROM register(username, password, ) WHERE username=$username"); if(mysql_num_rows($sql)>=1) { echo"name already exists"; } else{ if($password != $password2) { //checks to see if passwords match, if they don't it redirects person back to registration form header('Location: register.php'); echo "passwords didn't match"; } else { $sql = "INSERT INTO register (username, password) VALUES ( '$username','$hashed')"; // if passwords match inputs them into database } if(mysqli_query($link, $sql)){ header('Location: registered.php'); // if it works relocated person to registered.html } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); // if it fails it prints an error message } // Close connection mysqli_close($link); } ?> at the minute It's throwing back the following error Quote
Edited April 4, 2019 by dylfs changing code I'm making a registration form and i want to add a user when i click the registration button, but the user can not already be in the database, i set the user to be unique inside of the database and when i try to add a new user it gives an error message, but instead of that error message i would like to input please enter another user-name or user already exist something like that the error message says duplicate entry 'username' inside of db basically... can someone help me with this ? Dear fourm, i am wondering if anyone can shed some light on this form submission problem with back/forward buttons. long story short: i used to make a form, then submit to a form process php file. errors were difficult to deal with. Thus, many people tell me to submit to the same page. I now submit to the same page. my homepage has a login button. i use a csrf token in a hidden input matched with a session variable. i decided to submit to same page and handle the submit like so: if server request-method = post and isset input name and isset session token then check the token with hash_equals if everything matches then show the login page. i don't have a problem with the form and the form submission processing. everything i fine. now when i use the browser refresh button on the login page, i am sent back to the homepage. all is good. when i press the back button, i go back to the homepage again. super. then i press the forward button in the browser and i get a not connected error. the back button now also shows this error. i tinkered around a bit and added crazy ideas and it worked one time with unset($_POST) as an else to the if mentioned above. the idea is that if server request-method is post without an else. the page is listed below for any get request to process. i assume that the browser is trying to repost data is empty but my if statement should kick it out to the get code, right? what i want is to unset the csrf token and the matching session token for security purposes. i suppose that this breaks the back/forward buttons? how can i get the browser to show the homepage regardless of the post situation? there must be a logical answer. something in my code is breaking this an preventing the browser from simply loading the home page any help is greatly appreciated! Thank you. I need an Event Registration Script that allows for payment with Paypal & saves form details and Paypal transaction ID to my MySQL DB After the payment has been finalized. I want to have ppl be able to register for camp, and with that choose if they want to preorder the new camp DVD, order last camps DVD, order both DVD's or neither DVD. I am not incredible gifted with PHP since I am new so please be gentle. What do you recommend? I would like to learn a little from this process instead of buying a completed script. Thanks below is the code for a registration form. It "works",I mean that the insert query is being performed, some error messages appear. the problem is, i don't understand how "root" is being automatically sent to the database as a username. when logging into phpmyadmin, the username root appears because it is on autofill. but, i don't get why it's filling the registration form with root. i don't see "root" entered on the form, but, after registering, it says "Congratulations root!". If i leave the form blank, i don't get the error message for blank username either. i've just started learning php,so i guess something might be wrong with the code. any help, please? Code: [Select] <html> <head> <link rel="stylesheet" type="text/css" href="reset.css" media="screen" /> <link rel="stylesheet" type="text/css" href="style.css" media="screen" /> <title>Register</title> </head> <body> <div id="layout_wrapper"> <div id="layout_container"> <div id="layout_content"> <div id="site_title"> <h1><a href="home.html">WEBSITE</a></h1> <h2>WEBSITE DESCRI</h2> </div> <div id="header_image"></div> <div class="clearer"> </div> </div> <div id="main"> <div class="post"> <div class="post_top"> <div class="post_title"><h2>REGISTER</h2></div> </div> <div class="post_body"> <?php $error_stat=0; $errorMsg=''; if (isset ($_POST['submit'])){ $username = $_POST['username']; $gender = preg_replace('#[^a-z]#i', '', $_POST['gender']); $b_m = preg_replace('#[^0-9]#i', '', $_POST['birth_month']); $b_d = preg_replace('#[^0-9]#i', '', $_POST['birth_day']); $b_y = preg_replace('#[^0-9]#i', '', $_POST['birth_year']); $email1 = $_POST['email1']; $pass1 = $_POST['pass1']; $pass2 = $_POST['pass2']; $email1 = stripslashes($email1); $pass1 = stripslashes($pass1); $email2 = stripslashes($email2); $pass2 = stripslashes($pass2); $email1 = strip_tags($email1); $pass1 = strip_tags($pass1); $email2 = strip_tags($email2); $pass2 = strip_tags($pass2); include_once "../scripts/connect_to_mysql.php"; $emailCHecker = mysql_real_escape_string($email1); $emailCHecker = str_replace("`", "", $emailCHecker); $sql_uname_check = mysql_query("SELECT user_name FROM tbl_user WHERE user_name='$username'"); $uname_check = mysql_num_rows($sql_uname_check); $sql_email_check = mysql_query("SELECT email FROM tbl_user WHERE email='$emailCHecker'"); $email_check = mysql_num_rows($sql_email_check); if ((!$username) || (!$gender) || (!$b_m) || (!$b_d) || (!$b_y) || (!$email1) || (!$pass1) || (!$pass2)) { $error_stat=1; $errorMsg = 'ERROR: You did not submit the following required information:<br /><br />'; if(!$username){ $errorMsg .= ' * User Name<br />'; } if(!$gender){ $errorMsg .= ' * Sex <br />'; } if(!$b_m){ $errorMsg .= ' * Birth Month<br />'; } if(!$b_d){ $errorMsg .= ' * Birth Day<br />'; } if(!$b_y){ $errorMsg .= ' * Birth year<br />'; } if(!$email1){ $errorMsg .= ' * Email Address<br />'; } if(!$pass1){ $errorMsg .= ' * Login Password<br />'; } if(!$pass2){ $errorMsg .= ' * Confirm Login Password<br />'; } } else if ($pass1 != $pass2) { $errorMsg = 'ERROR: Your Password fields below do not match<br />'; } else if (strlen($username) < 4) { $errorMsg = "<u>ERROR:</u><br />Your User Name is too short. 4 - 20 characters please.<br />"; } else if (strlen($username) > 20) { $errorMsg = "<u>ERROR:</u><br />Your User Name is too long. 4 - 20 characters please.<br />"; } else if ($uname_check > 0){ $errorMsg = "<u>ERROR:</u><br />Your User Name is already in use inside of our system. Please try another.<br />"; } else if ($email_check > 0){ $errorMsg = "<u>ERROR:</u><br />Your Email address is already in use inside of our system. Please use another.<br />"; } else { $email1 = mysql_real_escape_string($email1); $pass1 = mysql_real_escape_string($pass1); $full_birthday = "$b_y-$b_m-$b_d"; $sql = mysql_query("INSERT INTO tbl_user (user_name, sex, dob, date_joined,email, password) VALUES('$username','$gender','$full_birthday', now(),'$email1', '$pass1')") or die (mysql_error()); $id = mysql_insert_id(); echo "<h2>Registration Successful!</h2>"; echo "<p>Congratulations <b>$username</b>, your registration was successful. Your account has now been created with the following details:</p>"; echo "<p><b>Username:</b> $username</p>"; echo "<p><b>Password:</b> $pass1</p>"; echo "<p><b>Sex:</b> $gender</p>"; echo "<p><b>Email:</b> $email1</p>"; echo "<p><b>DOB:</b> $full_birthday</p>"; echo "<p>You may now login.</p>"; } // Close else after duplication checks } if (!isset($_POST['submit']) || $error_stat==1) { ?> <?php echo $errorMsg;?> <form method="POST" action=""> <table> <tr> <td width="114" bgcolor="#FFFFFF">User Name: *</span></td> <td width="452" bgcolor="#FFFFFF"><input name="username" type="text" id="username " size="32" maxlength="20" /> <span id="nameresponse">Alphanumeric Characters Only</span></td> </tr> <tr> <td bgcolor="#EFEFEF">Sex:*</span></td> <td bgcolor="#EFEFEF"><label> <input name="gender" type="radio" id="gender" value="m" checked="checked" />Male <input type="radio" name="gender" id="gender" value="f" />Female </label></td> </tr> <tr> <td bgcolor="#FFFFFF">Date of Birth:*</span></td> <td bgcolor="#FFFFFF"> <select name="birth_month" id="birth_month"> <option value="01">January</option> <option value="02">February</option> <option value="03">March</option> <option value="04">April</option> <option value="05">May</option> <option value="06">June</option> <option value="07">July</option> <option value="08">August</option> <option value="09">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <select name="birth_day" id="birth_day"> <option value="01">1</option> <option value="02">2</option> <option value="03">3</option> <option value="04">4</option> <option value="05">5</option> <option value="06">6</option> <option value="07">7</option> <option value="08">8</option> <option value="09">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <select name="birth_year" id="birth_year"> <option value="2010">2010</option> <option value="2009">2009</option> <option value="2008">2008</option> <option value="2007">2007</option> <option value="2006">2006</option> <option value="2005">2005</option> <option value="2004">2004</option> <option value="2003">2003</option> <option value="2002">2002</option> <option value="2001">2001</option> <option value="2000">2000</option> <option value="1999">1999</option> <option value="1998">1998</option> <option value="1997">1997</option> <option value="1996">1996</option> <option value="1995">1995</option> <option value="1994">1994</option> <option value="1993">1993</option> <option value="1992">1992</option> <option value="1991">1991</option> <option value="1990">1990</option> <option value="1989">1989</option> <option value="1988">1988</option> <option value="1987">1987</option> <option value="1986">1986</option> <option value="1985">1985</option> <option value="1984">1984</option> <option value="1983">1983</option> <option value="1982">1982</option> <option value="1981">1981</option> <option value="1980">1980</option> <option value="1979">1979</option> <option value="1978">1978</option> <option value="1977">1977</option> <option value="1976">1976</option> <option value="1975">1975</option> <option value="1974">1974</option> <option value="1973">1973</option> <option value="1972">1972</option> <option value="1971">1971</option> <option value="1970">1970</option> <option value="1969">1969</option> <option value="1968">1968</option> <option value="1967">1967</option> <option value="1966">1966</option> <option value="1965">1965</option> <option value="1964">1964</option> <option value="1963">1963</option> <option value="1962">1962</option> <option value="1961">1961</option> <option value="1960">1960</option> <option value="1959">1959</option> <option value="1958">1958</option> <option value="1957">1957</option> <option value="1956">1956</option> <option value="1955">1955</option> <option value="1954">1954</option> <option value="1953">1953</option> <option value="1952">1952</option> <option value="1951">1951</option> <option value="1950">1950</option> <option value="1949">1949</option> <option value="1948">1948</option> <option value="1947">1947</option> <option value="1946">1946</option> <option value="1945">1945</option> <option value="1944">1944</option> <option value="1943">1943</option> <option value="1942">1942</option> <option value="1941">1941</option> <option value="1940">1940</option> <option value="1939">1939</option> <option value="1938">1938</option> <option value="1937">1937</option> <option value="1936">1936</option> <option value="1935">1935</option> <option value="1934">1934</option> <option value="1933">1933</option> <option value="1932">1932</option> <option value="1931">1931</option> <option value="1930">1930</option> <option value="1929">1929</option> <option value="1928">1928</option> <option value="1927">1927</option> <option value="1926">1926</option> <option value="1925">1925</option> <option value="1924">1924</option> <option value="1923">1923</option> <option value="1922">1922</option> <option value="1921">1921</option> <option value="1920">1920</option> <option value="1919">1919</option> <option value="1918">1918</option> <option value="1917">1917</option> <option value="1916">1916</option> <option value="1915">1915</option> <option value="1914">1914</option> <option value="1913">1913</option> <option value="1912">1912</option> <option value="1911">1911</option> <option value="1910">1910</option> <option value="1909">1909</option> <option value="1908">1908</option> <option value="1907">1907</option> <option value="1906">1906</option> <option value="1905">1905</option> <option value="1904">1904</option> <option value="1903">1903</option> <option value="1902">1902</option> <option value="1901">1901</option> <option value="1900">1900</option> </select> </td> </tr> <tr> <td bgcolor="#EFEFEF">Email Address:*</span></td> <td bgcolor="#EFEFEF"><input name="email1" type="text" id="email1" size="32" maxlength="48" /></td> </tr> <tr> <td bgcolor="#FFFFFF">Create Password:*</span></td> <td bgcolor="#FFFFFF"><input name="pass1" type="password" id="pass1" size="32" maxlength="16" /> <span>Alphanumeric Characters Only</span></td> </tr> <tr> <td bgcolor="#EFEFEF">Confirm Password: *</span></td> <td bgcolor="#EFEFEF"><input name="pass2" type="password" id="pass2" size="32" maxlength="16" /> <span>Alphanumeric Characters Only</span></td> </tr> <tr> <td><input type="submit" name="submit" value="Sign Up!" /></td> </tr> </table> </form> <?php } ?> </div> <div id="footer"> <div class="left">© 2011</div> <div class="right"><a href="#">....</a><a href="#">....</a></div> <div class="clearer"> </div> </div> </div> </div> </div> </body> </html> Hi, php newbie here, web developer newbie too! Some time ago I did a website which included a course registration form which someone else created for me in php. This worked fine and I amended the original to work on another website. I am currently updating this second website and the php has stopped working, and I am no longer in contact with the original developer of the code. The form is at: http://www.bisntechnologies.com/register.htm, and the php is: <?php /* ------- Stuff You Can Change --------- */ $recipient = 'registration@bisntechnologies.com'; $redirect = 'confirmation.php'; /* -------------------------------------- */ $name = $HTTP_POST_VARS['name']; $company = $HTTP_POST_VARS['company']; $position = $HTTP_POST_VARS['position']; $telephone = $HTTP_POST_VARS['telephone']; $email = $HTTP_POST_VARS['email']; $interest = $HTTP_POST_VARS['interest']; $clientip = $_SERVER['REMOTE_ADDR']; $msg = "Name: $name\nCompany: $company\nPosition: $position\nTelephone: $telephone\nE-mail: $email\nInterest: $interest\n\nIP Address: $clientip"; $replymsg = "<html><body style=\"font-family: Trebuchet MS; font-size: 13px\"><p>Dear $name,</p><p>Thank you for registering.</p><p><a href=\"http://www.bisntechnologies.com\"><img border=0 src=\"http://www.bisntechnologies.com/images/NewLogo.jpg\" alt=\"BiSN Technologies Ltd\"></a></p></body></html>"; if (mail($email,'Registration',$replymsg,"MIME-Version: 1.0\r\nContent-type: text/html;charset=iso-8859-1\r\nFrom: registration@bisntechnologies.com")) { mail($recipient,'Registration Confirmation',$msg,"From: $email"); include($redirect); } else { echo "<h4>\"$email\" is an invalid e-mail address. Please click the browser's Back button.</h4>"; } ?> Putting in valid information gives the error: "" is an invalid e-mail address. Please click the browser's Back button." which it didn't used to do. I expect it is a very simple mistake but I cannot trace it. Any help to pinpoint the problem greatly appreciated. Hello, I am currently coding a site from scratch. I know i can use templates and everything else but i want the experience. The HTML I've had down for years but it seems PHP is getting a little elusive for me. I'm trying to create a registration form and when i test my site i keep getting parse errors and syntax errors... mainly regarding the use of {} and if/else. Any help would be appreciated. Most of the code is still incomplete, I have to go back and fill in some areas I've left blank for now, but i have commented using // Where the browser is kicking back my errors.
- “Any sufficiently advanced technology is indistinguishable from magic” (Arthur C. Clark, 1962)
<?php $con = Mysqli_connect("'', '', ''"); if (Mysqli_connect_errno()) { echo "Failed to connect to DB. Please check your connection info." . Mysqli_connect_errno; // Only if there is an error. } //Declaring Variable for Registration form $fname = ""; $lname = ""; $em = ""; $emc = ""; $pass = ""; $passc = ""; $date = ""; $error_array = ""; if (insert($_POST['register_button'])) { // To handle the registration form // First Name Values $fname = strip_tags($_POST['reg_fname']); $fname = str_replace(' ', '', $fname); $fname = ucfirst(strtolower($fname)); // Last Name Values $lname = strip_tags($_POST['reg_lname']); $lname = str_replace(' ', '', $lname); $lname = ucfirst(strtolower($lname)); // Registration Email Values $em = strip_tags($_POST['reg_email']); $em = str_replace(' ', '', $em); // Confirm Registration Email Values $emc = strip_tags($_POST['reg_emailc']); $emc = str_replace(' ', '', $emc); // Registrsation Password Values $pass = strip_tags($_POST['reg_pass']); // Registration Password Confirmation Values $passc = strip_tags($_POST['reg_passc']); // Registration Date Values $date = date("m-d-Y"); // Here is where the browser keeps kicking back parse errors if ($em == $emc) { } else { echo "Email and Confirmation Email must match"; } if (filter_var($em, FILTER_VALIDATE_EMAIL)) { $em = filter_var($em, FILTER_VALIDATE_EMAIL) } else { echo "Invlaid Format"; } ?>
Any body please, Why my registration form page stoped working, don't feed the dbase any more, I'm the only one with access to make changes but I did not make any changes, just stoped out of no where, any ideas? what is dificult in creating this tables... CREATE TABLE `pois` ( `id` bigint(20) unsigned NOT NULL, `lat` float(10,7) NOT NULL, `lon` float(10,7) NOT NULL, PRIMARY KEY (`id`) ) CREATE TABLE `pois_tag` ( `poisid` int(11) NOT NULL DEFAULT '0', `tagname` varchar(45) NOT NULL DEFAULT '', `tagvalue` varchar(255) DEFAULT NULL, PRIMARY KEY (`poisid`,`tagname`) )i get back the following error ; MySQL meldet: Dokumentation #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CREATE TABLE `pois_tag` ( `poisid` int(11) NOT NULL DEFAULT '0', `tagname`' at line 8many thanks for any and all help Hi all, But of a PHP newbie so treat me nice but this one is driving me nuts I have the exact same login.php file running on two different servers and they have slightly different versions of PHP installed as follows: 1. PHP Version 5.0.4 - version http://www.trafficpaymaster.com/tpm/phpversion.php 2. PHP Version 5.2.15 - version http://www.dentistsinflorida.org/tpm/phpversion.php The login works fine on the first server from he http://www.trafficpaymaster.com/tpm/login.php Email: test@test.com Pwd: test But try it on the second server he http://www.dentistsinflorida.org/tpm/login.php Using the same email and password (which is correct) it just loops round not letting the user into the main script at index.php Question: Why? What have I got wrong for that later version of PHP? Many thanks guys. Hey All! Well, here I am at PHP Freaks mercy again lol. I love this website and everyone here is always so helpful so let's get to my most recent issue. I am developing a pretty simple event registration form, which would be pretty easy in most respects. It will have the following pretty standard fields. Number of people attending: (drop down with 1-10) Name Address City State Zip Email Phone Alternate Phone There will be a few other fields but they aren't relevant. Basically the first field "Number of people attending (drop down 1-10)" will have to create a section with the following fields above for each person's information. If there are 3 people attending then it will need to have 3 sections of all those fields for each person. Making the page dynamically generate those sections on-the-fly when the user selects "3" for example is the first issue I am having. The other issue I am having is how would I handle the information dynamically within the PHP. If there was just one person it would be easy because I could just reference those fields. One solution I have for the second problem that I have some experience with is naming the fields name[] for example. But I still don't have a complete grasp on how to make that fix my problem. I've tried googling for hours but have had no luck, which may be because I'm not sure how to phrase the problem maybe. Any help! This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=342885.0 Ok im only new to PHP and Im trying to setup my own porfolio website using PHP,CSS,HTML5 and other bits. Iv downloaded WAMP and im tryin to get my website workin offline first. Well im just trying to get a section in my site in the top right corner for a login and register area similar to this website (membership section) iv bein following some online video tuts and completed them right but Im not sure how to integrate it into my existing home page,/ index.html page. I want to have it so that it says login or registered and it works through php. all the tuts I followed seem to have this done on one index.php page and im getting confused as to how I can have a small section on my home page just for registering if yano what I mean..... Maybe its a silly question....im still learning....Any help be gratefull Hey Guys! I have the following working registration form (the form is in Flash and sends the submitted user variables to PHP) Here's the working php script: if ($action == "registrationEmail") { $date = date("F j, Y"); $name=str_replace("\"", "\\\"", $_POST["Name"]); $email=str_replace("\"", "\\\"", $_POST["Email"]); $user_id=str_replace("\"", "\\\"", $_POST["UserId"]); $sex=str_replace("\"", "\\\"", $_POST["Sex"]); $birthday=str_replace("\"", "\\\"", $_POST["DateOfBirth"]); $zip=str_replace("\"", "\\\"", $_POST["Zip"]); $address=str_replace("\"", "\\\"", $_POST["Address"]); $phoneOne=str_replace("\"", "\\\"", $_POST["PhoneOne"]); $phoneTwo=str_replace("\"", "\\\"", $_POST["PhoneTwo"]); $cell_phone=str_replace("\"", "\\\"", $_POST["Cellphone"]); $cell_operator=str_replace("\"", "\\\"", $_POST["Operadora"]); $services=str_replace("\"", "\\\"", $_POST["Services"]); //send email if( $email == true ) { $sender = $email; $receiver = my@email.com"; $client_ip = $_SERVER['REMOTE_ADDR']; $email_body = "Email: $email \n\nIP: $client_ip \n\nName: $name \n\nUserId: $user_id \n\nSex: $sex \n\nDate Of Birth: $birthday \n\nZip: $zip \n\nAddress: $address \n\nPhone One: $phoneOne \n\nPhone Two: $phoneTwo \n\nCell Phone: $cell_phone \n\nCell Operator: $cell_operator \n\nServices: $services \n\nDate: $date"; $extra = "From: $sender\r\n" . "Reply-To: $sender \r\n" . "X-Mailer: PHP/" . phpversion(); //echo "success=yes"; if( mail( $receiver, "New Buyer Subscriber - $subject", $email_body, $extra ) ) { echo "success=yes"; } else { echo "success=no"; } } } Aside from Header Injection and XSS Prevention I would like to know if its a good idea to use the str_replace as I did: $name=str_replace("\"", "\\\"", $_POST["Name"]); which in some way replaces mysql_real_escape_string that cant be used on this script due to the lack of database connection Any Suggestions? I need help with this ASAP!!! I pretty sure my boss will fire me if I can not figure this out tonight... PLEASE HELP! I am a graphic designer and not a programmer... PLEASE HELP ME!!! My form will not display the echoed message ("Please fill in all required (*) feilds", "Maximum length for username is 25 characters", etc.) when I hit submit... It wouldn't even show the variables when I tried to just have the form only echo the various strings... nothing appeared... the only way I could get the string values to appear was through a array like this: if(is_array($_POST)){ echo '<pre>'; print_r($_POST); echo '</pre>'; } ^^This returned the data fine... but when I try to echo on particular string and not using the array, nothing appears... This is crucial as this is how the custom error messages are displayed... Here is my PHP code: <?php $submit = $_POST['submit']; //form data $username = strip_tags($_POST['username']); $password = strip_tags($_POST['password']); $passwordrepeat = strip_tags($_POST['passwordrepeat']); $email = strip_tags($_POST['email']); $emailrepeat = strip_tags($_POST['emailrepeat']); $career_status = strip_tags($_POST['career_status']); $name_title = strip_tags($_POST['name_title']); $first_name = strip_tags($_POST['first_name']); $middle_name = strip_tags($_POST['middle_name']); $last_name = strip_tags($_POST['last_name']); $suffix = strip_tags($_POST['suffix']); $current_address1 = strip_tags($_POST['current_address1']); $current_address2 = strip_tags($_POST['current_address2']); $current_city = strip_tags($_POST['current_city']); $current_state = strip_tags($_POST['current_state']); $current_zip = strip_tags($_POST['current_zip']); $phone_home = strip_tags($_POST['phone_home']); $phone_mobile = strip_tags($_POST['phone_mobile']); $preferred_contact = strip_tags($_POST['preferred_contact']); $school_name = strip_tags($_POST['school_name']); $school_city = strip_tags($_POST['school_city']); $school_state = strip_tags($_POST['school_state']); $school_gradYear = strip_tags($_POST['school_gradYear']); $med_school_debt = strip_tags($_POST['med_school_debt']); $monthly_debt_payment = strip_tags($_POST['monthly_debt_payment']); $credit_score = strip_tags($_POST['credit_score']); $marital_status = strip_tags($_POST['marital_status']); $current_employer_name = strip_tags($_POST['current_employer_name']); $current_employer_city = strip_tags($_POST['current_employer_city']); $current_employer_state = strip_tags($_POST['current_employer_state']); $current_position = strip_tags($_POST['current_position']); $current_specialty = strip_tags($_POST['current_specialty']); $current_employer_startDate_mm = strip_tags($_POST['current_employer_startDate_mm']); $current_employer_startDate_yyyy = strip_tags($_POST['current_employer_startDate_yyyy']); $changing_employer = strip_tags($_POST['changing_employer']); $current_employer_endDate_mm = strip_tags($_POST['current_employer_endDate_mm']); $current_employer_endDate_yyyy = strip_tags($_POST['current_employer_endDate_yyyy']); $future_employer_name = strip_tags($_POST['future_employer_name']); $future_employer_city = strip_tags($_POST['future_employer_city']); $future_employer_state = strip_tags($_POST['future_employer_state']); $future_position = strip_tags($_POST['future_position']); $future_specialty = strip_tags($_POST['future_specialty']); $future_employer_startDate_mm = strip_tags($_POST['future_employer_startDate_mm']); $future_employer_startDate_yyyy = strip_tags($_POST['future_employer_startDate_yyyy']); $destination_city = strip_tags($_POST['destination_city']); $destination_state = strip_tags($_POST['destination_state']); $move_date_mm = strip_tags($_POST['move_date_mm']); $move_date_yyyy = strip_tags($_POST['move_date_yyyy']); $prop_single_family = strip_tags($_POST['prop_single_family']); $prop_townhouse = strip_tags($_POST['prop_townhouse']); $prop_condo = strip_tags($_POST['prop_condo']); $prop_co_op = strip_tags($_POST['prop_co_op']); $prop_duplex = strip_tags($_POST['prop_duplex']); $prop_mobile = strip_tags($_POST['prop_mobile']); $prop_other = strip_tags($_POST['prop_other']); $num_bedrooms = strip_tags($_POST['num_bedrooms']); $num_bath = strip_tags($_POST['num_bath']); $price_low = strip_tags($_POST['price_low']); $price_high = strip_tags($_POST['price_high']); $prop_purpose = strip_tags($_POST['prop_purpose']); $need_realtor = strip_tags($_POST['need_realtor']); $need_lender = strip_tags($_POST['need_lender']); $need_refinance_NoCash = strip_tags($_POST['need_refinance_NoCash']); $need_refinance_TakeCash = strip_tags($_POST['need_refinance_TakeCash']); $need_home_equity = strip_tags($_POST['need_home_equity']); $need_commercial = strip_tags($_POST['need_commercial']); $need_practice = strip_tags($_POST['need_practice']); $mortgage_needs = strip_tags($_POST['mortgage_needs']); $most_important = strip_tags($_POST['most_important']); $keep_property_time = strip_tags($_POST['keep_property_time']); $keep_mortgage_time = strip_tags($_POST['keep_mortgage_time']); $program_foundHome_lowDown_NoPMI = strip_tags($_POST['program_foundHome_lowDown_NoPMI']); $program_foundHome_20down_bestRate = strip_tags($_POST['program_foundHome_20down_bestRate']); $program_foundHome_20down_specializedLender = strip_tags($_POST['program_foundHome_20down_specializedLender']); $program_preapproved_physLoan = strip_tags($_POST['program_preapproved_physLoan']); $program_preapproved_coventionalLoan = strip_tags($_POST['program_preapproved_coventionalLoan']); $program_lenderBailed = strip_tags($_POST['program_lenderBailed']); $program_poorCredit = strip_tags($_POST['program_poorCredit']); $referral_source = strip_tags($_POST['referral_source']); $registration_date = date("Y-m-d"); if ($submit) { //check that required fields are completed if ($username&&$password&&$passwordrepeat&&$email&&$emailrepeat&&$career_status&&$first_name&&$last_name) { //encrypt password $password = md5($password); $passwordrepeat = md5($passwordrepeat); if ($password==$passwordrepeat) { //check character length of username and if (strlen($username)>25) { echo "Maximum length for username is 25 characters."; } else { //check password length if (strlen($password)>25||(strlen($password)<6)) { echo "Password must be between 6 and 25 characters in length."; } else { //register the user echo "Success!"; } } } else echo "Your passwords do not match. Please re-enter and hit submit again."; } else echo "Please fill in all required (*) feilds."; } ?> Here is my form: http://www.doctorbrownshoes.com/testPHP/registration.php |