<?php
/*-----------------------------------------------------------------------
| Phoenix FS v. 1.0.1 |
| Created by Gian_PHP |
| Based on PHP & MySQL |
-------------------------------------------------------------------------
| This program is free software: you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
| the Free Software Foundation, either version 3 of the License, or |
| any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| GNU GPL License: http://www.gnu.org/licenses/gpl.txt |
-------------------------------------------------------------------------
| send.php |
-----------------------------------------------------------------------*/
define('ACCESS', true);
foreach($_POST as $key => $value) {
if($_POST[$key] == '') {
die('Please compile all the fields.');
}
}
require_once './includes/config.inc.php';
require_once './includes/functions.inc.php';
DB_Connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
// admin mail
if(!defined('ADMIN_MAIL')) {
die('Please set an email in the configuration file.');
}
$mail_explode = count(explode('@', ADMIN_MAIL)) - 1;
if($mail_explode != 1) {
die('Email not valid.');
} elseif(!preg_match('/^[\w\.\-]+@\w+[\w\.\-]*?\.\w{1,4}$/', ADMIN_MAIL)) {
die('Email not valid.');
}
// sending mail
foreach($_POST as $key => $value) {
$_POST[$key] = str_replace("\'", "'", $_POST[$key]);
$_POST[$key] = str_replace("\\\"", "\"", $_POST[$key]);
$_POST[$key] = str_replace("\\\\", "", $_POST[$key]);
$_POST[$key] = trim($_POST[$key]);
}
$from = $_POST['from'];
$message = $_POST['message'];
$mail = array();
$mail[subject] = $_POST['subject'];
$mail[message] = 'Hi, you received an e-mail from '.$from.":\r\n";
$fields_query = "SELECT * FROM ".DB_PREF."module_fields";
$fields_result = mysql_query($fields_query);
while($mysql_fields = mysql_fetch_array($fields_result)) {
$mail[message] .= $mysql_fields[field_display_name].": ".$_POST[$mysql_fields[field_name]]."\r\n";
}
$message_check = Check_Field($message);
if($message_check == true) {
die('
<table cellpadding="6" cellspacing="1" bgcolor="#ca2626">
<tr>
<td bgcolor="#e07777">Invalid message content</td>
</tr>
</table>');
}
$mail[message] .= "\r\nMessage: \r\n".$message;
// mail headers
$mail[headers] .= "To: ".ADMIN_MAIL."\r\n";
$mail[headers] .= "From: ".$from."\r\n";
$mail[headers] .= "Reply-To: ".$from."\r\n";
if(mail(ADMIN_MAIL, $mail[subject], $mail[message], $mail[headers])) {
echo '
<table cellpadding="6" cellspacing="1" bgcolor="#3db81c">
<tr>
<td bgcolor="#8fd87b">Mail correctly sent.</td>
</tr>
</table>';
} else {
echo '
<table cellpadding="6" cellspacing="1" bgcolor="#ca2626">
<tr>
<td bgcolor="#e07777">Error during mail sending. <a href="index.php">Back to Module</a></td>
</tr>
</table>';
}
?>