S
S
slavik_kozachok_official2017-06-20 19:23:37
PHP
slavik_kozachok_official, 2017-06-20 19:23:37

Error submitting PHP form from website. What's not there?

Uploaded the site to another hosting and an error occurred while submitting the form...
Attention : Foopen (message.txt) [ function.fopen ]: Failed to open stream: Permission denied in /sata1/home/users/atl/www/www.atl .info/page/post.php on line 71
Warning: FWRITE(): supplied argument is not a valid stream resource at /sata1/home/users/atl/www/www.atl.info/page/post.php on line 73
Warning : FWRITE() : Argument supplied is not valid stream resource at /sata1/home/users/atl/www/www.atl.info/page/post.php on line 75
Warning : FWRITE() : Argument supplied is not valid resource stream to /sata1/home/users/atl /www/www.atl.info/page/post.php on line 77
Warning: fclose(): supplied argument is not a valid stream resource at /sata1/home/users/atl/www/www.atl.info/page/post.php on line 79
Name: ssssla Email: [email protected] Message: tesx
Message sent! Thanks for your feedback and suggestions.

<? 
// ----------------------------конфигурация-------------------------- // 
 
$adminemail="[email protected]";  // e-mail админа 
 
 
$date=date("d.m.y"); // число.месяц.год 
 
$time=date("H:i"); // часы:минуты:секунды 
 
$backurl="http://www.atl.info/page/otzyvy_i_predlozheniya.html";  // На какую страничку переходит после отправки письма 
 
//---------------------------------------------------------------------- // 
 
  
 
// Принимаем данные с формы 
 
$name=$_POST['name']; 
 
$email=$_POST['email']; 
 
$msg=$_POST['message']; 
 
  
 
// Проверяем валидность e-mail 
 
if (!preg_match("|^([a-z0-9_\.\-]{1,20})@([a-z0-9\.\-]{1,20})\.([a-z]{2,4})|is", 
strtolower($email))) 
 
 { 
 
  echo 
"<center>Вернитесь <a 
href='javascript:history.back(1)'><B>назад</B></a>. Вы 
указали неверные данные!"; 
 
  } 
 
 else 
 
 { 
 
 
$msg=" 
 
 
Имя: $name
 
 
E-mail: $email
 
 
Сообщение: $msg
 
 "; 
 
    // Отправляем письмо админу  
 
mail("$adminemail", "$date $time Сообщение 
от $name", "$msg"); 
 
  
 
// Сохраняем в базу данных 
 
$f = fopen("message.txt", "a+"); 
 
fwrite($f," \n $date $time Сообщение от $name"); 
 
fwrite($f,"\n $msg "); 
 
fwrite($f,"\n ---------------"); 
 
fclose($f); 
   
// Выводим сообщение пользователю 
 print "<script language='Javascript'><!-- 
function reload() {location = \"$backurl\"}; setTimeout('reload()', 6000); 
//--></script> 
 
$msg 
 
<p> Сообщение отправлено! Спасибо за Ваши отзывы и предложения.</p>";  
exit; 
  } 
 ?>

Changed chmod to 777 no error, but now messages don't come to mail at all...(

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2017-06-20
@Rsa97

No rights to create message.txt file

A
Andrey Prozorov, 2017-06-20
@i_d_1

chmod message.txt 755

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question