
December 7th, 2012, 04:19 AM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 1
Time spent in forums: 12 m 22 sec
Reputation Power: 0
|
|
|
PHP-General - Contact.php not found. Server issue?
Hello,
I am not very familiar with php unfortunately.
I am trying to set up a contact form: uebersee.com.sg/contact.html
But my server doesn't find the respective contact.php ("Nothing found for contact Php)"
This is the server:
Server: Localhost via UNIX socket Server version: 5.5.27-cll Protocol version: 10
Does anyone have an idea what's missing or what I do wrong?
Thanks so much!
Philipp
PHP Code:
<?php
// Enter your e-mail address.
$to = 'name@name.com';
// Go to your-site.com/contact.php?test to send a testing email.
if ( isset($_GET['test']) ) {
mail($to, 'Message from contact form', 'It\'s working!', 'From: ' . $to . "\r\n");
die('Testing e-mail has been sent.');
}
// Validate e-mail.
function isValidEmail( $email = null ) {
return preg_match( "/^
[\d\w\/+!=#|$?%{^&}*`'~-]
[\d\w\/\.+!=#|$?%{^&}*`'~-]*@
[A-Z0-9]
[A-Z0-9.-]{0,61}
[A-Z0-9]\.
[A-Z]{2,6}$/ix", $email
);
}
// Validate input.
if ( !empty($_POST['name']) && isValidEmail($_POST['email']) && !empty($_POST['text'])) {
// Set e-mail headers.
$message = $_POST['text'];
$headers = 'From: ' . $_POST['name'] . ' <' . $_POST['email'] . '>' . "\r\n" . 'Reply-To: ' . $_POST['email'];
// Send e-mail.
if ( mail($to, 'Message from contact form', $message, $headers) ) echo 'sent';
} else {
echo 'invalid';
}
?>
|