File size: 2.31Kb
<?php
// Чат GBodr
// Версия: 1.0
// Автор: Gemorroj
require 'connect.php';
require 'header.php';
require 'result.php';
if($_GET['go'] == 1)
{
$to = trim($_POST['to']);
if(!eregi("^[a-z0-9\._\-\.]+@[a-z0-9\._\-]+\.[a-z]{2,6}\$", $to))
{$err = 'Не верный E-mail';}
$to = substr($to,0,100);
$subject = trim($_POST['subject']);
$subject = substr($subject,0,100);
$mail = trim($_POST['mail']);
$mail = substr($mail,0,92);
$body = trim($_POST['body']);
$body = substr($body,0,1024);
if($body == '')
{$err = 'Вы не написали сообщение';}
if(!isset($err))
{
$index = $_SERVER['HTTP_HOST'];
$now = gmdate('j-m-Y', time()+ $correct_time);
$body = 'Вам письмо от: '.$mail." \n ".$body." \n ".$now;
$adds = "From: support@$index \n";
$adds .= "X-sender: < support@$index >\n";
$adds .= "Content-Type: text/plain; charset=utf-8\n";
mail($to,$subject,$body,$adds);
print $top.'
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
<card id="ok" title="Ok" ontimer="enter.php?id='.$id.'&ps='.$ps.'&r='.$ref.'">
<timer value="5"/>
<p>
Сообщение отправлено!
</p>
</card>
</wml>';
exit;
}
}
$yourmail = $row['mail'];
if(strstr($yourmail,'<a href="'))
{
$t = strpos($yourmail,'">');
$yourmail = substr($yourmail,0,$t);
$e = strlen($yourmail);
$yourmail = substr($yourmail,51,$e);
}
print $top.'
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
<card id="send" title="Send">
<p>';
if(isset($err))
{
print $err.'<br/>';
}
$adr = $to;
print 'Кому:<br/>
<input name="to'.$ref.'" maxlength="92" value="'.$adr.'" type="text"/><br/>
Тема:<br/>
<input name="subject'.$ref.'" maxlength="92" type="text"/><br/>
Сообщение:<br/>
<input name="body'.$ref.'" type="text"/><br/>
Ваш E-mail:<br/>
<input name="mail'.$ref.'" maxlength="92" value="'.$yourmail.'" type="text"/><br/>
<anchor>Отправить
<go href="mail.php?go=1&id='.$id.'&ps='.$ps.'" method="post">
<postfield name="to" value="$(to'.$ref.')"/>
<postfield name="subject" value="$(subject'.$ref.')"/>
<postfield name="body" value="$(body'.$ref.')"/>
<postfield name="mail" value="$(mail'.$ref.')"/>
</go></anchor><br/>
---<br/>
<a href="enter.php?id='.$id.'&ps='.$ps.'&ref='.$ref.'">Прихожая</a>
</p>
</card>
</wml>';
mysql_close();
?>