Просмотр файла sovet/index.php

Размер файла: 3.91Kb
<?php
//http://rel2.yadviga.ru
//Скрипт переделан
//с движка wap-engine
//Переделан под Wap-Motor
//[email protected]
require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"../template/functions.php";
require_once"../template/antidos.php";
require_once"../template/cookies.php";
require_once"../template/gzip.php";
require_once"../template/header.php";
require_once"../template/referer.php";
include_once"../themes/$config_themes/index.php";
include_once"../template/isset.php";
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);
echo "<p align=\"center\">Посоветуй наш сайт своему другу.</p>";
if ($_GET[view]=="")
 { 
  $rand = rand(1000, 9999);
  $_SESSION['rand'] = "$rand";
  echo "<form method=\"post\" action=\"index.php?view=3\">";
  echo "<div class=\"b\">";
  echo "Ваш e-mail:";
  echo "<br/><input type=\"text\" name=\"vashmail\" maxlength=\"50\" value=\"@\"/><br/>";
  echo "e-mail друга:";
  echo "<br/><input type=\"text\" name=\"mail\" maxlength=\"50\" value=\"@\"/><br/>";
  echo "Ваше имя:";
  echo "<br/><input type=\"text\" name=\"name\" maxlength=\"50\" value=\"\"/><br/>";
  echo "* Проверочное число <font color=\"red\">$rand</font>:<br/><input size=\"4\" maxlength=\"4\" name=\"imgrand\" value=\"\" /><br/>";
  echo "<input type=\"submit\" name=\"do\" value=\"Посоветовать\"/></p></form>";

  $viewsov = file("../local/sovet.dat");
  $sov = $viewsov[0];
  echo "<p>Наш сайт посоветовали $sov раз</p>";
 }
 
if($_GET[view]==3)
 {
  $text=htmlspecialchars(stripslashes(trim($_POST['text'])));
  $tema= "Vam posovetovali sait $config_home";
  if(empty($_POST['vashmail']))
   {
    $ot_email = "$config_emails";
   }
    else
   {
    $ot_email = "$_POST[vashmail]";
   }
  if (!eregi("^([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)$", $_POST[mail]))
   {  
    echo"<p>Несуществующий адрес e-mail!<br/><br/>";
    echo"<a href=\"index.php\">Пожалуйста повторите!</a></p>";
	include_once "../themes/$config_themes/foot.php";
    exit;
   } 
  if(empty($_POST['imgrand']))
   {
    echo"<p>Не введено проверочное число<br/><br/>";
	echo"<a href=\"index.php\">Пожалуйста повторите!</a></p>";
	include_once "../themes/$config_themes/foot.php";
    exit;
   }
  if(!empty($_POST['imgrand']))
   {
    if($_POST['imgrand'] != $_SESSION['rand'])
     {
      echo"<p>Проверочное число неверно<br/><br/>";
	  echo"<a href=\"index.php\">Пожалуйста повторите!</a></p>";
include_once "../themes/$config_themes/foot.php";
exit;
     }
   }   
  $text = "Здравствуйте. Вам $_POST[name] посоветовал(а) зайти на наш сайт $config_home<br/> . Это значит, что вашему другу(подруге) $_POST[name] очень понравился этот сайт<br/> <a href=\"$config_home\">Перейти на сайт $config_home</a><br/> С уважением, администратор сайта $config_home<br/>";
  $headers="Content-Type: text/html; charset=utf-8\n";
  $headers.="From: $ot_email\nX-Mailer: PHP v.".phpversion();
  mail($_POST[mail],$tema,$text,$headers);

  $viewsov = file("../local/sovet.dat");
  $i = $viewsov[0];
  $ii = $i + 1;
  $base = ("../local/sovet.dat");
  $file = fopen("$base","w");
  fputs($file,"$ii");
  fclose($file);

  echo"<p>Спасибо, за то, что посоветовали наш сайт своему другу.<br/>";
  echo"</p>";
 }
echo'<img src="../images/img/homepage.gif" alt=""> <a href="../index.php?'.SID.'">На главную</a>';
include_once "../themes/$config_themes/foot.php";
?>