-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Licensing, completed data pages. Started contact email stuff
- Loading branch information
Alex Leith
committed
Mar 7, 2013
1 parent
6679bf5
commit 98ababb
Showing
11 changed files
with
91 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
if(!isset($_POST['submit'])) | ||
{ | ||
//This page should not be accessed directly. Need to submit the form. | ||
echo "error; you need to submit the form!"; | ||
} | ||
$name = $_POST['name']; | ||
$visitor_email = $_POST['email']; | ||
$message = $_POST['message']; | ||
|
||
//Validate first | ||
if(empty($name)||empty($visitor_email)) | ||
{ | ||
echo "Name and email are mandatory!"; | ||
exit; | ||
} | ||
|
||
if(IsInjected($visitor_email)) | ||
{ | ||
echo "Bad email value!"; | ||
exit; | ||
} | ||
|
||
$email_from = 'gis@gcc.tas.gov.au';//<== update the email address | ||
$email_subject = "GCC GIS Website Enquiry"; | ||
$email_body = "Message from: $name.\n". | ||
"Message:\n $message". | ||
|
||
$to = "gis@gcc.tas.gov.au";//<== update the email address | ||
$headers = "From: $email_from \r\n"; | ||
$headers .= "Reply-To: $visitor_email \r\n"; | ||
//Send the email! | ||
mail($to,$email_subject,$email_body,$headers); | ||
//done. redirect to thank-you page. | ||
header('Location: index.html'); | ||
|
||
// Function to validate against any email injection attempts | ||
function IsInjected($str) | ||
{ | ||
$injections = array('(\n+)', | ||
'(\r+)', | ||
'(\t+)', | ||
'(%0A+)', | ||
'(%0D+)', | ||
'(%08+)', | ||
'(%09+)' | ||
); | ||
$inject = join('|', $injections); | ||
$inject = "/$inject/i"; | ||
if(preg_match($inject,$str)) | ||
{ | ||
return true; | ||
} | ||
else | ||
{ | ||
return false; | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters