Вообщем на веб-сервере система UNIX, а гостевая написана под WINDOWS. Никак немогу перевести код.
Код:
<br>
Заполните поля и нажмите кнопку «Добавить».
<hr style="width: 450px;">
<?
Error_Reporting(E_ALL & ~E_NOTICE);
$page_title = "Гостевая книга сайта «Nissan-auto»";
$ctitle = "<a href='?p=main' title=''>Главная</a> / <a href='?p=gbook' title=''>Гостевая</a> / Добавить сообщение";
$now = "gbookadd";
$error = "";
$action = $HTTP_POST_VARS["action"];
if (!empty($action))
{
$name = trim($name);
$city = trim($city);
$email = trim($email);
$msg = trim($msg);
if (empty($msg))
{
$action = "";
$error = $error."Вы не ввели сообщение<br>";
}
if (empty($name))
{
$action = "";
$error = $error."Вы не ввели имя<br>";
}
if (!empty($email))
{
if (!preg_match("/[0-9a-z_]+@[0-9a-z_^\.]+\.[a-z]{2,3}/i", $email))
{
$action = "";
$error = $error."Неверно введен е-mail. Введите e-mail в виде <strong>vasya@pupkin.ru</strong><br>";
}
}
$name = substr($HTTP_POST_VARS["name"],0,32);
$name = htmlspecialchars(stripslashes($name));
$email = substr($HTTP_POST_VARS["email"],0,32);
$email = htmlspecialchars(stripslashes($email));
$msg = substr($HTTP_POST_VARS["msg"],0,2048);
$msg = htmlspecialchars(stripslashes($msg));
$city = substr($HTTP_POST_VARS["city"],0,32);
$city = htmlspecialchars(stripslashes($city));
if (empty($error))
{
$msg = nl2br($msg);
$msg = str_replace("[u]","<u>",$msg);
$msg = str_replace("[U]","<u>",$msg);
$msg = str_replace("[i]","<i>",$msg);
$msg = str_replace("[I]","<i>",$msg);
$msg = str_replace("[b]","<B>",$msg);
$msg = str_replace("[B]","<B>",$msg);
$msg = str_replace("[sub]","<SUB>",$msg);
$msg = str_replace("[SUB]","<SUB>",$msg);
$msg = str_replace("[sup]","<SUP>",$msg);
$msg = str_replace("[SUP]","<SUP>",$msg);
$msg = str_replace("[/u]","</u>",$msg);
$msg = str_replace("[/U]","</u>",$msg);
$msg = str_replace("[/i]","</i>",$msg);
$msg = str_replace("[/I]","</i>",$msg);
$msg = str_replace("[/b]","</B>",$msg);
$msg = str_replace("[/B]","</B>",$msg);
$msg = str_replace("[/SUB]","</SUB>",$msg);
$msg = str_replace("[/sub]","</SUB>",$msg);
$msg = str_replace("[/SUP]","</SUP>",$msg);
$msg = str_replace("[/sup]","</SUP>",$msg);
$msg = eregi_replace("(.*)\\[url\\](.*)\\[/url\\](.*)","\\1<a href=\\2>\\2</a>\\3",$msg);
$msg = str_replace("\n"," ",$msg);
$msg = str_replace("\r"," ",$msg);
$file = fopen("./records/rec.".time(),"w");
fputs($file,$name."\n");
fputs($file,$city."\n");
fputs($file,$email."\n");
fputs($file,$msg."");
fclose($file);
echo "<html><head>";
echo "<meta http-equiv='Refresh' content='0; url=index.php?p=gbook'>";
echo "</head></html>";
}
}
if (empty($action))
{
if (!empty($error))
{
echo "<font color='#FF0000'>Ошибка:<br>$error<br></font>";
}
?>
<table width='1' border='0'>
<form action='index.php?p=gbookadd' method='post'>
<input type='hidden' name='action' value='post'>
<tr>
<td width='50%'>Имя:<font color='#FF0000'><sup>*</sup><font></td>
<td align='right'><input type='text' name='name' maxlength='32' value='<? echo "$name"; ?>'></td>
</tr>
<tr>
<td width='50%'>Город:</td>
<td align='right'><input type='text' name='city' maxlength='32' value='<? echo "$city"; ?>'></td>
</tr>
<tr>
<td width='50%'>E-Mail:</td>
<td align='right'><input type='text' name='email' maxlength='32' value='<? echo "$email"; ?>'></td>
</tr>
<tr>
<td colspan='2'>Сообщение<font color='#FF0000'><sup>*</sup></font>:<br>
<textarea cols='50' rows='8' name='msg'><? echo "$msg"; ?></textarea>
</td>
</tr>
<tr>
<td colspan='2'><input type='submit' value='Добавить'></td>
</tr>
</form>
<tr>
<td colspan='2'><font color='red'><sup>*</sup></font> — поля, обязательные для заполнения</td>
</tr>
</table>
<?
}
?>