Динамическая страница
Здравствуйте, подскажите почему не работает пхп код в динамической странице?
<?php
@session_start();
// Your e-mail address
$to = "test@test.ru";
// "Subject:" line in the e-mail
$subject = "Website Feedback";
// Date format
$date = date ("l, F jS, Y");
// Time format
$time = date ("h:i A");
// Message at the beginning of the e-mail body
$intro = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";
// Form field validation. Specify the names of required form fields.
$formval = array(
"name",
"email",
"message",
"security_code"
);
// Enable/Disable email address structure validation: Set to 1 to enable, set to 0 to disable
$emailval = 0;
// Enable/Disable logging: Set to 1 to enable, set to 0 to disable
$logging = 0;
// Enable/Disable file attachments: Set to 1 to enable, set to 0 to disable
$attachments = 0;
// Acceptable file types
$file_types = array(
"jpe",
"jpg",
"jpeg",
"gif",
"bmp",
"png",
"avi",
"mpg",
"mpeg",
"mov",
"ram",
"qt",
"au",
"wav",
"mid",
"midi",
"wmv",
"mp3",
"ra",
"flv",
"txt",
"doc",
"xls",
"ppt",
"zip",
"tar",
"tgz",
"gz",
"gzip",
"rar",
);
// Number of file upload fields
$uploads = 1;
// Maximum file size for attachments (measured in bytes)
$max_file_size = 2048000;
// path to your logfile directory
$logpath = "logs/";
$userip = $_SERVER['REMOTE_ADDR'];
if (!isset($_POST['submit'])) {
// ===============================================
// The form below may be edited to add form fields.
// ===============================================
?>
<script language="javascript">
function updateimage(){
document.getElementById('captcha').src='mailcode-includes/captcha.php?'+Math.random();
}
</script>
<table>
<tr>
<td align="left">
<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="address" value="<?php echo $userip; ?>"><br>
Name:<br>
<input type="text" name="name" size="40"><br>
Email Address:<br>
<input type="text" name="email" size="40"><br>
<?php
// ========================================================================================
// Begin Attachments: Do Not Delete This Section. Enable/Disable attachments in script config.
// ========================================================================================
if ($attachments == 1) {
echo str_repeat('
Attachment:<br><input type="file" name="attachment[]" size="28">
<input type="hidden" name="MAX_FILE_SIZE" value="' . $max_file_size . '"><br>
',$uploads);
}
// ========================================================================================
// End Attachments
// ========================================================================================
?>
Message:<br>
<textarea name="message" rows="5" cols="30"></textarea><br>
Security Code:<br>
<img src="/mailcode-includes/captcha.php" name="captcha" id="captcha" alt="Security Code" title="Security Code"><br>
Type the Code:<br>
<input id="security_code" name="security_code" type="text">
<input type="submit" name="submit" value="Send">
<input type="reset" value="Clear">
</form>
</td>
</tr>
<tr>
<td align="center">
<br><a href="javascript:updateimage();">Click Here</a> for a new code.<br><br>
</td>
</tr>
</table>
<?php
// ====================================================== //
// ============= Do Not Edit Below This Line =============== //
// ===================================================== //
}
else {
function check_email_address($email) {
// First, we check that there's one @ symbol, and that the lengths are right
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
return false;
}
// Split it into sections to make life easier
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
return false;
}
}
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
return false; // Not enough parts to domain
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
return false;
}
}
}
return true;
}
$boundary = md5(date('r', time()));
$msg = "This is a multi-part message in MIME format.\n\n";
$msg .= "--$boundary\n";
$msg .= "Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes\n";
$msg .= "Content-Transfer-Encoding: 7bit\n\n";
$msg .= "$intro\n";
foreach ($_POST as $key => $string) {
$posted[] = $key;
$value = stripslashes($string);
if (in_array($key,$formval) && ($value == NULL || $value == '')) {
$results[] = ucfirst($key) . " cannot be blank!";
$bademail = true;
}
if ($key == "email" && !check_email_address($value)) {
$results[] = "Invalid email address!";
$bademail = true;
}
if($key == "security_code" && $value != ($_SESSION['security_code'])) {
$results[] = "Wrong security code!";
$bademail = true;
}
if ($key != "security_code" && $key != "submit" && $key !="MAX_FILE_SIZE" && $key != "message") {
$msg .= ucfirst($key) . " : " . $value . "\n";
}
if ($key == name) {
$name = $value;
}
if ($key == email) {
$headers = "From: " . $name . " <" . $value . ">\n";
$headers .= "Reply-To: " . $value . "\n";
$headers .= "Return-Path: " . $value . "\n";
$headers .= "Envelope-from: " . $value . "\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\n";
}
if ($key == "message") {
$message = "\n\n$value\n";
}
}
foreach ($formval as $string) {
if (!in_array($string,$posted)) {
$results[] = ucfirst($string) . " cannot be blank!";
$bademail = true;
}
}
$msg .= $message;
if ($attachments == 0) {
$msg .= "--$boundary--\n";
}
else if (isset($_FILES['attachment']) && $attachments == 1) {
foreach ($_FILES["attachment"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
echo"$error_codes[$error]";
if (move_uploaded_file($_FILES["attachment"]["tmp_name"][$key], 'tmp/' . $_FILES["attachment"]["name"][$key]) or die("Problems with upload")) {
$file_upload = true;
$tmp_path = 'tmp/' . $_FILES["attachment"]["name"][$key];
$file = fopen($tmp_path,'rb');
$data = fread($file,filesize($tmp_path));
fclose($file);
}
$attachment = chunk_split(base64_encode($data));
$attachment_name = $_FILES['attachment']['name'][$key];
$attachment_type = $_FILES['attachment']['type'][$key];
$attachment_size = $_FILES['attachment']['size'][$key];
$file_extension = strtolower(substr(strrchr($attachment_name,"."),1));
$msg .= "\n--$boundary\n";
$msg .= "Content-Type: $attachment_type; name=\"$attachment_name\"\n";
$msg .= "Content-Transfer-Encoding: base64\n";
$msg .= "Content-Disposition: attachment; filename=$attachment_name\n\n\n";
$msg .= "$attachment\n";
}
}
}
if ($attachments == 1 && $attachment_size > $max_file_size && $file_upload == true) {
$results[] = 'The uploaded file size is too big!';
}
else if ($attachments == 1 && !in_array($file_extension, $file_types) && $file_upload == true) {
$results[] = 'The uploaded file type is not an acceptable type!';
}
else if ($emailval == 1) {
if ($bademail != true) {
mail($to, $subject, $msg, $headers);
$results[] = 'Thank You! Your message has been submitted!';
}
}
if ($logging == 1) {
$timestamp = date('Y-m-d');
foreach ($_POST as $key => $string) {
$value = stripslashes($string);
if ($key == 'security_code') {
$logmsg .= ucfirst ($key) . " : Submitted: " . $value . " => Required: " . $_SESSION['security_code'] . "\n";
}
else {
$logmsg .= ucfirst ($key) . " : " . $value . "\n";
}
}
$logmsg .= "\n";
if (isset($_FILES["attachment"]["error"])) {
foreach ($_FILES["attachment"]["error"] as $filekey => $fileerror) {
if ($fileerror == UPLOAD_ERR_OK) {
$logmsg .= "Attachment " . $filekey . " : " . $_FILES["attachment"]["name"][$filekey] . "\n";
}
}
}
$logmsg .= "\n";
if ($bademail == true) {
foreach ($results as $result) {
$logmsg .= "Error : " . $result . "\n";
}
$logmsg .= "\n";
}
$logmsg .= "Referrer : " . $_SERVER['HTTP_REFERER'] . "\n";
$logmsg .= "User Agent : " . $_SERVER['HTTP_USER_AGENT'] . "\n";
if (file_exists($logpath . $timestamp . '.txt')) {
$fh = fopen($logpath . $timestamp . '.txt', 'a+') or die( "Error opening file" );
}
else {
$fh = fopen($logpath . $timestamp . '.txt', 'w') or die( "Error opening file" );
}
if (!fwrite($fh, $logmsg)) { die( "Error writing to file!" ); }
if (!fwrite($fh, "\n---------------\n\n")) { die( "Error writing to file!" ); }
fclose($fh) or die( "Error closing file!" );
}
session_unregister(security_code);
}
if (file_exists($tmp_path)) {
unlink($tmp_path);
}
if (!empty($results)) {
echo '<ul>';
foreach ($results as $result) {
echo '<li>' . $result . '</li>';
}
echo '</ul>';
$errors = '';
}
if ($handle = opendir('tmp/')) {
while (false !== ($file = readdir($handle))) {
if (is_file('tmp/' . $file)) {
unlink('tmp/' . $file);
}
}
closedir($handle);
}
?>
@session_start();
// Your e-mail address
$to = "test@test.ru";
// "Subject:" line in the e-mail
$subject = "Website Feedback";
// Date format
$date = date ("l, F jS, Y");
// Time format
$time = date ("h:i A");
// Message at the beginning of the e-mail body
$intro = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";
// Form field validation. Specify the names of required form fields.
$formval = array(
"name",
"email",
"message",
"security_code"
);
// Enable/Disable email address structure validation: Set to 1 to enable, set to 0 to disable
$emailval = 0;
// Enable/Disable logging: Set to 1 to enable, set to 0 to disable
$logging = 0;
// Enable/Disable file attachments: Set to 1 to enable, set to 0 to disable
$attachments = 0;
// Acceptable file types
$file_types = array(
"jpe",
"jpg",
"jpeg",
"gif",
"bmp",
"png",
"avi",
"mpg",
"mpeg",
"mov",
"ram",
"qt",
"au",
"wav",
"mid",
"midi",
"wmv",
"mp3",
"ra",
"flv",
"txt",
"doc",
"xls",
"ppt",
"zip",
"tar",
"tgz",
"gz",
"gzip",
"rar",
);
// Number of file upload fields
$uploads = 1;
// Maximum file size for attachments (measured in bytes)
$max_file_size = 2048000;
// path to your logfile directory
$logpath = "logs/";
$userip = $_SERVER['REMOTE_ADDR'];
if (!isset($_POST['submit'])) {
// ===============================================
// The form below may be edited to add form fields.
// ===============================================
?>
<script language="javascript">
function updateimage(){
document.getElementById('captcha').src='mailcode-includes/captcha.php?'+Math.random();
}
</script>
<table>
<tr>
<td align="left">
<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="address" value="<?php echo $userip; ?>"><br>
Name:<br>
<input type="text" name="name" size="40"><br>
Email Address:<br>
<input type="text" name="email" size="40"><br>
<?php
// ========================================================================================
// Begin Attachments: Do Not Delete This Section. Enable/Disable attachments in script config.
// ========================================================================================
if ($attachments == 1) {
echo str_repeat('
Attachment:<br><input type="file" name="attachment[]" size="28">
<input type="hidden" name="MAX_FILE_SIZE" value="' . $max_file_size . '"><br>
',$uploads);
}
// ========================================================================================
// End Attachments
// ========================================================================================
?>
Message:<br>
<textarea name="message" rows="5" cols="30"></textarea><br>
Security Code:<br>
<img src="/mailcode-includes/captcha.php" name="captcha" id="captcha" alt="Security Code" title="Security Code"><br>
Type the Code:<br>
<input id="security_code" name="security_code" type="text">
<input type="submit" name="submit" value="Send">
<input type="reset" value="Clear">
</form>
</td>
</tr>
<tr>
<td align="center">
<br><a href="javascript:updateimage();">Click Here</a> for a new code.<br><br>
</td>
</tr>
</table>
<?php
// ====================================================== //
// ============= Do Not Edit Below This Line =============== //
// ===================================================== //
}
else {
function check_email_address($email) {
// First, we check that there's one @ symbol, and that the lengths are right
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
return false;
}
// Split it into sections to make life easier
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
return false;
}
}
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
return false; // Not enough parts to domain
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
return false;
}
}
}
return true;
}
$boundary = md5(date('r', time()));
$msg = "This is a multi-part message in MIME format.\n\n";
$msg .= "--$boundary\n";
$msg .= "Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes\n";
$msg .= "Content-Transfer-Encoding: 7bit\n\n";
$msg .= "$intro\n";
foreach ($_POST as $key => $string) {
$posted[] = $key;
$value = stripslashes($string);
if (in_array($key,$formval) && ($value == NULL || $value == '')) {
$results[] = ucfirst($key) . " cannot be blank!";
$bademail = true;
}
if ($key == "email" && !check_email_address($value)) {
$results[] = "Invalid email address!";
$bademail = true;
}
if($key == "security_code" && $value != ($_SESSION['security_code'])) {
$results[] = "Wrong security code!";
$bademail = true;
}
if ($key != "security_code" && $key != "submit" && $key !="MAX_FILE_SIZE" && $key != "message") {
$msg .= ucfirst($key) . " : " . $value . "\n";
}
if ($key == name) {
$name = $value;
}
if ($key == email) {
$headers = "From: " . $name . " <" . $value . ">\n";
$headers .= "Reply-To: " . $value . "\n";
$headers .= "Return-Path: " . $value . "\n";
$headers .= "Envelope-from: " . $value . "\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\n";
}
if ($key == "message") {
$message = "\n\n$value\n";
}
}
foreach ($formval as $string) {
if (!in_array($string,$posted)) {
$results[] = ucfirst($string) . " cannot be blank!";
$bademail = true;
}
}
$msg .= $message;
if ($attachments == 0) {
$msg .= "--$boundary--\n";
}
else if (isset($_FILES['attachment']) && $attachments == 1) {
foreach ($_FILES["attachment"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
echo"$error_codes[$error]";
if (move_uploaded_file($_FILES["attachment"]["tmp_name"][$key], 'tmp/' . $_FILES["attachment"]["name"][$key]) or die("Problems with upload")) {
$file_upload = true;
$tmp_path = 'tmp/' . $_FILES["attachment"]["name"][$key];
$file = fopen($tmp_path,'rb');
$data = fread($file,filesize($tmp_path));
fclose($file);
}
$attachment = chunk_split(base64_encode($data));
$attachment_name = $_FILES['attachment']['name'][$key];
$attachment_type = $_FILES['attachment']['type'][$key];
$attachment_size = $_FILES['attachment']['size'][$key];
$file_extension = strtolower(substr(strrchr($attachment_name,"."),1));
$msg .= "\n--$boundary\n";
$msg .= "Content-Type: $attachment_type; name=\"$attachment_name\"\n";
$msg .= "Content-Transfer-Encoding: base64\n";
$msg .= "Content-Disposition: attachment; filename=$attachment_name\n\n\n";
$msg .= "$attachment\n";
}
}
}
if ($attachments == 1 && $attachment_size > $max_file_size && $file_upload == true) {
$results[] = 'The uploaded file size is too big!';
}
else if ($attachments == 1 && !in_array($file_extension, $file_types) && $file_upload == true) {
$results[] = 'The uploaded file type is not an acceptable type!';
}
else if ($emailval == 1) {
if ($bademail != true) {
mail($to, $subject, $msg, $headers);
$results[] = 'Thank You! Your message has been submitted!';
}
}
if ($logging == 1) {
$timestamp = date('Y-m-d');
foreach ($_POST as $key => $string) {
$value = stripslashes($string);
if ($key == 'security_code') {
$logmsg .= ucfirst ($key) . " : Submitted: " . $value . " => Required: " . $_SESSION['security_code'] . "\n";
}
else {
$logmsg .= ucfirst ($key) . " : " . $value . "\n";
}
}
$logmsg .= "\n";
if (isset($_FILES["attachment"]["error"])) {
foreach ($_FILES["attachment"]["error"] as $filekey => $fileerror) {
if ($fileerror == UPLOAD_ERR_OK) {
$logmsg .= "Attachment " . $filekey . " : " . $_FILES["attachment"]["name"][$filekey] . "\n";
}
}
}
$logmsg .= "\n";
if ($bademail == true) {
foreach ($results as $result) {
$logmsg .= "Error : " . $result . "\n";
}
$logmsg .= "\n";
}
$logmsg .= "Referrer : " . $_SERVER['HTTP_REFERER'] . "\n";
$logmsg .= "User Agent : " . $_SERVER['HTTP_USER_AGENT'] . "\n";
if (file_exists($logpath . $timestamp . '.txt')) {
$fh = fopen($logpath . $timestamp . '.txt', 'a+') or die( "Error opening file" );
}
else {
$fh = fopen($logpath . $timestamp . '.txt', 'w') or die( "Error opening file" );
}
if (!fwrite($fh, $logmsg)) { die( "Error writing to file!" ); }
if (!fwrite($fh, "\n---------------\n\n")) { die( "Error writing to file!" ); }
fclose($fh) or die( "Error closing file!" );
}
session_unregister(security_code);
}
if (file_exists($tmp_path)) {
unlink($tmp_path);
}
if (!empty($results)) {
echo '<ul>';
foreach ($results as $result) {
echo '<li>' . $result . '</li>';
}
echo '</ul>';
$errors = '';
}
if ($handle = opendir('tmp/')) {
while (false !== ($file = readdir($handle))) {
if (is_file('tmp/' . $file)) {
unlink('tmp/' . $file);
}
}
closedir($handle);
}
?>
Во первых сms выдает замечание
Во вторых письмо не отправляется
В третьих скрипт должен на этой же странице писать ошибку (пример: Wrong security code)
вместо этого после нажатия кнопки submit перекидывает на главную страницу.
Хотя если скрипт поставить отдельной страницей все работает, а в динамической не хочет.
ЗАМЕЧАНИЕ: Undefined variable: tmp_path в файле /home/artru/public_html/structure/Modules/Module80.php (строка 293)
Во вторых письмо не отправляется
В третьих скрипт должен на этой же странице писать ошибку (пример: Wrong security code)
вместо этого после нажатия кнопки submit перекидывает на главную страницу.
Хотя если скрипт поставить отдельной страницей все работает, а в динамической не хочет.
raspin писал(а):
правильно выдает, $tmp_path судя по приведенному коду не всегда определен.
нужно дописать
raspin писал(а):
В третьих скрипт должен на этой же странице писать ошибку (пример: Wrong security code)
вместо этого после нажатия кнопки submit перекидывает на главную страницу.
Естественно, учитывая, что в нем написано. Могу порекомендовать заменить
Во первых сms выдает замечание
правильно выдает, $tmp_path судя по приведенному коду не всегда определен.
нужно дописать
if (isset($tmp_path) && file_exists($tmp_path)) {
unlink($tmp_path);
}
unlink($tmp_path);
}
raspin писал(а):
В третьих скрипт должен на этой же странице писать ошибку (пример: Wrong security code)
вместо этого после нажатия кнопки submit перекидывает на главную страницу.
Естественно, учитывая, что в нем написано. Могу порекомендовать заменить
action="<?php echo $_SERVER['PHP_SELF']; ?>"
на action="./"
Все исправил
Теперь выдает такие замечания
Плюс ошибку самого скрипта
И соответственно письмо никуда не уходит (((
<?php
@session_start();
// Your e-mail address
$to = "cashhost@gmail.com";
// "Subject:" line in the e-mail
$subject = "Website Feedback";
// Date format
$date = date ("l, F jS, Y");
// Time format
$time = date ("h:i A");
// Message at the beginning of the e-mail body
$intro = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";
// Form field validation. Specify the names of required form fields.
$formval = array(
"name",
"email",
"message",
"security_code"
);
// Enable/Disable email address structure validation: Set to 1 to enable, set to 0 to disable
$emailval = 1;
// Enable/Disable logging: Set to 1 to enable, set to 0 to disable
$logging = 1;
// Enable/Disable file attachments: Set to 1 to enable, set to 0 to disable
$attachments = 1;
// Acceptable file types
$file_types = array(
"jpe",
"jpg",
"jpeg",
"gif",
"bmp",
"png",
"avi",
"mpg",
"mpeg",
"mov",
"ram",
"qt",
"au",
"wav",
"mid",
"midi",
"wmv",
"mp3",
"ra",
"flv",
"txt",
"doc",
"xls",
"ppt",
"zip",
"tar",
"tgz",
"gz",
"gzip",
"rar",
);
// Number of file upload fields
$uploads = 1;
// Maximum file size for attachments (measured in bytes)
$max_file_size = 2048000;
// path to your logfile directory
$logpath = "logs/";
$userip = $_SERVER['REMOTE_ADDR'];
if (!isset($_POST['submit'])) {
// ===============================================
// The form below may be edited to add form fields.
// ===============================================
?>
<script language="javascript">
function updateimage(){
document.getElementById('captcha').src='http://art-stamp.ru/mailcode-includes/captcha.php?'+Math.random();
}
</script>
<table>
<tr>
<td align="left">
<form enctype="multipart/form-data" action="./" method="post">
<input type="hidden" name="address" value="<?php echo $userip; ?>"><br>
Name:<br>
<input type="text" name="name" size="40"><br>
Email Address:<br>
<input type="text" name="email" size="40"><br>
<?php
// ========================================================================================
// Begin Attachments: Do Not Delete This Section. Enable/Disable attachments in script config.
// ========================================================================================
if ($attachments == 1) {
echo str_repeat('
Attachment:<br><input type="file" name="attachment[]" size="28">
<input type="hidden" name="MAX_FILE_SIZE" value="' . $max_file_size . '"><br>
',$uploads);
}
// ========================================================================================
// End Attachments
// ========================================================================================
?>
Message:<br>
<textarea name="message" rows="5" cols="30"></textarea><br>
Security Code:<br>
<img src="http://art-stamp.ru/mailcode-includes/captcha.php" name="captcha" id="captcha" alt="Security Code" title="Security Code"><br>
Type the Code:<br>
<input id="security_code" name="security_code" type="text">
<input type="submit" name="submit" value="Send">
<input type="reset" value="Clear">
</form>
</td>
</tr>
<tr>
<td align="center">
<br><a href="javascript:updateimage();">Click Here</a> for a new code.<br><br>
</td>
</tr>
</table>
<?php
// ====================================================== //
// ============= Do Not Edit Below This Line =============== //
// ===================================================== //
}
else {
function check_email_address($email) {
// First, we check that there's one @ symbol, and that the lengths are right
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
return false;
}
// Split it into sections to make life easier
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
return false;
}
}
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
return false; // Not enough parts to domain
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
return false;
}
}
}
return true;
}
$boundary = md5(date('r', time()));
$msg = "This is a multi-part message in MIME format.\n\n";
$msg .= "--$boundary\n";
$msg .= "Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes\n";
$msg .= "Content-Transfer-Encoding: 7bit\n\n";
$msg .= "$intro\n";
foreach ($_POST as $key => $string) {
$posted[] = $key;
$value = stripslashes($string);
if (in_array($key,$formval) && ($value == NULL || $value == '')) {
$results[] = ucfirst($key) . " cannot be blank!";
$bademail = true;
}
if ($key == "email" && !check_email_address($value)) {
$results[] = "Invalid email address!";
$bademail = true;
}
if($key == "security_code" && $value != ($_SESSION['security_code'])) {
$results[] = "Wrong security code!";
$bademail = true;
}
if ($key != "security_code" && $key != "submit" && $key !="MAX_FILE_SIZE" && $key != "message") {
$msg .= ucfirst($key) . " : " . $value . "\n";
}
if ($key == name) {
$name = $value;
}
if ($key == email) {
$headers = "From: " . $name . " <" . $value . ">\n";
$headers .= "Reply-To: " . $value . "\n";
$headers .= "Return-Path: " . $value . "\n";
$headers .= "Envelope-from: " . $value . "\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\n";
}
if ($key == "message") {
$message = "\n\n$value\n";
}
}
foreach ($formval as $string) {
if (!in_array($string,$posted)) {
$results[] = ucfirst($string) . " cannot be blank!";
$bademail = true;
}
}
$msg .= $message;
if ($attachments == 0) {
$msg .= "--$boundary--\n";
}
else if (isset($_FILES['attachment']) && $attachments == 1) {
foreach ($_FILES["attachment"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
echo"$error_codes[$error]";
if (move_uploaded_file($_FILES["attachment"]["tmp_name"][$key], 'tmp/' . $_FILES["attachment"]["name"][$key]) or die("Problems with upload")) {
$file_upload = true;
$tmp_path = 'tmp/' . $_FILES["attachment"]["name"][$key];
$file = fopen($tmp_path,'rb');
$data = fread($file,filesize($tmp_path));
fclose($file);
}
$attachment = chunk_split(base64_encode($data));
$attachment_name = $_FILES['attachment']['name'][$key];
$attachment_type = $_FILES['attachment']['type'][$key];
$attachment_size = $_FILES['attachment']['size'][$key];
$file_extension = strtolower(substr(strrchr($attachment_name,"."),1));
$msg .= "\n--$boundary\n";
$msg .= "Content-Type: $attachment_type; name=\"$attachment_name\"\n";
$msg .= "Content-Transfer-Encoding: base64\n";
$msg .= "Content-Disposition: attachment; filename=$attachment_name\n\n\n";
$msg .= "$attachment\n";
}
}
}
if ($attachments == 1 && $attachment_size > $max_file_size && $file_upload == true) {
$results[] = 'The uploaded file size is too big!';
}
else if ($attachments == 1 && !in_array($file_extension, $file_types) && $file_upload == true) {
$results[] = 'The uploaded file type is not an acceptable type!';
}
else if ($emailval == 1) {
if ($bademail != true) {
mail($to, $subject, $msg, $headers);
$results[] = 'Thank You! Your message has been submitted!';
}
}
if ($logging == 1) {
$timestamp = date('Y-m-d');
foreach ($_POST as $key => $string) {
$value = stripslashes($string);
if ($key == 'security_code') {
$logmsg .= ucfirst ($key) . " : Submitted: " . $value . " => Required: " . $_SESSION['security_code'] . "\n";
}
else {
$logmsg .= ucfirst ($key) . " : " . $value . "\n";
}
}
$logmsg .= "\n";
if (isset($_FILES["attachment"]["error"])) {
foreach ($_FILES["attachment"]["error"] as $filekey => $fileerror) {
if ($fileerror == UPLOAD_ERR_OK) {
$logmsg .= "Attachment " . $filekey . " : " . $_FILES["attachment"]["name"][$filekey] . "\n";
}
}
}
$logmsg .= "\n";
if ($bademail == true) {
foreach ($results as $result) {
$logmsg .= "Error : " . $result . "\n";
}
$logmsg .= "\n";
}
$logmsg .= "Referrer : " . $_SERVER['HTTP_REFERER'] . "\n";
$logmsg .= "User Agent : " . $_SERVER['HTTP_USER_AGENT'] . "\n";
if (file_exists($logpath . $timestamp . '.txt')) {
$fh = fopen($logpath . $timestamp . '.txt', 'a+') or die( "Error opening file" );
}
else {
$fh = fopen($logpath . $timestamp . '.txt', 'w') or die( "Error opening file" );
}
if (!fwrite($fh, $logmsg)) { die( "Error writing to file!" ); }
if (!fwrite($fh, "\n---------------\n\n")) { die( "Error writing to file!" ); }
fclose($fh) or die( "Error closing file!" );
}
session_unregister(security_code);
}
if (isset($tmp_path) && file_exists($tmp_path)) {
unlink($tmp_path);
}
if (!empty($results)) {
echo '<ul>';
foreach ($results as $result) {
echo '<li>' . $result . '</li>';
}
echo '</ul>';
$errors = '';
}
if ($handle = opendir('tmp/')) {
while (false !== ($file = readdir($handle))) {
if (is_file('tmp/' . $file)) {
unlink('tmp/' . $file);
}
}
closedir($handle);
}
?>
@session_start();
// Your e-mail address
$to = "cashhost@gmail.com";
// "Subject:" line in the e-mail
$subject = "Website Feedback";
// Date format
$date = date ("l, F jS, Y");
// Time format
$time = date ("h:i A");
// Message at the beginning of the e-mail body
$intro = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";
// Form field validation. Specify the names of required form fields.
$formval = array(
"name",
"email",
"message",
"security_code"
);
// Enable/Disable email address structure validation: Set to 1 to enable, set to 0 to disable
$emailval = 1;
// Enable/Disable logging: Set to 1 to enable, set to 0 to disable
$logging = 1;
// Enable/Disable file attachments: Set to 1 to enable, set to 0 to disable
$attachments = 1;
// Acceptable file types
$file_types = array(
"jpe",
"jpg",
"jpeg",
"gif",
"bmp",
"png",
"avi",
"mpg",
"mpeg",
"mov",
"ram",
"qt",
"au",
"wav",
"mid",
"midi",
"wmv",
"mp3",
"ra",
"flv",
"txt",
"doc",
"xls",
"ppt",
"zip",
"tar",
"tgz",
"gz",
"gzip",
"rar",
);
// Number of file upload fields
$uploads = 1;
// Maximum file size for attachments (measured in bytes)
$max_file_size = 2048000;
// path to your logfile directory
$logpath = "logs/";
$userip = $_SERVER['REMOTE_ADDR'];
if (!isset($_POST['submit'])) {
// ===============================================
// The form below may be edited to add form fields.
// ===============================================
?>
<script language="javascript">
function updateimage(){
document.getElementById('captcha').src='http://art-stamp.ru/mailcode-includes/captcha.php?'+Math.random();
}
</script>
<table>
<tr>
<td align="left">
<form enctype="multipart/form-data" action="./" method="post">
<input type="hidden" name="address" value="<?php echo $userip; ?>"><br>
Name:<br>
<input type="text" name="name" size="40"><br>
Email Address:<br>
<input type="text" name="email" size="40"><br>
<?php
// ========================================================================================
// Begin Attachments: Do Not Delete This Section. Enable/Disable attachments in script config.
// ========================================================================================
if ($attachments == 1) {
echo str_repeat('
Attachment:<br><input type="file" name="attachment[]" size="28">
<input type="hidden" name="MAX_FILE_SIZE" value="' . $max_file_size . '"><br>
',$uploads);
}
// ========================================================================================
// End Attachments
// ========================================================================================
?>
Message:<br>
<textarea name="message" rows="5" cols="30"></textarea><br>
Security Code:<br>
<img src="http://art-stamp.ru/mailcode-includes/captcha.php" name="captcha" id="captcha" alt="Security Code" title="Security Code"><br>
Type the Code:<br>
<input id="security_code" name="security_code" type="text">
<input type="submit" name="submit" value="Send">
<input type="reset" value="Clear">
</form>
</td>
</tr>
<tr>
<td align="center">
<br><a href="javascript:updateimage();">Click Here</a> for a new code.<br><br>
</td>
</tr>
</table>
<?php
// ====================================================== //
// ============= Do Not Edit Below This Line =============== //
// ===================================================== //
}
else {
function check_email_address($email) {
// First, we check that there's one @ symbol, and that the lengths are right
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
return false;
}
// Split it into sections to make life easier
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
return false;
}
}
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
return false; // Not enough parts to domain
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
return false;
}
}
}
return true;
}
$boundary = md5(date('r', time()));
$msg = "This is a multi-part message in MIME format.\n\n";
$msg .= "--$boundary\n";
$msg .= "Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes\n";
$msg .= "Content-Transfer-Encoding: 7bit\n\n";
$msg .= "$intro\n";
foreach ($_POST as $key => $string) {
$posted[] = $key;
$value = stripslashes($string);
if (in_array($key,$formval) && ($value == NULL || $value == '')) {
$results[] = ucfirst($key) . " cannot be blank!";
$bademail = true;
}
if ($key == "email" && !check_email_address($value)) {
$results[] = "Invalid email address!";
$bademail = true;
}
if($key == "security_code" && $value != ($_SESSION['security_code'])) {
$results[] = "Wrong security code!";
$bademail = true;
}
if ($key != "security_code" && $key != "submit" && $key !="MAX_FILE_SIZE" && $key != "message") {
$msg .= ucfirst($key) . " : " . $value . "\n";
}
if ($key == name) {
$name = $value;
}
if ($key == email) {
$headers = "From: " . $name . " <" . $value . ">\n";
$headers .= "Reply-To: " . $value . "\n";
$headers .= "Return-Path: " . $value . "\n";
$headers .= "Envelope-from: " . $value . "\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\n";
}
if ($key == "message") {
$message = "\n\n$value\n";
}
}
foreach ($formval as $string) {
if (!in_array($string,$posted)) {
$results[] = ucfirst($string) . " cannot be blank!";
$bademail = true;
}
}
$msg .= $message;
if ($attachments == 0) {
$msg .= "--$boundary--\n";
}
else if (isset($_FILES['attachment']) && $attachments == 1) {
foreach ($_FILES["attachment"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
echo"$error_codes[$error]";
if (move_uploaded_file($_FILES["attachment"]["tmp_name"][$key], 'tmp/' . $_FILES["attachment"]["name"][$key]) or die("Problems with upload")) {
$file_upload = true;
$tmp_path = 'tmp/' . $_FILES["attachment"]["name"][$key];
$file = fopen($tmp_path,'rb');
$data = fread($file,filesize($tmp_path));
fclose($file);
}
$attachment = chunk_split(base64_encode($data));
$attachment_name = $_FILES['attachment']['name'][$key];
$attachment_type = $_FILES['attachment']['type'][$key];
$attachment_size = $_FILES['attachment']['size'][$key];
$file_extension = strtolower(substr(strrchr($attachment_name,"."),1));
$msg .= "\n--$boundary\n";
$msg .= "Content-Type: $attachment_type; name=\"$attachment_name\"\n";
$msg .= "Content-Transfer-Encoding: base64\n";
$msg .= "Content-Disposition: attachment; filename=$attachment_name\n\n\n";
$msg .= "$attachment\n";
}
}
}
if ($attachments == 1 && $attachment_size > $max_file_size && $file_upload == true) {
$results[] = 'The uploaded file size is too big!';
}
else if ($attachments == 1 && !in_array($file_extension, $file_types) && $file_upload == true) {
$results[] = 'The uploaded file type is not an acceptable type!';
}
else if ($emailval == 1) {
if ($bademail != true) {
mail($to, $subject, $msg, $headers);
$results[] = 'Thank You! Your message has been submitted!';
}
}
if ($logging == 1) {
$timestamp = date('Y-m-d');
foreach ($_POST as $key => $string) {
$value = stripslashes($string);
if ($key == 'security_code') {
$logmsg .= ucfirst ($key) . " : Submitted: " . $value . " => Required: " . $_SESSION['security_code'] . "\n";
}
else {
$logmsg .= ucfirst ($key) . " : " . $value . "\n";
}
}
$logmsg .= "\n";
if (isset($_FILES["attachment"]["error"])) {
foreach ($_FILES["attachment"]["error"] as $filekey => $fileerror) {
if ($fileerror == UPLOAD_ERR_OK) {
$logmsg .= "Attachment " . $filekey . " : " . $_FILES["attachment"]["name"][$filekey] . "\n";
}
}
}
$logmsg .= "\n";
if ($bademail == true) {
foreach ($results as $result) {
$logmsg .= "Error : " . $result . "\n";
}
$logmsg .= "\n";
}
$logmsg .= "Referrer : " . $_SERVER['HTTP_REFERER'] . "\n";
$logmsg .= "User Agent : " . $_SERVER['HTTP_USER_AGENT'] . "\n";
if (file_exists($logpath . $timestamp . '.txt')) {
$fh = fopen($logpath . $timestamp . '.txt', 'a+') or die( "Error opening file" );
}
else {
$fh = fopen($logpath . $timestamp . '.txt', 'w') or die( "Error opening file" );
}
if (!fwrite($fh, $logmsg)) { die( "Error writing to file!" ); }
if (!fwrite($fh, "\n---------------\n\n")) { die( "Error writing to file!" ); }
fclose($fh) or die( "Error closing file!" );
}
session_unregister(security_code);
}
if (isset($tmp_path) && file_exists($tmp_path)) {
unlink($tmp_path);
}
if (!empty($results)) {
echo '<ul>';
foreach ($results as $result) {
echo '<li>' . $result . '</li>';
}
echo '</ul>';
$errors = '';
}
if ($handle = opendir('tmp/')) {
while (false !== ($file = readdir($handle))) {
if (is_file('tmp/' . $file)) {
unlink('tmp/' . $file);
}
}
closedir($handle);
}
?>
Теперь выдает такие замечания
ЗАМЕЧАНИЕ: Use of undefined constant name - assumed 'name' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 192)
ЗАМЕЧАНИЕ: Use of undefined constant email - assumed 'email' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 195)
ЗАМЕЧАНИЕ: Use of undefined constant name - assumed 'name' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 192)
ЗАМЕЧАНИЕ: Use of undefined constant email - assumed 'email' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 195)
ЗАМЕЧАНИЕ: Use of undefined constant name - assumed 'name' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 192)
ЗАМЕЧАНИЕ: Use of undefined constant email - assumed 'email' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 195)
ЗАМЕЧАНИЕ: Use of undefined constant name - assumed 'name' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 192)
ЗАМЕЧАНИЕ: Use of undefined constant email - assumed 'email' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 195)
ЗАМЕЧАНИЕ: Use of undefined constant name - assumed 'name' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 192)
ЗАМЕЧАНИЕ: Use of undefined constant email - assumed 'email' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 195)
ЗАМЕЧАНИЕ: Undefined index: security_code в файле /home/artru/public_html/structure/Modules/Module80.php (строка 185)
ЗАМЕЧАНИЕ: Use of undefined constant name - assumed 'name' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 192)
ЗАМЕЧАНИЕ: Use of undefined constant email - assumed 'email' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 195)
ЗАМЕЧАНИЕ: Use of undefined constant name - assumed 'name' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 192)
ЗАМЕЧАНИЕ: Use of undefined constant email - assumed 'email' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 195)
ЗАМЕЧАНИЕ: Undefined variable: error_codes в файле /home/artru/public_html/structure/Modules/Module80.php (строка 220)
ЗАМЕЧАНИЕ: Undefined variable: logmsg в файле /home/artru/public_html/structure/Modules/Module80.php (строка 261)
ЗАМЕЧАНИЕ: Undefined index: security_code в файле /home/artru/public_html/structure/Modules/Module80.php (строка 258)
ЗАМЕЧАНИЕ: Use of undefined constant security_code - assumed 'security_code' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 291)
ЗАМЕЧАНИЕ: Use of undefined constant email - assumed 'email' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 195)
ЗАМЕЧАНИЕ: Use of undefined constant name - assumed 'name' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 192)
ЗАМЕЧАНИЕ: Use of undefined constant email - assumed 'email' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 195)
ЗАМЕЧАНИЕ: Use of undefined constant name - assumed 'name' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 192)
ЗАМЕЧАНИЕ: Use of undefined constant email - assumed 'email' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 195)
ЗАМЕЧАНИЕ: Use of undefined constant name - assumed 'name' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 192)
ЗАМЕЧАНИЕ: Use of undefined constant email - assumed 'email' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 195)
ЗАМЕЧАНИЕ: Use of undefined constant name - assumed 'name' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 192)
ЗАМЕЧАНИЕ: Use of undefined constant email - assumed 'email' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 195)
ЗАМЕЧАНИЕ: Undefined index: security_code в файле /home/artru/public_html/structure/Modules/Module80.php (строка 185)
ЗАМЕЧАНИЕ: Use of undefined constant name - assumed 'name' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 192)
ЗАМЕЧАНИЕ: Use of undefined constant email - assumed 'email' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 195)
ЗАМЕЧАНИЕ: Use of undefined constant name - assumed 'name' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 192)
ЗАМЕЧАНИЕ: Use of undefined constant email - assumed 'email' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 195)
ЗАМЕЧАНИЕ: Undefined variable: error_codes в файле /home/artru/public_html/structure/Modules/Module80.php (строка 220)
ЗАМЕЧАНИЕ: Undefined variable: logmsg в файле /home/artru/public_html/structure/Modules/Module80.php (строка 261)
ЗАМЕЧАНИЕ: Undefined index: security_code в файле /home/artru/public_html/structure/Modules/Module80.php (строка 258)
ЗАМЕЧАНИЕ: Use of undefined constant security_code - assumed 'security_code' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 291)
Плюс ошибку самого скрипта
•Wrong security code!
И соответственно письмо никуда не уходит (((
я не знаю кто это писал, но написано со множеством ошибок, у нас система выводит все ошибки, а не прячет, как другие, поэтому код должен быть написан правильно.
видимо автор кода не понимает разницы между строкой и константой, в чатсности здесь должно быть не
то же касается и email
видимо автор кода не понимает разницы между строкой и константой, в чатсности здесь должно быть не
if ($key == name) {
$name = $value;
}
а $name = $value;
}
if ($key == 'name') {
$name = $value;
}
$name = $value;
}
то же касается и email
Спасибо огромное все исправил, но помогите пожалуйста добить этот код, он не принимает защитный код и выдает вот это
ЗАМЕЧАНИЕ: Undefined index: security_code в файле /home/artru/public_html/structure/Modules/Module80.php (строка 185)
ЗАМЕЧАНИЕ: Undefined variable: error_codes в файле /home/artru/public_html/structure/Modules/Module80.php (строка 220)
ЗАМЕЧАНИЕ: Undefined variable: logmsg в файле /home/artru/public_html/structure/Modules/Module80.php (строка 261)
ЗАМЕЧАНИЕ: Undefined index: security_code в файле /home/artru/public_html/structure/Modules/Module80.php (строка 258)
ЗАМЕЧАНИЕ: Use of undefined constant security_code - assumed 'security_code' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 291)
Wrong security code!
ЗАМЕЧАНИЕ: Undefined variable: error_codes в файле /home/artru/public_html/structure/Modules/Module80.php (строка 220)
ЗАМЕЧАНИЕ: Undefined variable: logmsg в файле /home/artru/public_html/structure/Modules/Module80.php (строка 261)
ЗАМЕЧАНИЕ: Undefined index: security_code в файле /home/artru/public_html/structure/Modules/Module80.php (строка 258)
ЗАМЕЧАНИЕ: Use of undefined constant security_code - assumed 'security_code' в файле /home/artru/public_html/structure/Modules/Module80.php (строка 291)
Wrong security code!
raspin,
Вы с PHP знакомы?
далее в самом начале объявите $logmsg = '';
строку
Интересно, кто этот шедевр писал? Не рекомендовал бы таким пользоваться, можете получить file-injection
Вы с PHP знакомы?
session_unregister(security_code);
на session_unregister('security_code');
if ($key == 'security_code' && isset($_SESSION['security_code'])) {
$logmsg .= ucfirst ($key) . " : Submitted: " . $value . " => Required: " . $_SESSION['security_code'] . "\n";
}
$logmsg .= ucfirst ($key) . " : Submitted: " . $value . " => Required: " . $_SESSION['security_code'] . "\n";
}
далее в самом начале объявите $logmsg = '';
строку
echo"$error_codes[$error]";
вообще можно закомментировать, $error_codes нигде не объявляется.Интересно, кто этот шедевр писал? Не рекомендовал бы таким пользоваться, можете получить file-injection
А возможно у вас заказать типа такого скрипта рабочего за отдельную плату, а то я к сожалению с пхп не знаком
raspin,
у Вас скрипт формы? у нас есть отдельный модуль, который реализует такой функционал.
Также на сайте раньше пробегали простые примеры такой формы отправки.
у Вас скрипт формы? у нас есть отдельный модуль, который реализует такой функционал.
Также на сайте раньше пробегали простые примеры такой формы отправки.
Авторизация