SHARE
TWEET

Untitled

a guest Jul 20th, 2017 477 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. //begin php script
  3. $compemail=$_POST[email];
  4. $compcemail=$_POST[cemail];
  5. if ($compemail === $compcemail)//compare email inputs to check they match
  6. {
  7.     if (preg_match("/^.+@.+\..+/",$compemail))//compare email to a pattern ANY-@-ANY-.-
  8.     {
  9.     //sql login info
  10.     $host="localhost";
  11.     $user="college";
  12.     $password="1981great";
  13.     $dbname="college";
  14.  
  15.     $con = mysql_connect($host,$user,$password);//connect to database if FAIL display error
  16.     if (!$con)
  17.       {
  18.       die('Could not connect this could mean parts of the server are offline PLEASE contact the administrator');
  19.       }
  20.    
  21.     mysql_select_db($dbname, $con);//open database
  22.     //insert data
  23.     $sql="INSERT INTO teachin1 (fname,lname,email,Cv1,Cv2,Cv3,Cv4,Cv5,Cv6,Cv7,Cv8,Cv9)
  24.     VALUES
  25.     ('$_POST[fname]','$_POST[lname]','$_POST[email]','$_POST[Cv1]','$_POST[Cv2]','$_POST[Cv3]','$_POST[Cv4]','$_POST[Cv5]','$_POST[Cv6]','$_POST[Cv7]','$_POST[Cv8]','$_POST[Cv9]') ";
  26.    
  27.    
  28.     if (!mysql_query($sql,$con))//if query failed display error else execute finishing code
  29.         {
  30.         die('Error please contact the administrator quoting: ' . mysql_error());
  31.         }
  32.     else
  33.         {
  34.             echo "<p>Thanks <strong>$_POST[fname], $_POST[lname]</strong><br/>your choice has been saved</p>an email has been sent to <strong>$_POST[email]</strong> detailing your choices";
  35.             echo "<br/><a href='index.html'>GO BACK</a>";
  36.             //$to=$_POST[email];
  37.             //$headers = "From: admin@armouredcrow.org";
  38.             //$subject=$_POST[fname]+", course submission";
  39.             //$body="Thank you $_POST[fname] $_POST[lname] your submission is compleate";
  40.             //mail($to,$subject,$body,$headers);
  41.    
  42.         }
  43.    
  44.     mysql_close($con);//close sql connection
  45.     }
  46.     else
  47.     {
  48.     echo "<p>Invalid email adress please go back and try again</p><br/>";//if email dosnt match pattern dump previous display error
  49.     }
  50. }
  51. else
  52. {
  53. echo "<p>Sorry your email adresses didnt match please go back and try again</p><br/>";//if emails dont match display error
  54. }
  55. //end php script
  56. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top