fork download
  1. <?php
  2.  
  3. //Define variables
  4. $email = $_POST['email'];
  5. $from = 'Landing page';
  6.  
  7. //file contains email adress $to as well as name of $subject
  8. $myemail = parse_ini_file('/email_data.ini');
  9. $subject = parse_ini_file('/email_data.ini')
  10.  
  11. $message = 'New form submission - Email adress: $email';
  12.  
  13.  
  14. //Check if email was entered before submission
  15.  
  16. if (!$_POST['email']) {
  17. $errEmail = 'Please enter a valid email adress'
  18. }
  19.  
  20. // Validate e-mail
  21. if (!filter_var($email, FILTER_VALIDATE_EMAIL) === true) {
  22. echo("$email is not a valid email address");
  23. }
  24.  
  25. /* Send the message using mail() function */
  26. mail($myemail, $subject, $message);
  27.  
  28. // Redirect visitor to link
  29. header('Location: http://w...content-available-to-author-only...r.com');
  30. exit();
  31.  
  32. // ----MYSQL----
  33.  
  34. // Load configuration as an array. Safely stored data like username, db name, pass etc.
  35. $config = parse_ini_file('/config.ini');
  36.  
  37. // Try and connect to the database
  38. $connection = mysqli_connect('localhost',$config['username'],$config['password'],$config['dbname']);
  39.  
  40. // If connection was not successful, handle the error
  41. if($connection === false) {
  42. echo('DB Error')
  43. header( "url=http://w...content-available-to-author-only...r.com" );
  44. }
  45.  
  46. // attempt insert query execution
  47. $sql = "INSERT INTO persons (email_address) VALUES ('$email')";
  48. if(mysqli_query($link, $sql)){
  49. echo "Records added successfully.";
  50. }
  51.  
  52. // close connection
  53. mysqli_close($link);
  54. // ----END MYSQL----
  55. ?>
Runtime error #stdin #stdout #stderr 0.02s 24400KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Parse error:  syntax error, unexpected '$message' (T_VARIABLE) in /home/X6b2es/prog.php on line 11