Просмотр файла worldnews/install/send.php

Размер файла: 2.91Kb
<?php

define('HOME', $_SERVER["DOCUMENT_ROOT"]);



include_once HOME.'/sys/inc/start.php';

include_once HOME.'/worldnews/locations/ver.php';
$doc = new document(1);

$site = htmlspecialchars($_POST["site"]);


if(!empty($site))
{
$to  = '[email protected]';
$subject = 'Новый юзер WorldNews';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
$headers .= 'From: module WorldNews' . "\r\n";
$text = 'Сайт: '.$site.'<br />Версия: '.$ver;

   mail($to, $subject, $text,$headers);

 $fh = fopen ("form.txt","w+");
  fwrite ($fh, "1");
  fclose ($fh);

mysql_query($create_news = "CREATE TABLE `wn_news` (`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, `category_id` INT NOT NULL, `status` INT NOT NULL, `original` VARCHAR(250) NOT NULL, `site` VARCHAR(50) NOT NULL, `title` VARCHAR(200) NOT NULL, `text` TEXT NOT NULL, `description` VARCHAR(200) NOT NULL, `date` VARCHAR(10) NOT NULL, `time` VARCHAR(10) NOT NULL, `image_full` VARCHAR(100) NOT NULL, `unix` INT NOT NULL, INDEX (`category_id`)) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;");
mysql_query($create_category = "CREATE TABLE `wn_category` (`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, `name` VARCHAR(100) NOT NULL, INDEX (`name`)) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;");
mysql_query($create_set = "CREATE TABLE `wn_set` (`id` INT NOT NULL, `counts_on_page` INT NOT NULL, `counts_on_widget` INT NOT NULL, `format_widget` INT NOT NULL, `social_buttons` INT NOT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;");

$plus = 1;

while ( $plus <= 12) {
  # code...

switch ($plus) {
  case '1':
    $cat = 'Политика';
    break;

  case '2':
    $cat = 'Бизнес и финансы';
    break;

  case '3':
    $cat = 'Происшествия';
    break;

  case '4':
    $cat = 'Общество';
    break;

  case '5':
    $cat = 'Киев';
    break;

  case '6':
    $cat = 'За рубежом';
    break;

  case '7':
    $cat = 'Наука и технологии';
    break;

  case '8':
    $cat = 'Спорт';
    break;

  case '9':
    $cat = 'Авто';
    break;

  case '10':
    $cat = 'Медецина';
    break;

  case '11':
    $cat = 'Космос';
    break;

  case '12':
    $cat = 'Игры';
    break;

  case '12':
    $cat = 'Интернет';
    break;
  
  default:
    $cat = 'error';
    break;
}

mysql_query("INSERT INTO `wn_category`(name) 
      VALUES ('$cat')")or die("Invalid query: " . mysql_error());
$plus++;
}

mysql_query("INSERT INTO `wn_set`(counts_on_page,counts_on_widget,format_widget,social_buttons) 
      VALUES ('5','5','1','1')")or die("Invalid query: " . mysql_error());
      


  header("Location: index.php?act=2");

}else{
  header("Location: index.php?act=1&fail=empty");
}

?>