Jump to content

darrenwindle

Members
  • Posts

    16
  • Joined

  • Last visited

Everything posted by darrenwindle

  1. the gcnumber field is a varhar with a max of 30 chars
  2. Ok ill give the run down of the php[ and sql first before the problem. table - pd_giftcert columns - cust_id, cre_email, pd_gcnumber, timestamp, pd_expiry here's the php pd_giftert.php <?php session_start(); $page_title = 'My Events'; $username = $_SESSION['cre_email']; if (!isset($_SESSION['loggedin'])) { echo "<script language=\"Javascript\">window.location='buy.php?id=$id'</script>"; } include("includes/headerOut.php"); include("dbconn2.php"); include("email.php");?> <!--main Nav--> <?php include('includes/mainNav.php'); ?> <!--Section Title--> <!--primary Content--> <div id="primaryContent"> <?php include('includes/login.php'); ?> </div> <!--Main Content--> <div id="mainContent"> <h1>Buy Gift Certificate</h1> <p></p> <p>Gift cards cost £20 and must be used within 6 months of purchase </p><tr> <td><h3>buy Gift Certifactes</h3></td></tr> <tr> <td height='102'><p>************</p></td> </tr> <tr> <td height='278' class='aligntop'><form action='https://www.paypal.com/cgi-bin/webscr' method='post'> <input type='hidden' name='cmd' value='_xclick'> <input type='hidden' name='business' value='bookings@************.co.uk'> <input type='hidden' name='item_name' value='Gift Certificate'> <input type='hidden' name='amount' value='20'> <br /> <br /> <input type='hidden' name='undefined_quantity' value='1'> <input type='hidden' name='currency_code' value='GBP'> <input type='hidden' name='return' value='http://www.************.co.uk/gc_thanks_payment.php'> <input type='hidden' name='cancel_return' value='http://www.************.co.uk/payment_failed.html'> <input type='hidden' name='receiver_email' value='bookings@************.co.uk'> <input type='hidden' name='mrb' value='************'> <input type='hidden' name='pal' value='************'> <input type='hidden' name='no_shipping' value='0'> <input type='hidden' name='no_note' value='1'> <br /><input type='image' name='submit' src='images/continue.gif' border='0' alt='continue to secure server'> </p> </form> </p> </div> <!--primary Content--> <div id="primaryContent"> <?php include('includes/newEvents.php'); ?> </div> <!--Footer--> <?php include('includes/footer.php'); ?> </div> </div> </body> I need to enter a random 8-16 digit number that is unique in the gc_number column upon clicking the ontinue button on this page. I then need to make sure it is linked to the logged in user who is buying the gift certificate. Also I need to generate a thanks payment page that shows the unique gift certificate with the number that is generated and the email that it is linked to. All this must be inserted into the db table above with all the otjher relevant info. How can I do this. Any help would be appreciated. Thanks
  3. Thankyou for the swift reply. I almost did what you said but instead of creating new column i just hashed the current password column.... set the code to hash any new registerants and update the third sql table as needed.
  4. Ok heres the deal. Im implementing a new section to my website. However the new section has its own login system. I have a login system on the current website that uses plain text passwords instead of md5. Now what i need is the password from the original register.php file and validformregister to be copied as plain text to the main database and also then encoded to md5 into the other database. I dont know how this would be done. Also I dont want to go changing the original database to md5 as there is over 1000 users on the system and dont want to have them all re register. Im doing this so it makes registering on both systems easy and only use 1 form. The code for both is below. register.php <?php session_start(); $page_title = 'Register'; include("includes/header.php");?> <!--main Nav--> <?php include('includes/mainNav.php'); ?> <!--Section Title--> <h1><?php echo $page_title; ?></h1> <!--primary Content--> <div id="primaryContent"> <!--Login--> <?php include('includes/login.php'); ?> <br /><hr /> <br /> <h2><span class="RedGbColor">Subscribe Now</span></h2> <p> Register here and create your profile and to attend an event of your choice (link please).<br /> </div> <!--Main Content--> <div id="mainContent"> <?php $username = $_SESSION['cre_email']; $idg = $_GET['id']; $ids = $idg; $_SESSION['id'] = $ids; //grabs the variables $title = $_POST["title"]; $gender = $_POST["gender"]; $fname = $_POST["fname"]; $lname = $_POST["lname"]; $mobile = $_POST["mobile"]; $usname = $_POST["usname"]; $email = $_POST["email"]; $password = $_POST["password"]; $cpassword = $_POST["cpassword"]; $add1 = $_POST["add1"]; $add2 = $_POST["add2"]; $add3 = $_POST["add3"]; $add4 = $_POST["add4"]; $pcode = $_POST["pcode"]; $dd = $_POST["day"]; $mm = $_POST["month"]; $yyyy = $_POST["year"]; $news = $_POST["newsopt"]; $market = $_POST["market"]; $today = date(mdY); $tmp = explode(':', $title); $cust_gender = $tmp[0]; $cust_title = $tmp[1]; $male_status = $_POST['male_status']; $female_status = $_POST['female_status']; //debug info //error_reporting(E_ALL); //print_r($_GET); //print_r($_POST); //print_r($_SESSION); if ($_SESSION['loggedin'] == 1) { // logged in echo "<script language=\"JavaScript\">window.location='index.php'</script>"; exit(); } else { $month = array( array("01","Jan"), array("02","Feb"), array("03","Mar"), array("04","Apr"), array("05","May"), array("06","Jun"), array("07","Jul"), array("08","Aug"), array("09","Sep"), array("10","Oct"), array("11","Nov"), array("12","Dec") ); echo (" <h2><span class=\"RedGbColor\">Please take a few minutes to register.</span></h2> <div id=\"form1\"> <form action=\"validFormRegister.php?id=$idg\" method=\"post\" enctype=\"multipart/form-data\"> <table width=\"380\"> <tr class=\"formText\"> <td width=\"152\" valign='bottom' style='padding-top:4px;'><label class=\"small\" for='gender'>Gender:</label><em>*</em></td> <td width=\"222\" class='small' style='padding-top:4px;'><input type='radio' name='gender' value='m' $male_status tabindex=\"1\">male <input type='radio' name='gender' value='f' $female_status>female </td> </tr> <tr class=\"formText\"> <td> <label class=\"small\" for='fname'>First Name:</label><em>*</em></td> <td><input name=\"fname\" size=\"30\" tabindex=\"2\" maxlength=\"30\" class=\"txtbx\" value=\"$fname\" /></td> </tr> <tr class=\"formText\"> <td> <label class=\"small\" for='lname'>Last Name:</label><em>*</em></td><td><input name=\"lname\" value='$lname' size=\"30\" maxlength=\"30\" tabindex=\"3\" class=\"txtbx\" /> </td> <tr> <td height=\"29\" colspan=\"2\"><hr /></td> </tr> <tr class=\"formText\"> <td> <label class=\"small\" for='mobile'>Mobile/Phone:</label><em>*</em></td><td><input name=\"mobile\" value='$mobile' size=\"12\" tabindex=\"4\" maxlength=\"12\" class=\"txtbx\" /></td> </tr> <tr class=\"formText\"> <td> <label class=\"small\" for='usname'>Username:</label><em>*</em></td><td><input name=\"usname\" value='$mobile' size=\"12\" tabindex=\"6\" maxlength=\"25\" class=\"txtbx\" /> <a href=\"javascript:alert('This is the username that you can login to the Dating website. This username will not work on the speed dating site. This username is not neccassary. But will improve your overall experience.')\"><small>HELP</small></a> </td> </tr> <tr class=\"formText\"> <td> <label class=\"small\" for=\"email\">Email Address:</label><em>*</em> </td> <td><input name=\"email\" size=\"25\" tabindex=\"5\" value='$email' maxlength=\"100\" class=\"txtbx\" /> </td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"password\">Password:</label><em>*</em></td><td><input type=\"password\" name=\"password\" size=\"12\" maxlength=\"14\" tabindex=\"6\" class=\"txtbx\"> <a href=\"javascript:alert('Your password must be between 4 and 14 characters long.')\"><small>HELP</small></a> </td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"cpassword\">Confirm Password:</label><em>*</em></td><td><input type=\"password\" name=\"cpassword\" size=\"12\" maxlength=\"14\" tabindex=\"7\" class=\"txtbx\"> <a href=\"javascript:alert('Your password must be between 4 and 14 characters long.')\"><small>HELP</small></a> </td> </tr> <tr> <td height=\"29\" colspan=\"2\"><hr /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"add1\">House Name:</label> </td> <td><input name=\"add1\" type=\"text\" tabindex=\"8\" class=\"txtbx\" value='$add1' /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"add2\">Street Address:</label> </td> <td><input name=\"add2\" type=\"text\" tabindex=\"9\" class=\"txtbx\" value='$add2' /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"add3\">Town:</label> </td> <td><input name=\"add3\" type=\"text\" tabindex=\"10\" class=\"txtbx\" value='$add3' /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"add4\">County:</label> </td> <td><input name=\"add4\" type=\"text\" tabindex=\"11\" class=\"txtbx\" value='$add4' /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"pcode\">Post Code:</label> </td> <td><input name=\"pcode\" type=\"text\" tabindex=\"12\" class=\"txtbx\" value='$pcode' /></td> </tr> <tr> <td height=\"29\" colspan=\"2\"><hr /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"market\">How did you hear of us?</label> </td> <td><select name=\"market\" id=\"market\" tabindex=\"13\"> <option value='$market' selected>$market</option> <option value='internet'>Internet search</option> <option value='friend'>Friend recommended</option> <option value='dating site'>Dating site</option> <option value='Gay press'>Gay press</option> <option value='Time Out'>Time Out</option> <option value='Flyer'>Flyer</option> <option value='previous customer'>Previous attendance</option> <option value='other'>Other</option> </select></td> <td> </td> </tr> <tr class=\"formText\"><td><label class=\"small\" for=\"day\">Date </label><label class=\"small\" for=\"Month\"> of </label><label class=\"small\" for=\"Year\"> Birth:</label></td> <td> <select name=\"day\" id=\"day\" tabindex=\"14\"> <option value='$dd'>$dd</option> "); for($i=1; $i<32; $i++) { echo "<option value=\"".$i."\">".$i."\n</option>"; } echo (" </select> <select name=\"month\" id=\"month\" tabindex=\"15\"> <option value='$mm'>$mm</option> "); for($i=0; $i<12; $i++) { echo "<option value=\"".$month[$i][0]."\">".$month[$i][1]."\n</option>"; } echo (" </select> <select name=\"year\" id=\"year\" tabindex=\"16\"> <option value='$yyyy'>$yyyy</option> "); for($i=1912; $i<1993; $i++) { echo "<option value=\"".$i."\">".$i."\n</option>"; } echo (" </select> </td> <td> </td> </tr> <tr class=\"formText\"> <td><label for=\"photo\">Upload a photo</label></td> <td><input name=\"photo\" type=\"file\" tabindex=\"17\"></td> <tr> <td></td> <td>MAX FILE SIZE : 0.5MB <a href=\"javascript:alert('Please upload a photo of yourself. Optimum size is 640 pixels wide by 480 pixels high. Maximum file size of 0.5mb.')\"><small>HELP</small></a><br /><br /> </td> <tr class=\"formText\"> <td><label for=\"newsopt\">I wish to receive newsletters</label> </td> <td> <input name=\"newsopt\" type=\"checkbox\" tabindex=\"18\" id=\"newsOpt\" value='1' checked /> </td> <td> </td> </tr> <tr> <td> </td> <td> <input type=\"submit\" tabindex=\"19\" value=\"Continue\" class=\"btn_sm_left\" id=\"submitBtn\" onclick='this.disabled=true;this.value=\"Please Wait\";document.forms[1].submit();' style='width:120px;'/> <input type=\"reset\" value=\"Reset\" class=\"btn_sm_left\" /></td> <td> </td> </tr> </table> </form> <p class='pink2'><strong>Note</strong>: Fields marked with an <em>asterix (*)</em> are required.</p> "); } ?> </div> </div> <!--primary Content--> <!--Footer--> <?php include('includes/footer.php'); ?> </div> </div> </body> </html> validFormRegister <?php session_start(); $page_title = 'Booking an event'; //grab variables $gender = $_POST["gender"]; $fname = $_POST["fname"]; $lname = $_POST["lname"]; $mobile = $_POST["mobile"]; $email = strtolower($_POST["email"]); $password = $_POST["password"]; $cpassword = $_POST["cpassword"]; $add1 = $_POST["add1"]; $add2 = $_POST["add2"]; $add3 = $_POST["add3"]; $add4 = $_POST["add4"]; $pcode = $_POST["pcode"]; $dd = $_POST["day"]; $mm = $_POST["month"]; $yyyy = $_POST["year"]; $news = $_POST["newsopt"]; $today = date('Y-m-d H:i:s'); $cust_gender = $gender; $username = $_POST["email"]; $id = $_GET["id"]; //error_reporting(E_ALL); $error = array(); include("dbconn2.php"); include("functions.php"); $query1 = "SELECT cre_email from ".pd_credentials." where cre_email = '$email'"; $result1 = mysql_query($query1); $row = mysql_fetch_array($result1); if($row['cre_email'] == $email) { if($row['cre_email'] <> '') { $error[7] = "<li>supplied email address already exists</li><br /> - <li>please telephone if you have forgotten your password or click here to have your password emailed to your registered email address <form action='/pwreminder.php?id=$id' method='post'><input type='hidden' name='email' value='$email' /><input type='submit' name='submit' value='Email me' /></form></li>"; } } echo mysql_error(); mysql_close(); list($user, $mailDomain) = split("@", $email); if (checkdnsrr($mailDomain, "MX")) { $msg = 1; } if(!isset($_POST['gender'])) { $error[0] = "<li>Please supply your gender</li>"; } if(strlen($_POST['fname']) > "30" || strlen($_POST['fname']) < "1" || trim($_POST['fname']) == '') { $error[1] = "<li>Please supply your first name.</li>"; } if(strlen($_POST['lname']) > "30" || strlen($_POST['lname']) < "1" || trim($_POST['lname']) == '') { $error[2] = "<li>Please supply your last name</li>"; } if(preg_match('/^[\(\. ]?\d{4}[\)\. -]*\d{1}[\. -]*\d{6}$/', $_POST['mobile']) === 0) { $error[3] = "<li>Please check you have entered a valid mobile number</li>"; } if(trim($_POST['password']) != trim($_POST['cpassword'])) { $error[5] = "<li>supplied passwords do not match</li>"; } if(strlen($_POST['password']) < "4" || strlen($_POST['password']) > "14" || trim($_POST['password']) == '') { $error[6] = "<li>Your password was not 4 - 14 characters long</li>"; } if(strlen($_POST['day']) > "1" || strlen($_POST['month']) > "1" || strlen($_POST['year']) > "1") { if(checkdate($mm , $dd , $yyyy) != "false") { $error[9] = "<li>Please check your date of birth</li>"; } } if ($_FILES['photo']['type']<>"" && $_FILES['photo']['type'] <> "image/jpg" && $_FILES['photo']['type'] <> "image/jpeg" && $_FILES['photo']['type'] <> "image/pjpeg") { $error[10] = "<li>Invalid photo type. JPG only.</li>"; } // Enter the maximum file size in bytes (1 MB) $max_size = 524288; if (($_FILES['photo']['size'] > $max_size || $_FILES['photo']['size']==0) && ($_FILES['photo']['name']<>"")) { $error[11] = "<li>Invalid photo size. Limit 0.5mb max.</li>"; } if(count($error) < 1) { $_SESSION['loggedin'] = 1; $_SESSION['cre_email'] = $username; if(($yyyy<>"" )&&($mm<>"")&&($dd<>"")) { $dob = "'".$yyyy."/".$mm."/".$dd."'"; } else { $dob = "null"; } $today = mysql_escape_string(trim($today)); $cust_gender = mysql_escape_string(trim($_POST['gender'])); $fname = mysql_escape_string(trim($_POST['fname'])); $lname = mysql_escape_string(trim($_POST['lname'])); $mobile = mysql_escape_string(trim($_POST['mobile'])); $email = mysql_escape_string(trim($_POST['email'])); $password = mysql_escape_string(trim($_POST['password'])); $add1 = mysql_escape_string(trim($_POST['add1'])); $add2 = mysql_escape_string(trim($_POST['add2'])); $add3 = mysql_escape_string(trim($_POST['add3'])); $add4 = mysql_escape_string(trim($_POST['add4'])); $pcode = mysql_escape_string(trim($_POST['pcode'])); $news = mysql_escape_string(trim($_POST['newsopt'])); $market = mysql_escape_string(trim($_POST['market'])); include("dbconn2.php"); $query1 = "SELECT MAX(cust_id) as id FROM pd_customers"; $result1 = mysql_query($query1); while($row = mysql_fetch_array($result1)) { $newID = $row['id'] + 1; } $_SESSION["cust_id"] = $newID; $hasphoto = 0; $url = $_FILES['photo']['name']; if($url<>"") {$hasphoto = 1;} include("dbconn2.php"); $addcust = MYSQL_QUERY("INSERT INTO pd_customers (cust_id,cust_email,cust_surname,cust_title,cust_first_names,cust_mobile,cust_gender,cust_dob,cust_line_1,cust_line_2,cust_line_3,cust_line_4,cust_post_code,cust_country,cust_landline,cust_news,cust_contact, photo)". "VALUES ('$newID', '$email', '$lname', '', '$fname', '$mobile', '$cust_gender', $dob, '$add1', '$add2', '$add3', '$add4', '$pcode', '', '', '$news', '$market', $hasphoto)"); echo(mysql_error()); mysql_close(); include("dbconn2.php"); $addlog = MYSQL_QUERY("INSERT INTO pd_credentials (cre_email,cre_cust_id,cre_password,cre_activated,cre_last_login,cre_disabled,cre_role)". "VALUES ('$email', $newID, '$password', '$today', '$today', '0', 'user')"); echo(mysql_error()); mysql_close(); //success... //now upload the image if it exists $msg = " NEW MEMBER @PINKDATE <br/> <br/> A new member has signed up at PinkDate. <br/><br/> Name: $fname $lname <br/><br/> "; if($hasphoto==1) { $msg.="This member has uploaded a new photo. Login then <a href='http://www.pinkdate.co.uk/adminupdc.php?email=$email'/>click here</a> to view and approve it.<br/><br/>"; $idir = realpath("./photos/"); // Path To Images Directory $tdir = realpath("./photos/thumbs/"); // Path To Thumbnails Directory $twidth = "100"; // Maximum Width For Thumbnail Images $theight = "125"; // Maximum Height For Thumbnail Images $file_ext = strrchr($_FILES['photo']['name'], '.'); // Get The File Extention In The Format Of , For Instance, .jpg, .gif or .php $copy = copy($_FILES['photo']['tmp_name'], "/home3/dummydre/public_html/pinkdate/photos/photo$newID.jpg"); // Move Image From Temporary Location To Permanent Location if ($copy) { // If The Script Was Able To Copy The Image To It's Permanent Location $simg = imagecreatefromjpeg("/home3/dummydre/public_html/pinkdate/photos/photo$newID.jpg"); // Make A New Temporary Image To Create The Thumbanil From $currwidth = imagesx($simg); // Current Image Width $currheight = imagesy($simg); // Current Image Height if ($currheight > $currwidth) { // If Height Is Greater Than Width $zoom = $twidth / $currheight; // Length Ratio For Width $newheight = $theight; // Height Is Equal To Max Height $newwidth = $currwidth * $zoom; // Creates The New Width } else { // Otherwise, Assume Width Is Greater Than Height (Will Produce Same Result If Width Is Equal To Height) $zoom = $twidth / $currwidth; // Length Ratio For Height $newwidth = $twidth; // Width Is Equal To Max Width $newheight = $currheight * $zoom; // Creates The New Height } $dimg = imagecreate($newwidth, $newheight); // Make New Image For Thumbnail imagetruecolortopalette($simg, false, 256); // Create New Color Pallete $palsize = ImageColorsTotal($simg); for ($i = 0; $i < $palsize; $i++) { // Counting Colors In The Image $colors = ImageColorsForIndex($simg, $i); // Number Of Colors Used ImageColorAllocate($dimg, $colors['red'], $colors['green'], $colors['blue']); // Tell The Server What Colors This Image Will Use } imagecopyresized($dimg, $simg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight); // Copy Resized Image To The New Image (So We Can Save It) imagejpeg($dimg, "/home/www/pinkdate/photos/thumbs/photo$newID.jpg"); // Saving The Image imagedestroy($simg); // Destroying The Temporary Image imagedestroy($dimg); // Destroying The Other Temporary Image } else { print '<font color="#FF0000">ERROR: Unable to upload image.</font>'; // Error Message If Upload Failed } } $message = " <p>Hi $fname</p> <p>Thank you for joining Pinkdate</p> <p>Your user name is your email address<strong> "; $message .= $email; $message .= "</strong></p>"; $message .= "<p>Your password is <strong>"; $message .= $password; $message .= "</strong></p><br />"; $message .= "<p><font size=\"-2\">You can change your details in My Account after you have logged in. If there are any problems please"; $message .= " do not hesitate to get in touch on 08444 930615."; include("email.php"); sendEmail($email, "Your PinkDate Membership", $message); $msg.= "To view the members details, <a href='http://www.pinkdate.co.uk/adminupdc.php?email=$email'/>click here</a>.<br/><br/>"; sendEmail("[email]bookings@pinkdate.co.uk[/email]", "New PinkDate Membership", $msg); echo "<script language=\"JavaScript\">window.location='pd_register-confo.php'</script>"; } include("includes/header.php");?> <!--main Nav--> <?php include('includes/mainNav.php'); ?> <!--Section Title--> <h1><?php echo $page_title; ?></h1> <!--primary Content--> <div id="primaryContent"> <h2><span class="RedGbColor">Subscribe Now</span></h2> <p><br /> Register here and create your profile and to attend an event of your choice (link please).<br /> </p> </div> <!--Main Content--> <div id="mainContent"> <?php if(count($error) > 0) { echo ("Sorry $fname $lname there seems to be some sort of problem with your Data Input.<br />Please correct the errors listed below.<br /> <ul>" . $error[0] . "" . $error[1] . "" . $error[2] . "" . $error[3] . "" . $error[4] . "" . $error[5] . "" . $error[6] . "" . $error[7] . "" . $error[8] . "" . $error[9] . "" . $error[10] . "" . $error[11] . "</ul></div>"); // this will print the errors that occurred $male_status = 'unchecked'; $female_status = 'unchecked'; $selected_radio = $_POST['gender']; if ($selected_radio == 'm') { $male_status = 'checked'; } else if ($selected_radio == 'f') { $female_status = 'checked'; } echo (" <div id='middlerightpad'> <form action='register.php?id=$id' method='post'> <input type='hidden' name='male_status' value='$male_status' /> <input type='hidden' name='female_status' value='$female_status' /> <input type='hidden' name='fname' value='$fname' /> <input type='hidden' name='lname' value='$lname' /> <input type='hidden' name='mobile' value='$mobile' /> <input type='hidden' name='email' value='$email' /> <input type='hidden' name='password' value='$password' /> <input type='hidden' name='cpassword' value='$cpassword' /> <input type='hidden' name='add1' value='$add1' /> <input type='hidden' name='add2' value='$add2' /> <input type='hidden' name='add3' value='$add3' /> <input type='hidden' name='add4' value='$add4' /> <input type='hidden' name='pcode' value='$pcode' /> <input type='hidden' name='day' value='$dd' /> <input type='hidden' name='month' value='$mm' /> <input type='hidden' name='year' value='$yyyy' /> <input type='hidden' name='newsopt' value='$news' /> <label for='submit' class='pinkSH'>Go back to Booking</label> <input type='submit' name='submit' value='Booking' class='btn_sm' /> </form> "); } ?> </div> <!--primary Content--> <div id="primaryContent"> </div> <!--Footer--> <?php include('includes/footer.php'); ?> </div> </div> </body> </html> Thanks in advance.
  5. darrenwindle

    Hi

    Hi All, Thought I had better introduce myself here. Allbeit ive been using the forums for a while now but never reall introduced myself. Im a keen php learner and want to further advance my skills. Im working on various projects but these are all small time and are about at my knowledge limits.
  6. I got it working to work in safari now. I moved the include Login above the form in the registration page and not below it. but ill repost the changed scripts here also. Any further help to improve the script s would be advantagous as im still uite a newbie. register.php <?php session_start(); $page_title = 'Register'; include("includes/header.php");?> <!--main Nav--> <?php include('includes/mainNav.php'); ?> <!--Section Title--> <h1><?php echo $page_title; ?></h1> <!--primary Content--> <div id="primaryContent"> <!--Login--> <?php include('includes/login.php'); ?> <br /><hr /> <br /> <h2><span class="RedGbColor">Subscribe Now</span></h2> <p> Register here and create your profile and to attend an event of your choice (link please).<br /> </div> <!--Main Content--> <div id="mainContent"> <?php $username = $_SESSION['cre_email']; $idg = $_GET['id']; $ids = $idg; $_SESSION['id'] = $ids; //grabs the variables $title = $_POST["title"]; $gender = $_POST["gender"]; $fname = $_POST["fname"]; $lname = $_POST["lname"]; $mobile = $_POST["mobile"]; $email = $_POST["email"]; $password = $_POST["password"]; $cpassword = $_POST["cpassword"]; $add1 = $_POST["add1"]; $add2 = $_POST["add2"]; $add3 = $_POST["add3"]; $add4 = $_POST["add4"]; $pcode = $_POST["pcode"]; $dd = $_POST["day"]; $mm = $_POST["month"]; $yyyy = $_POST["year"]; $news = $_POST["newsopt"]; $market = $_POST["market"]; $today = date(mdY); $tmp = explode(':', $title); $cust_gender = $tmp[0]; $cust_title = $tmp[1]; $male_status = $_POST[male_status]; $female_status = $_POST[female_status]; //debug info //error_reporting(E_ALL); //print_r($_GET); //print_r($_POST); //print_r($_SESSION); if ($_SESSION['loggedin'] == 1) { // logged in echo "<script language=\"JavaScript\">window.location='index.php'</script>"; exit(); } else { $month = array( array("01","Jan"), array("02","Feb"), array("03","Mar"), array("04","Apr"), array("05","May"), array("06","Jun"), array("07","Jul"), array("08","Aug"), array("09","Sep"), array("10","Oct"), array("11","Nov"), array("12","Dec") ); echo (" <h2><span class=\"RedGbColor\">Please take a few minutes to register.</span></h2> <div id=\"form1\"> <form action=\"validFormRegister.php?id=$idg\" method=\"post\" enctype=\"multipart/form-data\"> <table width=\"380\"> <tr class=\"formText\"> <td width=\"152\" valign='bottom' style='padding-top:4px;'><label class=\"small\" for='gender'>Gender:</label><em>*</em></td> <td width=\"222\" class='small' style='padding-top:4px;'><input type='radio' name='gender' value='m' $male_status tabindex=\"1\">male <input type='radio' name='gender' value='f' $female_status>female </td> </tr> <tr class=\"formText\"> <td> <label class=\"small\" for='fname'>First Name:</label><em>*</em></td> <td><input name=\"fname\" size=\"30\" tabindex=\"2\" maxlength=\"30\" class=\"txtbx\" value=\"$fname\" /></td> </tr> <tr class=\"formText\"> <td> <label class=\"small\" for='lname'>Last Name:</label><em>*</em></td><td><input name=\"lname\" value='$lname' size=\"30\" maxlength=\"30\" tabindex=\"3\" class=\"txtbx\" /> </td> <tr> <td height=\"29\" colspan=\"2\"><hr /></td> </tr> <tr class=\"formText\"> <td> <label class=\"small\" for='mobile'>Mobile/Phone:</label><em>*</em></td><td><input name=\"mobile\" value='$mobile' size=\"12\" tabindex=\"4\" maxlength=\"12\" class=\"txtbx\" /></td> </tr> <tr class=\"formText\"> <td> <label class=\"small\" for=\"email\">Email Address:</label><em>*</em> </td> <td><input name=\"email\" size=\"25\" tabindex=\"5\" value='$email' maxlength=\"100\" class=\"txtbx\" /> </td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"password\">Password:</label><em>*</em></td><td><input type=\"password\" name=\"password\" size=\"12\" maxlength=\"14\" tabindex=\"6\" class=\"txtbx\"> <a href=\"javascript:alert('Your password must be between 4 and 14 characters long.')\"><small>HELP</small></a> </td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"cpassword\">Confirm Password:</label><em>*</em></td><td><input type=\"password\" name=\"cpassword\" size=\"12\" maxlength=\"14\" tabindex=\"7\" class=\"txtbx\"> <a href=\"javascript:alert('Your password must be between 4 and 14 characters long.')\"><small>HELP</small></a> </td> </tr> <tr> <td height=\"29\" colspan=\"2\"><hr /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"add1\">House Name:</label> </td> <td><input name=\"add1\" type=\"text\" tabindex=\"8\" class=\"txtbx\" value='$add1' /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"add2\">Street Address:</label> </td> <td><input name=\"add2\" type=\"text\" tabindex=\"9\" class=\"txtbx\" value='$add2' /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"add3\">Town:</label> </td> <td><input name=\"add3\" type=\"text\" tabindex=\"10\" class=\"txtbx\" value='$add3' /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"add4\">County:</label> </td> <td><input name=\"add4\" type=\"text\" tabindex=\"11\" class=\"txtbx\" value='$add4' /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"pcode\">Post Code:</label> </td> <td><input name=\"pcode\" type=\"text\" tabindex=\"12\" class=\"txtbx\" value='$pcode' /></td> </tr> <tr> <td height=\"29\" colspan=\"2\"><hr /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"market\">How did you hear of us?</label> </td> <td><select name=\"market\" id=\"market\" tabindex=\"13\"> <option value='$market' selected>$market</option> <option value='internet'>Internet search</option> <option value='friend'>Friend recommended</option> <option value='dating site'>Dating site</option> <option value='Gay press'>Gay press</option> <option value='Time Out'>Time Out</option> <option value='Flyer'>Flyer</option> <option value='previous customer'>Previous attendance</option> <option value='other'>Other</option> </select></td> <td> </td> </tr> <tr class=\"formText\"><td><label class=\"small\" for=\"day\">Date </label><label class=\"small\" for=\"Month\"> of </label><label class=\"small\" for=\"Year\"> Birth:</label></td> <td> <select name=\"day\" id=\"day\" tabindex=\"14\"> <option value='$dd'>$dd</option> "); for($i=1; $i<32; $i++) { echo "<option value=\"".$i."\">".$i."\n</option>"; } echo (" </select> <select name=\"month\" id=\"month\" tabindex=\"15\"> <option value='$mm'>$mm</option> "); for($i=0; $i<12; $i++) { echo "<option value=\"".$month[$i][0]."\">".$month[$i][1]."\n</option>"; } echo (" </select> <select name=\"year\" id=\"year\" tabindex=\"16\"> <option value='$yyyy'>$yyyy</option> "); for($i=1912; $i<1993; $i++) { echo "<option value=\"".$i."\">".$i."\n</option>"; } echo (" </select> </td> <td> </td> </tr> <tr class=\"formText\"> <td><label for=\"photo\">Upload a photo</label></td> <td><input name=\"photo\" type=\"file\" tabindex=\"17\"></td> <tr> <td></td> <td>MAX FILE SIZE : 0.5MB <a href=\"javascript:alert('Please upload a photo of yourself. Optimum size is 640 pixels wide by 480 pixels high. Maximum file size of 0.5mb.')\"><small>HELP</small></a><br /><br /> </td> <tr class=\"formText\"> <td><label for=\"newsopt\">I wish to receive newsletters</label> </td> <td> <input name=\"newsopt\" type=\"checkbox\" tabindex=\"18\" id=\"newsOpt\" value='1' checked /> </td> <td> </td> </tr> <tr> <td> </td> <td> <input type=\"submit\" tabindex=\"19\" value=\"Continue\" class=\"btn_sm_left\" id=\"submitBtn\" onclick='this.disabled=true;this.value=\"Please Wait\";document.forms[1].submit();' style='width:120px;'/> <input type=\"reset\" value=\"Reset\" class=\"btn_sm_left\" /></td> <td> </td> </tr> </table> </form> <p class='pink2'><strong>Note</strong>: Fields marked with an <em>asterix (*)</em> are required.</p> "); } ?> </div> </div> <!--primary Content--> <!--Footer--> <?php include('includes/footer.php'); ?> </div> </div> </body> </html> validFormRegister.php <?php session_start(); $page_title = 'Booking an event'; //grab variables $gender = $_POST["gender"]; $fname = $_POST["fname"]; $lname = $_POST["lname"]; $mobile = $_POST["mobile"]; $email = strtolower($_POST["email"]); $password = $_POST["password"]; $cpassword = $_POST["cpassword"]; $add1 = $_POST["add1"]; $add2 = $_POST["add2"]; $add3 = $_POST["add3"]; $add4 = $_POST["add4"]; $pcode = $_POST["pcode"]; $dd = $_POST["day"]; $mm = $_POST["month"]; $yyyy = $_POST["year"]; $news = $_POST["newsopt"]; $today = date('Y-m-d H:i:s'); $cust_gender = $gender; $username = $_POST["email"]; $id = $_GET["id"]; //error_reporting(E_ALL); $error = array(); include("dbconn2.php"); include("functions.php"); $query1 = "SELECT cre_email from ".pd_credentials." where cre_email = '$email'"; $result1 = mysql_query($query1); $row = mysql_fetch_array($result1); if($row['cre_email'] == $email) { if($row['cre_email'] <> '') { $error[7] = "<li>supplied email address already exists</li><br /> - <li>please telephone if you have forgotten your password or click here to have your password emailed to your registered email address <form action='/pwreminder.php?id=$id' method='post'><input type='hidden' name='email' value='$email' /><input type='submit' name='submit' value='Email me' /></form></li>"; } } echo mysql_error(); mysql_close(); list($user, $mailDomain) = split("@", $email); if (checkdnsrr($mailDomain, "MX")) { $msg = 1; } if(!isset($_POST['gender'])) { $error[0] = "<li>Please supply your gender</li>"; } if(strlen($_POST['fname']) > "30" || strlen($_POST['fname']) < "1" || trim($_POST['fname']) == '') { $error[1] = "<li>Please supply your first name.</li>"; } if(strlen($_POST['lname']) > "30" || strlen($_POST['lname']) < "1" || trim($_POST['lname']) == '') { $error[2] = "<li>Please supply your last name</li>"; } if(preg_match('/^[\(\. ]?\d{4}[\)\. -]*\d{1}[\. -]*\d{6}$/', $_POST['mobile']) === 0) { $error[3] = "<li>Please check you have entered a valid mobile number</li>"; } if(trim($_POST['password']) != trim($_POST['cpassword'])) { $error[5] = "<li>supplied passwords do not match</li>"; } if(strlen($_POST['password']) < "4" || strlen($_POST['password']) > "14" || trim($_POST['password']) == '') { $error[6] = "<li>Your password was not 4 - 14 characters long</li>"; } if(strlen($_POST['day']) > "1" || strlen($_POST['month']) > "1" || strlen($_POST['year']) > "1") { if(checkdate($mm , $dd , $yyyy) != "false") { $error[9] = "<li>Please check your date of birth</li>"; } } if ($_FILES['photo']['type']<>"" && $_FILES['photo']['type'] <> "image/jpg" && $_FILES['photo']['type'] <> "image/jpeg" && $_FILES['photo']['type'] <> "image/pjpeg") { $error[10] = "<li>Invalid photo type. JPG only.</li>"; } // Enter the maximum file size in bytes (1 MB) $max_size = 524288; if (($_FILES['photo']['size'] > $max_size || $_FILES['photo']['size']==0) && ($_FILES['photo']['name']<>"")) { $error[11] = "<li>Invalid photo size. Limit 0.5mb max.</li>"; } if(count($error) < 1) { $_SESSION['loggedin'] = 1; $_SESSION['cre_email'] = $username; if(($yyyy<>"" )&&($mm<>"")&&($dd<>"")) { $dob = "'".$yyyy."/".$mm."/".$dd."'"; } else { $dob = "null"; } $today = mysql_escape_string(trim($today)); $cust_gender = mysql_escape_string(trim($_POST['gender'])); $fname = mysql_escape_string(trim($_POST['fname'])); $lname = mysql_escape_string(trim($_POST['lname'])); $mobile = mysql_escape_string(trim($_POST['mobile'])); $email = mysql_escape_string(trim($_POST['email'])); $password = mysql_escape_string(trim($_POST['password'])); $add1 = mysql_escape_string(trim($_POST['add1'])); $add2 = mysql_escape_string(trim($_POST['add2'])); $add3 = mysql_escape_string(trim($_POST['add3'])); $add4 = mysql_escape_string(trim($_POST['add4'])); $pcode = mysql_escape_string(trim($_POST['pcode'])); $news = mysql_escape_string(trim($_POST['newsopt'])); $market = mysql_escape_string(trim($_POST['market'])); include("dbconn2.php"); $query1 = "SELECT MAX(cust_id) as id FROM pd_customers"; $result1 = mysql_query($query1); while($row = mysql_fetch_array($result1)) { $newID = $row['id'] + 1; } $_SESSION["cust_id"] = $newID; $hasphoto = 0; $url = $_FILES['photo']['name']; if($url<>"") {$hasphoto = 1;} include("dbconn2.php"); $addcust = MYSQL_QUERY("INSERT INTO pd_customers (cust_id,cust_email,cust_surname,cust_title,cust_first_names,cust_mobile,cust_gender,cust_dob,cust_line_1,cust_line_2,cust_line_3,cust_line_4,cust_post_code,cust_country,cust_landline,cust_news,cust_contact, photo)". "VALUES ('$newID', '$email', '$lname', '', '$fname', '$mobile', '$cust_gender', $dob, '$add1', '$add2', '$add3', '$add4', '$pcode', '', '', '$news', '$market', $hasphoto)"); echo(mysql_error()); mysql_close(); include("dbconn2.php"); $addlog = MYSQL_QUERY("INSERT INTO pd_credentials (cre_email,cre_cust_id,cre_password,cre_activated,cre_last_login,cre_disabled,cre_role)". "VALUES ('$email', $newID, '$password', '$today', '$today', '0', 'user')"); echo(mysql_error()); mysql_close(); //success... //now upload the image if it exists $msg = " NEW MEMBER @PINKDATE <br/> <br/> A new member has signed up at PinkDate. <br/><br/> Name: $fname $lname <br/><br/> "; if($hasphoto==1) { $msg.="This member has uploaded a new photo. Login then <a href='http://www.pinkdate.co.uk/adminupdc.php?email=$email'/>click here</a> to view and approve it.<br/><br/>"; $idir = realpath("./photos/"); // Path To Images Directory $tdir = realpath("./photos/thumbs/"); // Path To Thumbnails Directory $twidth = "100"; // Maximum Width For Thumbnail Images $theight = "125"; // Maximum Height For Thumbnail Images $file_ext = strrchr($_FILES['photo']['name'], '.'); // Get The File Extention In The Format Of , For Instance, .jpg, .gif or .php $copy = copy($_FILES['photo']['tmp_name'], "/home/www/pinkdate/photos/photo$newID.jpg"); // Move Image From Temporary Location To Permanent Location if ($copy) { // If The Script Was Able To Copy The Image To It's Permanent Location $simg = imagecreatefromjpeg("/home/www/pinkdate/photos/photo$newID.jpg"); // Make A New Temporary Image To Create The Thumbanil From $currwidth = imagesx($simg); // Current Image Width $currheight = imagesy($simg); // Current Image Height if ($currheight > $currwidth) { // If Height Is Greater Than Width $zoom = $twidth / $currheight; // Length Ratio For Width $newheight = $theight; // Height Is Equal To Max Height $newwidth = $currwidth * $zoom; // Creates The New Width } else { // Otherwise, Assume Width Is Greater Than Height (Will Produce Same Result If Width Is Equal To Height) $zoom = $twidth / $currwidth; // Length Ratio For Height $newwidth = $twidth; // Width Is Equal To Max Width $newheight = $currheight * $zoom; // Creates The New Height } $dimg = imagecreate($newwidth, $newheight); // Make New Image For Thumbnail imagetruecolortopalette($simg, false, 256); // Create New Color Pallete $palsize = ImageColorsTotal($simg); for ($i = 0; $i < $palsize; $i++) { // Counting Colors In The Image $colors = ImageColorsForIndex($simg, $i); // Number Of Colors Used ImageColorAllocate($dimg, $colors['red'], $colors['green'], $colors['blue']); // Tell The Server What Colors This Image Will Use } imagecopyresized($dimg, $simg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight); // Copy Resized Image To The New Image (So We Can Save It) imagejpeg($dimg, "/home/www/pinkdate/photos/thumbs/photo$newID.jpg"); // Saving The Image imagedestroy($simg); // Destroying The Temporary Image imagedestroy($dimg); // Destroying The Other Temporary Image } else { print '<font color="#FF0000">ERROR: Unable to upload image.</font>'; // Error Message If Upload Failed } } $message = " <p>Hi $fname</p> <p>Thank you for joining Pinkdate</p> <p>Your user name is your email address<strong> "; $message .= $email; $message .= "</strong></p>"; $message .= "<p>Your password is <strong>"; $message .= $password; $message .= "</strong></p><br />"; $message .= "<p><font size=\"-2\">You can change your details in My Account after you have logged in. If there are any problems please"; $message .= " do not hesitate to get in touch on 08444 930615."; include("email.php"); sendEmail($email, "Your PinkDate Membership", $message); $msg.= "To view the members details, <a href='http://www.pinkdate.co.uk/adminupdc.php?email=$email'/>click here</a>.<br/><br/>"; sendEmail("bookings@pinkdate.co.uk", "New PinkDate Membership", $msg); echo "<script language=\"JavaScript\">window.location='pd_register-confo.php'</script>"; } include("includes/header.php");?> <!--main Nav--> <?php include('includes/mainNav.php'); ?> <!--Section Title--> <h1><?php echo $page_title; ?></h1> <!--primary Content--> <div id="primaryContent"> <h2><span class="RedGbColor">Subscribe Now</span></h2> <p><br /> Register here and create your profile and to attend an event of your choice (link please).<br /> </p> </div> <!--Main Content--> <div id="mainContent"> <?php if(count($error) > 0) { echo ("Sorry $fname $lname there seems to be some sort of problem with your Data Input.<br />Please correct the errors listed below.<br /> <ul>" . $error[0] . "" . $error[1] . "" . $error[2] . "" . $error[3] . "" . $error[4] . "" . $error[5] . "" . $error[6] . "" . $error[7] . "" . $error[8] . "" . $error[9] . "" . $error[10] . "" . $error[11] . "</ul></div>"); // this will print the errors that occurred $male_status = 'unchecked'; $female_status = 'unchecked'; $selected_radio = $_POST['gender']; if ($selected_radio == 'm') { $male_status = 'checked'; } else if ($selected_radio == 'f') { $female_status = 'checked'; } echo (" <div id='middlerightpad'> <form action='register.php?id=$id' method='post'> <input type='hidden' name='male_status' value='$male_status' /> <input type='hidden' name='female_status' value='$female_status' /> <input type='hidden' name='fname' value='$fname' /> <input type='hidden' name='lname' value='$lname' /> <input type='hidden' name='mobile' value='$mobile' /> <input type='hidden' name='email' value='$email' /> <input type='hidden' name='password' value='$password' /> <input type='hidden' name='cpassword' value='$cpassword' /> <input type='hidden' name='add1' value='$add1' /> <input type='hidden' name='add2' value='$add2' /> <input type='hidden' name='add3' value='$add3' /> <input type='hidden' name='add4' value='$add4' /> <input type='hidden' name='pcode' value='$pcode' /> <input type='hidden' name='day' value='$dd' /> <input type='hidden' name='month' value='$mm' /> <input type='hidden' name='year' value='$yyyy' /> <input type='hidden' name='newsopt' value='$news' /> <label for='submit' class='pinkSH'>Go back to Booking</label> <input type='submit' name='submit' value='Booking' class='btn_sm' /> </form> "); } ?> </div> <!--primary Content--> <div id="primaryContent"> </div> <!--Footer--> <?php include('includes/footer.php'); ?> </div> </div> </body> </html>
  7. Ok i have looked into fixing the issues above. However to go more into the problem im having and I have just noticed this. When I click on submit to submit the form it validates the data via calidFormRegister.php. However when I do the same thing in safari it tries to validate the form using my logonValidation.php. The tag clearly says in the form to use validFormregister.php. Is there any reason why safari thinks it can use a totally un needed php script to validate the signup form.
  8. The errors are different each time. As it processes the validate page, the page comes back with Things like Invalid Email, Please correct Mobile number, etc, etc. this only happens i Safari, or Chrome. But not in IE7, 8, or 9. There is javascript codes running but none that processes the validation at all. It does call to various other files such as header, navigation, footer, etc... but i cant see how these could effect it. Its getting really annoying and im starting to loose customers now.
  9. Hi, I have quite a big problem, im working on a website with a very big problem. Most of the users seem to like to use safari or chrome to navigate the site. The site views quite well in all browsers except for when they come to register. The problem is when they are using safari or chrome on the register page they then hit the submit button to get validaded by the validation script it fails with errors. This only seems to happen on Safari or chrome but not on IExplorer or FF. Ill post the validation and the registration script below. registration.php <?php session_start(); $page_title = 'Register'; include("includes/header.php");?> <!--main Nav--> <?php include('includes/mainNav.php'); ?> <!--Section Title--> <h1><?php echo $page_title; ?></h1> <!--primary Content--> <div id="primaryContent"> <h2><span class="RedGbColor">Subscribe Now</span></h2> <p><br /> Register here and create your profile and to attend an event of your choice (link please).<br /> </p> </div> <!--Main Content--> <div id="mainContent"> <?php $username = $_SESSION['cre_email']; $idg = $_GET['id']; $ids = $idg; $_SESSION['id'] = $ids; //grabs the variables $title = $_POST["title"]; $gender = $_POST["gender"]; $fname = $_POST["fname"]; $lname = $_POST["lname"]; $mobile = $_POST["mobile"]; $email = $_POST["email"]; $password = $_POST["password"]; $cpassword = $_POST["cpassword"]; $add1 = $_POST["add1"]; $add2 = $_POST["add2"]; $add3 = $_POST["add3"]; $add4 = $_POST["add4"]; $pcode = $_POST["pcode"]; $dd = $_POST["day"]; $mm = $_POST["month"]; $yyyy = $_POST["year"]; $news = $_POST["newsopt"]; $market = $_POST["market"]; $today = date(mdY); $tmp = explode(':', $title); $cust_gender = $tmp[0]; $cust_title = $tmp[1]; $male_status = $_POST[male_status]; $female_status = $_POST[female_status]; //debug info //error_reporting(E_ALL); //print_r($_GET); //print_r($_POST); //print_r($_SESSION); if ($_SESSION['loggedin'] == 1) { // logged in echo "<script language=\"JavaScript\">window.location='index.php'</script>"; exit(); } else { $month = array( array("01","Jan"), array("02","Feb"), array("03","Mar"), array("04","Apr"), array("05","May"), array("06","Jun"), array("07","Jul"), array("08","Aug"), array("09","Sep"), array("10","Oct"), array("11","Nov"), array("12","Dec") ); echo (" <h2><span class=\"RedGbColor\">Please take a few minutes to register.</span></h2> <div id=\"form1\"> <form action='validFormRegister.php?id=$idg' method=\"post\" enctype=\"multipart/form-data\"> <table width=\"380\"> <tr class=\"formText\"> <td width=\"152\" valign='bottom' style='padding-top:4px;'><label class=\"small\" for='gender'>Gender:</label><em>*</em></td> <td width=\"222\" class='small' style='padding-top:4px;'><input type='radio' name='gender' value='m' $male_status tabindex=\"1\">male <input type='radio' name='gender' value='f' $female_status>female </td> </tr> <tr class=\"formText\"> <td> <label class=\"small\" for='fname'>First Name:</label><em>*</em></td> <td><input name=\"fname\" size=\"30\" tabindex=\"2\" maxlength=\"30\" class=\"txtbx\" value=\"$fname\"></td> </tr> <tr class=\"formText\"> <td> <label class=\"small\" for='lname'>Last Name:</label><em>*</em></td><td><input name=\"lname\" value='$lname' size=\"30\" maxlength=\"30\" tabindex=\"3\" class=\"txtbx\"> </td> <tr> <td height=\"29\" colspan=\"2\"><hr /></td> </tr> <tr class=\"formText\"> <td> <label class=\"small\" for='mobile'>Mobile/Phone:</label><em>*</em></td><td><input name=\"mobile\" value='$mobile' size=\"12\" tabindex=\"4\" maxlength=\"12\" class=\"txtbx\"></td> </tr> <tr class=\"formText\"> <td> <label class=\"small\" for=\"email\">Email Address:</label><em>*</em> </td> <td><input name=\"email\" size=\"25\" tabindex=\"5\" value='$email' maxlength=\"100\" class=\"txtbx\"> </td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"password\">Password:</label><em>*</em></td><td><input type=\"password\" name=\"password\" size=\"12\" maxlength=\"14\" tabindex=\"6\" class=\"txtbx\"> <a href=\"javascript:alert('Your password must be between 4 and 14 characters long.')\"><small>HELP</small></a> </td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"cpassword\">Confirm Password:</label><em>*</em></td><td><input type=\"password\" name=\"cpassword\" size=\"12\" maxlength=\"14\" tabindex=\"7\" class=\"txtbx\"> <a href=\"javascript:alert('Your password must be between 4 and 14 characters long.')\"><small>HELP</small></a> </td> </tr> <tr> <td height=\"29\" colspan=\"2\"><hr /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"add1\">House Name:</label> </td> <td><input name=\"add1\" type=\"text\" tabindex=\"8\" class=\"txtbx\" value='$add1' /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"add2\">Street Address:</label> </td> <td><input name=\"add2\" type=\"text\" tabindex=\"9\" class=\"txtbx\" value='$add2' /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"add3\">Town:</label> </td> <td><input name=\"add3\" type=\"text\" tabindex=\"10\" class=\"txtbx\" value='$add3' /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"add4\">County:</label> </td> <td><input name=\"add4\" type=\"text\" tabindex=\"11\" class=\"txtbx\" value='$add4' /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"pcode\">Post Code:</label> </td> <td><input name=\"pcode\" type=\"text\" tabindex=\"12\" class=\"txtbx\" value='$pcode' /></td> </tr> <tr> <td height=\"29\" colspan=\"2\"><hr /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"market\">How did you hear of us?</label> </td> <td><select name=\"market\" id=\"market\" tabindex=\"13\"> <option value='$market' selected>$market</option> <option value='internet'>Internet search</option> <option value='friend'>Friend recommended</option> <option value='dating site'>Dating site</option> <option value='Gay press'>Gay press</option> <option value='Time Out'>Time Out</option> <option value='Flyer'>Flyer</option> <option value='previous customer'>Previous attendance</option> <option value='other'>Other</option> </select></td> <td> </td> </tr> <tr class=\"formText\"><td><label class=\"small\" for=\"day\">Date </label><label class=\"small\" for=\"Month\"> of </label><label class=\"small\" for=\"Year\"> Birth:</label></td> <td> <select name=\"day\" id=\"day\" tabindex=\"14\"> <option value='$dd'>$dd</option> "); for($i=1; $i<32; $i++) { echo "<option value=\"".$i."\">".$i."\n"; } echo (" </select> <select name=\"month\" id=\"month\" tabindex=\"15\"> <option value='$mm'>$mm</option> "); for($i=0; $i<12; $i++) { echo "<option value=\"".$month[$i][0]."\">".$month[$i][1]."\n"; } echo (" </select> <select name=\"year\" id=\"year\" tabindex=\"16\"> <option value='$yyyy'>$yyyy</option> "); for($i=1944; $i<1991; $i++) { echo "<option value=\"".$i."\">".$i."\n"; } echo (" </select> </td> <td> </td> </tr> <tr class=\"formText\"> <td><label for=\"photo\">Upload a photo</label></td> <td><input name=\"photo\" type=\"file\" tabindex=\"17\"></td> <tr> <td></td> <td>MAX FILE SIZE : 0.5MB <a href=\"javascript:alert('Please upload a photo of yourself. Optimum size is 640 pixels wide by 480 pixels high. Maximum file size of 0.5mb.')\"><small>HELP</small></a><br /><br /> </td> <tr class=\"formText\"> <td><label for=\"newsopt\">I wish to receive newsletters</label> </td> <td> <input name=\"newsopt\" type=\"checkbox\" tabindex=\"18\" id=\"newsOpt\" value='1' checked /> </td> <td> </td> </tr> <tr> <td> </td> <td> <input type=\"submit\" tabindex=\"19\" value=\"Continue\" class=\"btn_sm_left\" id=\"submitBtn\" onclick='this.disabled=true;this.value=\"Please Wait\";document.forms[1].submit();' style='width:120px;'/> <input type=\"reset\" value=\"Reset\" class=\"btn_sm_left\" /></td> <td> </td> </tr> </table> </form> <p class='pink2'><strong>Note</strong>: Fields marked with an <em>asterix (*)</em> are required.</p> "); } ?> </div> </div> <!--primary Content--> <div id="primaryContent"> <!--Login--> <?php include('includes/login.php'); ?> </div> <!--Footer--> <?php include('includes/footer.php'); ?> </div> </div> </body> </html> validFormRegister.php <?php session_start(); $page_title = 'Booking an event'; //grab variables $gender = $_POST["gender"]; $fname = $_POST["fname"]; $lname = $_POST["lname"]; $mobile = $_POST["mobile"]; $email = strtolower($_POST["email"]); $password = $_POST["password"]; $cpassword = $_POST["cpassword"]; $add1 = $_POST["add1"]; $add2 = $_POST["add2"]; $add3 = $_POST["add3"]; $add4 = $_POST["add4"]; $pcode = $_POST["pcode"]; $dd = $_POST["day"]; $mm = $_POST["month"]; $yyyy = $_POST["year"]; $news = $_POST["newsopt"]; $today = date('Y-m-d H:i:s'); $cust_gender = $gender; $username = $_POST["email"]; $id = $_GET["id"]; //error_reporting(E_ALL); $error = array(); include("dbconn2.php"); include("functions.php"); $query1 = "SELECT cre_email from ".pd_credentials." where cre_email = '$email'"; $result1 = mysql_query($query1); $row = mysql_fetch_array($result1); if($row['cre_email'] == $email) { if($row['cre_email'] <> '') { $error[7] = "<li>supplied email address already exists</li><br /> - <li>please telephone if you have forgotten your password or click here to have your password emailed to your registered email address <form action='/pwreminder.php?id=$id' method='post'><input type='hidden' name='email' value='$email' /><input type='submit' name='submit' value='Email me' /></form></li>"; } } echo mysql_error(); mysql_close(); list($user, $mailDomain) = split("@", $email); if (checkdnsrr($mailDomain, "MX")) { $msg = 1; } if(!isset($_POST['gender'])) { $error[0] = "<li>Please supply your gender</li>"; } if(strlen($_POST['fname']) > "30" || strlen($_POST['fname']) < "1" || trim($_POST['fname']) == '') { $error[1] = "<li>Please supply your first name.</li>"; } if(strlen($_POST['lname']) > "30" || strlen($_POST['lname']) < "1" || trim($_POST['lname']) == '') { $error[2] = "<li>Please supply your last name</li>"; } if(preg_match('/^[\(\. ]?\d{4}[\)\. -]*\d{1}[\. -]*\d{6}$/', $_POST['mobile']) === 0) { $error[3] = "<li>Please check you have entered a valid mobile number</li>"; }   if(trim($_POST['password']) != trim($_POST['cpassword'])) { $error[5] = "<li>supplied passwords do not match</li>"; } if(strlen($_POST['password']) < "4" || strlen($_POST['password']) > "14" || trim($_POST['password']) == '') { $error[6] = "<li>Your password was not 4 - 14 characters long</li>"; } if(strlen($_POST['day']) > "1" || strlen($_POST['month']) > "1" || strlen($_POST['year']) > "1") { if(checkdate($mm , $dd , $yyyy) != "false") { $error[9] = "<li>Please check your date of birth</li>"; } } if ($_FILES['photo']['type']<>"" && $_FILES['photo']['type'] <> "image/jpg" && $_FILES['photo']['type'] <> "image/jpeg" && $_FILES['photo']['type'] <> "image/pjpeg") { $error[10] = "<li>Invalid photo type. JPG only.</li>"; } // Enter the maximum file size in bytes (1 MB) $max_size = 524288; if (($_FILES['photo']['size'] > $max_size || $_FILES['photo']['size']==0) && ($_FILES['photo']['name']<>"")) { $error[11] = "<li>Invalid photo size. Limit 0.5mb max.</li>"; }     if(count($error) < 1) { $_SESSION['loggedin'] = 1; $_SESSION['cre_email'] = $username; if(($yyyy<>"" )&&($mm<>"")&&($dd<>"")) { $dob = "'".$yyyy."/".$mm."/".$dd."'"; } else { $dob = "null"; } $today = mysql_escape_string(trim($today)); $cust_gender = mysql_escape_string(trim($_POST['gender'])); $fname = mysql_escape_string(trim($_POST['fname'])); $lname = mysql_escape_string(trim($_POST['lname'])); $mobile = mysql_escape_string(trim($_POST['mobile'])); $email = mysql_escape_string(trim($_POST['email'])); $password = mysql_escape_string(trim($_POST['password'])); $add1 = mysql_escape_string(trim($_POST['add1'])); $add2 = mysql_escape_string(trim($_POST['add2'])); $add3 = mysql_escape_string(trim($_POST['add3'])); $add4 = mysql_escape_string(trim($_POST['add4'])); $pcode = mysql_escape_string(trim($_POST['pcode'])); $news = mysql_escape_string(trim($_POST['newsopt'])); $market = mysql_escape_string(trim($_POST['market'])); include("dbconn2.php"); $query1 = "SELECT MAX(cust_id) as id FROM pd_customers"; $result1 = mysql_query($query1); while($row = mysql_fetch_array($result1)) { $newID = $row['id'] + 1; } $_SESSION["cust_id"] = $newID; $hasphoto = 0; $url = $_FILES['photo']['name']; if($url<>"") {$hasphoto = 1;} include("dbconn2.php"); $addcust = MYSQL_QUERY("INSERT INTO pd_customers (cust_id,cust_email,cust_surname,cust_title,cust_first_names,cust_mobile,cust_gender,cust_dob,cust_line_1,cust_line_2,cust_line_3,cust_line_4,cust_post_code,cust_country,cust_landline,cust_news,cust_contact, photo)". "VALUES ('$newID', '$email', '$lname', '', '$fname', '$mobile', '$cust_gender', $dob, '$add1', '$add2', '$add3', '$add4', '$pcode', '', '', '$news', '$market', $hasphoto)"); echo(mysql_error()); mysql_close(); include("dbconn2.php"); $addlog = MYSQL_QUERY("INSERT INTO pd_credentials (cre_email,cre_cust_id,cre_password,cre_activated,cre_last_login,cre_disabled,cre_role)". "VALUES ('$email', $newID, '$password', '$today', '$today', '0', 'user')"); echo(mysql_error()); mysql_close(); //success... //now upload the image if it exists $msg = " NEW MEMBER @PINKDATE <br/> <br/> A new member has signed up at PinkDate. <br/><br/> Name: $fname $lname <br/><br/> "; if($hasphoto==1) { $msg.="This member has uploaded a new photo. Login then <a href='http://www.pinkdate.co.uk/adminupdc.php?email=$email'/>click here</a> to view and approve it.<br/><br/>"; $idir = realpath("./photos/"); // Path To Images Directory $tdir = realpath("./photos/thumbs/"); // Path To Thumbnails Directory $twidth = "100"; // Maximum Width For Thumbnail Images $theight = "125"; // Maximum Height For Thumbnail Images $file_ext = strrchr($_FILES['photo']['name'], '.'); // Get The File Extention In The Format Of , For Instance, .jpg, .gif or .php $copy = copy($_FILES['photo']['tmp_name'], "/home/www/pinkdate/photos/photo$newID.jpg"); // Move Image From Temporary Location To Permanent Location if ($copy) { // If The Script Was Able To Copy The Image To It's Permanent Location $simg = imagecreatefromjpeg("/home/www/pinkdate/photos/photo$newID.jpg"); // Make A New Temporary Image To Create The Thumbanil From $currwidth = imagesx($simg); // Current Image Width $currheight = imagesy($simg); // Current Image Height if ($currheight > $currwidth) { // If Height Is Greater Than Width $zoom = $twidth / $currheight; // Length Ratio For Width $newheight = $theight; // Height Is Equal To Max Height $newwidth = $currwidth * $zoom; // Creates The New Width } else { // Otherwise, Assume Width Is Greater Than Height (Will Produce Same Result If Width Is Equal To Height) $zoom = $twidth / $currwidth; // Length Ratio For Height $newwidth = $twidth; // Width Is Equal To Max Width $newheight = $currheight * $zoom; // Creates The New Height } $dimg = imagecreate($newwidth, $newheight); // Make New Image For Thumbnail imagetruecolortopalette($simg, false, 256); // Create New Color Pallete $palsize = ImageColorsTotal($simg); for ($i = 0; $i < $palsize; $i++) { // Counting Colors In The Image $colors = ImageColorsForIndex($simg, $i); // Number Of Colors Used ImageColorAllocate($dimg, $colors['red'], $colors['green'], $colors['blue']); // Tell The Server What Colors This Image Will Use } imagecopyresized($dimg, $simg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight); // Copy Resized Image To The New Image (So We Can Save It) imagejpeg($dimg, "/home/www/pinkdate/photos/thumbs/photo$newID.jpg"); // Saving The Image imagedestroy($simg); // Destroying The Temporary Image imagedestroy($dimg); // Destroying The Other Temporary Image } else { print '<font color="#FF0000">ERROR: Unable to upload image.</font>'; // Error Message If Upload Failed } } $message = " <p>Hi $fname</p> <p>Thank you for joining Pinkdate</p> <p>Your user name is your email address<strong> "; $message .= $email; $message .= "</strong></p>"; $message .= "<p>Your password is <strong>"; $message .= $password; $message .= "</strong></p><br />"; $message .= "<p><font size=\"-2\">You can change your details in My Account after you have logged in. If there are any problems please"; $message .= " do not hesitate to get in touch on 08444 930615."; include("email.php"); sendEmail($email, "Your PinkDate Membership", $message); $msg.= "To view the members details, <a href='http://www.pinkdate.co.uk/adminupdc.php?email=$email'/>click here</a>.<br/><br/>"; sendEmail("bookings@pinkdate.co.uk", "New PinkDate Membership", $msg); echo "<script language=\"JavaScript\">window.location='pd_register-confo.php'</script>"; }     include("includes/header.php");?> <!--main Nav--> <?php include('includes/mainNav.php'); ?> <!--Section Title--> <h1><?php echo $page_title; ?></h1> <!--primary Content--> <div id="primaryContent"> <h2><span class="RedGbColor">Subscribe Now</span></h2> <p><br /> Register here and create your profile and to attend an event of your choice (link please).<br /> </p> </div> <!--Main Content--> <div id="mainContent"> <?php if(count($error) > 0) { echo ("Sorry $fname $lname there seems to be some sort of problem with your Data Input.<br />Please correct the errors listed below.<br /> <ul>" . $error[0] . "" . $error[1] . "" . $error[2] . "" . $error[3] . "" . $error[4] . "" . $error[5] . "" . $error[6] . "" . $error[7] . "" . $error[8] . "" . $error[9] . "" . $error[10] . "" . $error[11] . "</ul></div>"); // this will print the errors that occurred $male_status = 'unchecked'; $female_status = 'unchecked'; $selected_radio = $_POST['gender']; if ($selected_radio == 'm') { $male_status = 'checked'; } else if ($selected_radio == 'f') { $female_status = 'checked'; } echo (" <div id='middlerightpad'> <form action='register.php?id=$id' method='post'> <input type='hidden' name='male_status' value='$male_status' /> <input type='hidden' name='female_status' value='$female_status' /> <input type='hidden' name='fname' value='$fname' /> <input type='hidden' name='lname' value='$lname' /> <input type='hidden' name='mobile' value='$mobile' /> <input type='hidden' name='email' value='$email' /> <input type='hidden' name='password' value='$password' /> <input type='hidden' name='cpassword' value='$cpassword' /> <input type='hidden' name='add1' value='$add1' /> <input type='hidden' name='add2' value='$add2' /> <input type='hidden' name='add3' value='$add3' /> <input type='hidden' name='add4' value='$add4' /> <input type='hidden' name='pcode' value='$pcode' /> <input type='hidden' name='day' value='$dd' /> <input type='hidden' name='month' value='$mm' /> <input type='hidden' name='year' value='$yyyy' /> <input type='hidden' name='newsopt' value='$news' /> <label for='submit' class='pinkSH'>Go back to Booking</label> <input type='submit' name='submit' value='Booking' class='btn_sm' /> </form> "); }     ?> </div> <!--primary Content--> <div id="primaryContent"> </div> <!--Footer--> <?php include('includes/footer.php'); ?> </div> </div> </body> </html>
  10. Hi, Im trying to show an image url on a page. The situation is I have 2 tables in my database events table Event_id Event_name Event_notes img_id Image table img_id img_path I want it to show on specified events the img_path but cant as every time ive tried it shows just the one imge. I have many rows in both tables but need to select the relevant img_path from the 2nd table where the id matches the id from the first table. Heres what I hacve got so far. <?php $sqlimg = "SELECT pd_events.img_id, pd_images.id, pd_images.pd_path, FROM pd_events, pd_images WHERE pd_events.img_id=pd_images.id"; $resultimg = mysql_query($sqlimg) or die(mysql_error()); while ($rowimg = mysql_fetch_array($result)) { echo $rowimg['pd_path']; } ?> <?php echo $row['eve_notes'];?></strong></p>
  11. Hi, Im trying to implement my own php mailinglist script. The list works and i am able to get the list to show on the specified age. however when i try to send a message to the recipients it processes the send.php script but I dont get nothing. (It doesnt send to any email adresses selected. This script was taken from a tutorial on YouTube. My hosting provider is Justhost. the index.php (The page that displays the contents of the sql database that has agreed to be mailed with updates.) <?php session_start(); $page_title = 'Administration'; if (!isset($_SESSION['loggedin'])) { header("Location: ../../login.php"); } include("includes/headerOut.php"); include('includes/nav.php'); ?> <div id="primaryContent"> <?php include('includes/login.php'); ?> <br /> <hr /> <h4>This section is for system administrators only</h4> <h4>If you have arrived here please follow this link to return to the main PinkDate website</h4> <form action="../../index.php"> <input type="image" class="btn_sm_left" value="submit" src="../images/sbumitBtn.jpg" /> </form> </div> <div id="mainContent"> <p> </p> <p><a href="../index.php"><img src="../images/home.jpg" width="41" height="40" border="0"></a></p> <p><a href="../index.php">Home</a></p> <p> <?php require('db/pddb.php'); echo "<h1>Mailing List</h1>Send To<p>"; //setup variables $mailcount = 0; $namecount = 0; $get = mysql_query("SELECT * FROM pd_customers WHERE cust_news='1'"); echo "<form action='send.php' method='GET'>"; while($getrow = mysql_fetch_assoc($get)) { echo "<input type='checkbox' name='mail_".$mailcount++."' value='".$getrow['cust_email']."' CHECKED>".$getrow['cust_first_names']." ".$getrow['cust_last_name']."(".$getrow['cust_email'].") <input type='hidden' name='name_".$namecount++."' value='".$getrow['cust_first_names']."'> <br>"; } echo "<p> Message:<br> <textarea name='message'></textarea><p> <input type='submit' name='submit' value='Send'> </form>"; ?> </div> <?php include('includes/footer.php'); ?> </div> </div> </div> </div> </div> </body> </html> The send.php (The script that processes the reponse from the mailing list form) <?php require('db/pddb.php'); //Change php.ini smtp line ini_set("SMTP", "xxdomain.mailserver.com" //standard mail header $headers = "From: info@xxdomain.co.uk"; //Get Message to send $message = $_GET['message']; //Loop through for($x=0;$x<count($_GET);$x++) { if($_GET['mail_$x']) { //mailsetup $to + $_GET["mail_$x"]; $subject = "Newsletter"; $body = "Dear ".$_GET["name_$x"]." \n\n $message \n\n More Text Here "; mail($to, $subject, $body, $headers); } } echo "All Mail has been processed"; ?>
  12. Umm remember im still quite a noob to php as I stated earlier in this post. So before trying to put people down for their coding techniques read first. I have got the problem solved and have now increased the amount of characters allowed in the name to 30. This must have been a typo at my end. The database allowed 30 to start off with but the code only allowed 10. The only thing I really want to do now is remove the bit where it checks the email with an MX entry but it breaks when i remove it. Any help there would be great.
  13. ok... ive changed the code in my pages but im still getting the same error popping up in 2 out 3 registrations. the error is below. Sorry test testingagai there seems to be some sort of problem with your Data Input. Please correct the errors listed below. •Please supply your last name •There is an error with the email address test@testemail.co.uk you supplied This is really starting to annoy me now. Thanks in advance.
  14. hey thanks for that. Ill look into that more asap and let u know the results.
  15. Sorry for being a bit dumb here... can you please elaborate more for me. As I am still quite new to php. I learnt as I went along building the site. could you highlight the sessions and processing for me..... not a big problem if not though as I know it a long bit of code and can take a lot of time.
  16. ill look at doing that but heres the page that validates it <?php session_start(); $page_title = 'Booking an event'; include("includes/header.php");?> <!--main Nav--> <?php include('includes/mainNav.php'); ?> <!--Section Title--> <h1><?php echo $page_title; ?></h1> <!--primary Content--> <div id="primaryContent"> <h2><span class="RedGbColor">Subscribe Now</span></h2> <p><br /> Register here and create your profile and to attend an event of your choice (link please).<br /> </p> </div> <!--Main Content--> <div id="mainContent"> <?php //grab variables $gender = $_POST["gender"]; $fname = $_POST["fname"]; $lname = $_POST["lname"]; $mobile = $_POST["mobile"]; $email = strtolower($_POST["email"]); $password = $_POST["password"]; $cpassword = $_POST["cpassword"]; $add1 = $_POST["add1"]; $add2 = $_POST["add2"]; $add3 = $_POST["add3"]; $add4 = $_POST["add4"]; $pcode = $_POST["pcode"]; $dd = $_POST["day"]; $mm = $_POST["month"]; $yyyy = $_POST["year"]; $news = $_POST["newsopt"]; $today = date('Y-m-d H:i:s'); $cust_gender = $gender; $username = $_POST["email"]; $id = $_GET["id"]; //error_reporting(E_ALL); $error = array(); include("dbconn2.php"); include("functions.php"); $query1 = "Select cre_email from ".pd_credentials." where cre_email = '$email'"; $result1 = mysql_query($query1); $row = mysql_fetch_array($result1); if($row['cre_email'] == $email) { if($row['cre_email'] <> '') { $error[7] = "<li>supplied email address already exists - please telephone if you have forgotten your password or click here to have your password emailed to your registered email address <form action='/pwreminder.php?id=$id' method='post'><input type='hidden' name='email' value='$email' /><input type='submit' name='submit' value='Email me' /></form></li>"; } } echo mysql_error(); mysql_close(); list($user, $mailDomain) = split("@", $email); if (checkdnsrr($mailDomain, "MX")) { $msg = 1; } if(!isset($_POST['gender'])) { $error[0] = "<li>Please supply your gender</li>"; } if(strlen($_POST['fname']) > "30" || strlen($_POST['fname']) < "1" || trim($_POST['fname']) == '') { $error[1] = "<li>Please supply your first name.</li>"; } if(strlen($_POST['lname']) > "10" || strlen($_POST['lname']) < "1" || trim($_POST['lname']) == '') { $error[2] = "<li>Please supply your last name</li>"; } if(preg_match('/^[\(\. ]?\d{4}[\)\. -]*\d{1}[\. -]*\d{6}$/', $_POST['mobile']) === 0) { $error[3] = "<li>Please check you have entered a valid mobile number</li>"; } if ($msg != 1) { $error[4] = "<li>There is an error with the email address $email you supplied</li>"; } if(trim($_POST['password']) != trim($_POST['cpassword'])) { $error[5] = "<li>supplied passwords do not match</li>"; } if(strlen($_POST['password']) < "4" || strlen($_POST['password']) > "14" || trim($_POST['password']) == '') { $error[6] = "<li>Your password was not 4 - 14 characters long</li>"; } if(strlen($_POST['day']) > "1" || strlen($_POST['month']) > "1" || strlen($_POST['year']) > "1") { if(checkdate($mm , $dd , $yyyy) != "false") { $error[9] = "<li>Please check your date of birth</li>"; } } if ($_FILES['photo']['type']<>"" && $_FILES['photo']['type'] <> "image/jpg" && $_FILES['photo']['type'] <> "image/jpeg" && $_FILES['photo']['type'] <> "image/pjpeg") { $error[10] = "<li>Invalid photo type. JPG only.</li>"; } // Enter the maximum file size in bytes (1 MB) $max_size = 1048576; if (($_FILES['photo']['size'] > $max_size || $_FILES['photo']['size']==0) && ($_FILES['photo']['name']<>"")) { $error[11] = "<li>Invalid photo size. Limit 1MB.</li>"; } if(count($error) > 0) { echo ("Sorry $fname $lname there seems to be some sort of problem with your Data Input.<br />Please correct the errors listed below. <ul>" . $error[0] . "" . $error[1] . "" . $error[2] . "" . $error[3] . "" . $error[4] . "" . $error[5] . "" . $error[6] . "" . $error[7] . "" . $error[8] . "" . $error[9] . "" . $error[10] . "" . $error[11] . "</ul></div>"); // this will print the errors that occurred $male_status = 'unchecked'; $female_status = 'unchecked'; $selected_radio = $_POST['gender']; if ($selected_radio == 'm') { $male_status = 'checked'; } else if ($selected_radio == 'f') { $female_status = 'checked'; } echo (" <div id='middlerightpad'> <form action='register.php?id=$id' method='post'> <input type='hidden' name='male_status' value='$male_status' /> <input type='hidden' name='female_status' value='$female_status' /> <input type='hidden' name='fname' value='$fname' /> <input type='hidden' name='lname' value='$lname' /> <input type='hidden' name='mobile' value='$mobile' /> <input type='hidden' name='email' value='$email' /> <input type='hidden' name='password' value='$password' /> <input type='hidden' name='cpassword' value='$cpassword' /> <input type='hidden' name='add1' value='$add1' /> <input type='hidden' name='add2' value='$add2' /> <input type='hidden' name='add3' value='$add3' /> <input type='hidden' name='add4' value='$add4' /> <input type='hidden' name='pcode' value='$pcode' /> <input type='hidden' name='day' value='$dd' /> <input type='hidden' name='month' value='$mm' /> <input type='hidden' name='year' value='$yyyy' /> <input type='hidden' name='newsopt' value='$news' /> <label for='submit' class='pinkSH'>Go back to Booking</label> <input type='submit' name='submit' value='Booking' class='btn_sm' /> </form> "); } if(count($error) < 1) { $_SESSION['loggedin'] = 1; $_SESSION['cre_email'] = $username; if(($yyyy<>"" )&&($mm<>"")&&($dd<>"")) { $dob = "'".$yyyy."/".$mm."/".$dd."'"; } else { $dob = "null"; } $today = mysql_escape_string(trim($today)); $cust_gender = mysql_escape_string(trim($_POST['gender'])); $fname = mysql_escape_string(trim($_POST['fname'])); $lname = mysql_escape_string(trim($_POST['lname'])); $mobile = mysql_escape_string(trim($_POST['mobile'])); $email = mysql_escape_string(trim($_POST['email'])); $password = mysql_escape_string(trim($_POST['password'])); $add1 = mysql_escape_string(trim($_POST['add1'])); $add2 = mysql_escape_string(trim($_POST['add2'])); $add3 = mysql_escape_string(trim($_POST['add3'])); $add4 = mysql_escape_string(trim($_POST['add4'])); $pcode = mysql_escape_string(trim($_POST['pcode'])); $news = mysql_escape_string(trim($_POST['newsopt'])); $market = mysql_escape_string(trim($_POST['market'])); include("dbconn2.php"); $query1 = "SELECT MAX(cust_id) as id FROM pd_customers"; $result1 = mysql_query($query1); while($row = mysql_fetch_array($result1)) { $newID = $row['id'] + 1; } $_SESSION["cust_id"] = $newID; $hasphoto = 0; $url = $_FILES['photo']['name']; if($url<>"") {$hasphoto = 1;} include("dbconn2.php"); $addcust = MYSQL_QUERY("INSERT INTO pd_customers (cust_id,cust_email,cust_surname,cust_title,cust_first_names,cust_mobile,cust_gender,cust_dob,cust_line_1,cust_line_2,cust_line_3,cust_line_4,cust_post_code,cust_country,cust_landline,cust_news,cust_contact, photo)". "VALUES ('$newID', '$email', '$lname', '', '$fname', '$mobile', '$cust_gender', $dob, '$add1', '$add2', '$add3', '$add4', '$pcode', '', '', '$news', '$market', $hasphoto)"); echo(mysql_error()); mysql_close(); include("dbconn2.php"); $addlog = MYSQL_QUERY("INSERT INTO pd_credentials (cre_email,cre_cust_id,cre_password,cre_activated,cre_last_login,cre_disabled,cre_role)". "VALUES ('$email', $newID, '$password', '$today', '$today', '0', 'user')"); echo(mysql_error()); mysql_close(); //success... //now upload the image if it exists $msg = " NEW MEMBER @PINKDATE <br/> <br/> A new member has signed up at PinkDate. <br/><br/> Name: $fname $lname <br/><br/> "; if($hasphoto==1) { $msg.="This member has uploaded a new photo. Login then <a href='http://www.pinkdate.co.uk/adminupdc.php?email=$email'/>click here</a> to view and approve it.<br/><br/>"; $idir = realpath("./photos/"); // Path To Images Directory $tdir = realpath("./photos/thumbs/"); // Path To Thumbnails Directory $twidth = "100"; // Maximum Width For Thumbnail Images $theight = "125"; // Maximum Height For Thumbnail Images $file_ext = strrchr($_FILES['photo']['name'], '.'); // Get The File Extention In The Format Of , For Instance, .jpg, .gif or .php $copy = copy($_FILES['photo']['tmp_name'], "/home/www/pinkdate/photos/photo$newID.jpg"); // Move Image From Temporary Location To Permanent Location if ($copy) { // If The Script Was Able To Copy The Image To It's Permanent Location $simg = imagecreatefromjpeg("/home/www/pinkdate/photos/photo$newID.jpg"); // Make A New Temporary Image To Create The Thumbanil From $currwidth = imagesx($simg); // Current Image Width $currheight = imagesy($simg); // Current Image Height if ($currheight > $currwidth) { // If Height Is Greater Than Width $zoom = $twidth / $currheight; // Length Ratio For Width $newheight = $theight; // Height Is Equal To Max Height $newwidth = $currwidth * $zoom; // Creates The New Width } else { // Otherwise, Assume Width Is Greater Than Height (Will Produce Same Result If Width Is Equal To Height) $zoom = $twidth / $currwidth; // Length Ratio For Height $newwidth = $twidth; // Width Is Equal To Max Width $newheight = $currheight * $zoom; // Creates The New Height } $dimg = imagecreate($newwidth, $newheight); // Make New Image For Thumbnail imagetruecolortopalette($simg, false, 256); // Create New Color Pallete $palsize = ImageColorsTotal($simg); for ($i = 0; $i < $palsize; $i++) { // Counting Colors In The Image $colors = ImageColorsForIndex($simg, $i); // Number Of Colors Used ImageColorAllocate($dimg, $colors['red'], $colors['green'], $colors['blue']); // Tell The Server What Colors This Image Will Use } imagecopyresized($dimg, $simg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight); // Copy Resized Image To The New Image (So We Can Save It) imagejpeg($dimg, "/home/www/pinkdate/photos/thumbs/photo$newID.jpg"); // Saving The Image imagedestroy($simg); // Destroying The Temporary Image imagedestroy($dimg); // Destroying The Other Temporary Image } else { print '<font color="#FF0000">ERROR: Unable to upload image.</font>'; // Error Message If Upload Failed } } $message = " <p>Hi $fname</p> <p>Thank you for joining Pinkdate</p> <p>Your user name is your email address<strong> "; $message .= $email; $message .= "</strong></p>"; $message .= "<p>Your password is <strong>"; $message .= $password; $message .= "</strong></p><br />"; $message .= "<p><font size=\"-2\">You can change your details in My Account after you have logged in. If there are any problems please"; $message .= " do not hesitate to get in touch on 08444 930615."; include("email.php"); sendEmail($email, "Your PinkDate Membership", $message); $msg.= "To view the members details, <a href='http://www.pinkdate.co.uk/adminupdc.php?email=$email'/>click here</a>.<br/><br/>"; sendEmail("bookings@pinkdate.co.uk", "New PinkDate Membership", $msg); echo "<script language=\"JavaScript\">window.location='pd_register-confo.php'</script>"; } ?> </div> <!--primary Content--> <div id="primaryContent"> </div> <!--Footer--> <?php include('includes/footer.php'); ?> </div> </div> </body> </html>
  17. Hi, Im currently working on a website for a friend. The whole system works but registration is a bit dodgy. most of the time I have to add users via the backend as it throws up error messages. Can some one please look through my code and tell me what im doing wrong. <?php session_start(); $page_title = 'Register'; include("includes/header.php");?> <!--main Nav--> <?php include('includes/mainNav.php'); ?> <!--Section Title--> <h1><?php echo $page_title; ?></h1> <!--primary Content--> <div id="primaryContent"> <h2><span class="RedGbColor">Subscribe Now</span></h2> <p><br /> Register here and create your profile and to attend an event of your choice (link please).<br /> </p> </div> <!--Main Content--> <div id="mainContent"> <?php $username = $_SESSION['cre_email']; $idg = $_GET['id']; $ids = $idg; $_SESSION['id'] = $ids; //grabs the variables $title = $_POST['title']; $gender = $_POST['gender']; $fname = $_POST['fname']; $lname = $_POST['lname']; $mobile = $_POST['mobile']; $email = $_POST['email']; $password = $_POST['password']; $cpassword = $_POST['cpassword']; $add1 = $_POST['add1']; $add2 = $_POST['add2']; $add3 = $_POST['add3']; $add4 = $_POST['add4']; $pcode = $_POST['pcode']; $dd = $_POST['day']; $mm = $_POST['month']; $yyyy = $_POST['year']; $news = $_POST['newsopt']; $market = $_POST['market']; $today = date(mdY); $tmp = explode(':', $title); $cust_gender = $tmp[0]; $cust_title = $tmp[1]; $male_status = $_POST[male_status]; $female_status = $_POST[female_status]; //debug info //error_reporting(E_ALL); //print_r($_GET); //print_r($_POST); //print_r($_SESSION); if ($_SESSION['loggedin'] == 1) { // logged in echo "<script language=\"JavaScript\">window.location='index.php'</script>"; exit(); } else { $month = array( array("01","Jan"), array("02","Feb"), array("03","Mar"), array("04","Apr"), array("05","May"), array("06","Jun"), array("07","Jul"), array("08","Aug"), array("09","Sep"), array("10","Oct"), array("11","Nov"), array("12","Dec") ); echo (' <h2><span class=\"RedGbColor\">Please take a few minutes to register.</span></h2> <div id=\"form1\"> <form action='validFormRegister.php?id=$idg' method=\"post\" enctype=\"multipart/form-data\"> <table width=\"380\"> <tr class=\"formText\"> <td width=\"152\" valign='bottom' style='padding-top:4px;'><label class=\"small\" for='gender'>Gender:</label><em>*</em></td> <td width=\"222\" class='small' style='padding-top:4px;'><input type='radio' name='gender' value='m' $male_status tabindex=\"1\">male <input type='radio' name='gender' value='f' $female_status>female </td> </tr> <tr class=\"formText\"> <td> <label class=\"small\" for='fname'>First Name:</label><em>*</em></td> <td><input name=\"fname\" size=\"25\" tabindex=\"2\" maxlength=\"25\" class=\"txtbx\" value=\"$fname\"></td> </tr> <tr class=\"formText\"> <td> <label class=\"small\" for='lname'>Last Name:</label><em>*</em></td><td><input name=\"lname\" value='$lname' size=\"30\" maxlength=\"30\" tabindex=\"3\" class=\"txtbx\"> </td> <tr> <td height=\"29\" colspan=\"2\"><hr /></td> </tr> <tr class=\"formText\"> <td> <label class=\"small\" for='mobile'>Mobile/Phone:</label><em>*</em></td><td><input name=\"mobile\" value='$mobile' size=\"12\" tabindex=\"4\" maxlength=\"12\" class=\"txtbx\"></td> </tr> <tr class=\"formText\"> <td> <label class=\"small\" for=\"email\">Email Address:</label><em>*</em> </td> <td><input name=\"email\" size=\"25\" tabindex=\"5\" value='$email' maxlength=\"100\" class=\"txtbx\"> </td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"password\">Password:</label><em>*</em></td><td><input type=\"password\" name=\"password\" size=\"12\" maxlength=\"14\" tabindex=\"6\" class=\"txtbx\"> <a href=\"javascript:alert('Your password must be between 4 and 14 characters long.')\"><small>HELP</small></a> </td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"cpassword\">Confirm Password:</label><em>*</em></td><td><input type=\"password\" name=\"cpassword\" size=\"12\" maxlength=\"14\" tabindex=\"7\" class=\"txtbx\"> <a href=\"javascript:alert('Your password must be between 4 and 14 characters long.')\"><small>HELP</small></a> </td> </tr> <tr> <td height=\"29\" colspan=\"2\"><hr /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"add1\">House Name:</label> </td> <td><input name=\"add1\" type=\"text\" tabindex=\"8\" class=\"txtbx\" value='$add1' /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"add2\">Street Address:</label> </td> <td><input name=\"add2\" type=\"text\" tabindex=\"9\" class=\"txtbx\" value='$add2' /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"add3\">Town:</label> </td> <td><input name=\"add3\" type=\"text\" tabindex=\"10\" class=\"txtbx\" value='$add3' /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"add4\">County:</label> </td> <td><input name=\"add4\" type=\"text\" tabindex=\"11\" class=\"txtbx\" value='$add4' /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"pcode\">Post Code:</label> </td> <td><input name=\"pcode\" type=\"text\" tabindex=\"12\" class=\"txtbx\" value='$pcode' /></td> </tr> <tr> <td height=\"29\" colspan=\"2\"><hr /></td> </tr> <tr class=\"formText\"> <td><label class=\"small\" for=\"market\">How did you hear of us?</label> </td> <td><select name=\"market\" id=\"market\" tabindex=\"13\"> <option value='$market' selected>$market</option> <option value='internet'>Internet search</option> <option value='friend'>Friend recommended</option> <option value='dating site'>Dating site</option> <option value='Gay press'>Gay press</option> <option value='Time Out'>Time Out</option> <option value='Flyer'>Flyer</option> <option value='previous customer'>Previous attendance</option> <option value='other'>Other</option> </select></td> <td> </td> </tr> <tr class=\"formText\"><td><label class=\"small\" for=\"day\">Date </label><label class=\"small\" for=\"Month\"> of </label><label class=\"small\" for=\"Year\"> Birth:</label></td> <td> <select name=\"day\" id=\"day\" tabindex=\"14\"> <option value='$dd'>$dd</option> "); for($i=1; $i<32; $i++) { echo "<option value=\"".$i."\">".$i."\n"; } echo (" </select> <select name=\"month\" id=\"month\" tabindex=\"15\"> <option value='$mm'>$mm</option> "); for($i=0; $i<12; $i++) { echo "<option value=\"".$month[$i][0]."\">".$month[$i][1]."\n"; } echo (" </select> <select name=\"year\" id=\"year\" tabindex=\"16\"> <option value='$yyyy'>$yyyy</option> "); for($i=1944; $i<1991; $i++) { echo "<option value=\"".$i."\">".$i."\n"; } echo (" </select> </td> <td> </td> </tr> <tr class=\"formText\"> <td><label for=\"photo\">Upload a photo</label></td> <td><input name=\"photo\" type=\"file\" tabindex=\"17\"></td> <tr> <td></td> <td>MAX FILE SIZE : 1MB <a href=\"javascript:alert('Please upload a photo of yourself. Optimum size is 640 pixels wide by 480 pixels high. Maximum file size of 1MB.')\"><small>HELP</small></a><br /><br /> </td> <tr class=\"formText\"> <td><label for=\"newsopt\">I wish to receive newsletters</label> </td> <td> <input name=\"newsopt\" type=\"checkbox\" tabindex=\"18\" id=\"newsOpt\" value='1' checked /> </td> <td> </td> </tr> <tr> <td> </td> <td> <input type=\"submit\" tabindex=\"19\" value=\"Continue\" class=\"btn_sm_left\" id=\"submitBtn\" onclick='this.disabled=true;this.value=\"Please Wait\";document.forms[1].submit();' style='width:120px;'/> <input type=\"reset\" value=\"Reset\" class=\"btn_sm_left\" /></td> <td> </td> </tr> </table> </form> <p class='pink2'><strong>Note</strong>: Fields marked with an <em>asterix (*)</em> are required.</p> '); } ?> </div> </div> <!--primary Content--> <div id="primaryContent"> <!--Login--> <?php include('includes/login.php'); ?> </div> <!--Footer--> <?php include('includes/footer.php'); ?> </div> </div> </body> </html>
×
×
  • 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.