Example #1
0
    $user = htmlspecialchars($_POST['user']);
    $pass = htmlspecialchars($_POST['pass']);
    $name = htmlspecialchars($_POST['name']);
    //Dati Connessione MySQL e Connessione
    $db_connect = @mysql_connect($host, $user, $pass);
    $db_select = @mysql_select_db($name);
    if (!$db_connect) {
        die("<b>Errore durante la connessione al database MySQL</b><br>" . mysql_errno() . " : " . mysql_error());
    } elseif (!$db_select) {
        die("<b>Errore durante la selezione del database MySQL</b><br>" . mysql_errno() . " : " . mysql_error());
    }
    //dati amministrazione
    $pass_admin = md5($_POST['password']);
    //dati di configurazione
    $title = VarProtect($_POST['title']);
    $prefix = VarProtect($_POST['prefix']);
    //creo la tabella users
    mysql_query("CREATE TABLE `" . $prefix . "users` (\n\t  `id` int(11) NOT NULL auto_increment,\n\t  `password` text NOT NULL,\n\t  KEY `id` (`id`)\n\t);") or die(mysql_error());
    print "Table <b>'" . $prefix . "users'</b> created with success<br />\n";
    mysql_query("INSERT INTO " . $prefix . "users (password) VALUES ('" . $pass_admin . "');") or die(mysql_error());
    //tabella config
    mysql_query("CREATE TABLE `" . $prefix . "config` (\n\t  `title` text NOT NULL,\n\t  `view_all` INT NOT NULL\n\t);") or die(mysql_error());
    print "Table <b>'" . $prefix . "config'</b> created with success<br />\n";
    mysql_query("INSERT INTO " . $prefix . "config (`title`, `view_all`) VALUES ('" . $title . "', 1);") or die(mysql_error());
    print "Table <b>'" . $prefix . "config'</b> created with success<br />\n";
    //tabella PASTES
    mysql_query("CREATE TABLE `" . $prefix . "pastes` (\n\t  `id` int(255) default NULL,\n\t  `author` text NOT NULL NOT NULL,\n\t  `title` text,\n\t  `ip` text NOT NULL,\n\t  `language` mediumtext NOT NULL,\n\t  `text` longtext NOT NULL,\n\t  `data` text NOT NULL,\n\t  `expire_date` TEXT\n\t);") or die(mysql_error());
    print "Table <b>'" . $prefix . "pastes'</b> created with success<br />\n";
    //creo il file config.php ;)
    $config = '<?php
/*
Example #2
0
 if (!$db_connect) {
     die("<b>Errore durante la connessione al database MySQL</b><br />" . mysql_errno() . " : " . mysql_error());
 } elseif (!$db_select) {
     die("<b>Errore durante la selezione del database MySQL</b><br />" . mysql_errno() . " : " . mysql_error());
 }
 //dati amministrazione
 $user_admin = VarProtect($_POST['username']);
 $pass_admin = md5($_POST['password']);
 //dati di configurazione
 $title = VarProtect($_POST['title']);
 $desc = VarProtect($_POST['desc']);
 $email = VarProtect($_POST['email']);
 $limit = intval($_POST['limit']);
 $footer = VarProtect($_POST['footer']);
 $prefix = VarProtect($_POST['prefix']);
 $lang = VarProtect($_POST['lang']);
 //creo la tabella users
 mysql_query("CREATE TABLE `" . $prefix . "users` (\n\t  `id` int(11) NOT NULL auto_increment,\n\t  `username` text NOT NULL,\n\t  `password` text NOT NULL,\n\t  `email` text NOT NULL,\n\t  KEY `id` (`id`)\n\t);") or die(mysql_error());
 echo "Table <b>'" . $prefix . "users'</b> created with success<br />\n";
 mysql_query("INSERT INTO " . $prefix . "users (username, password, email) VALUES ('" . $user_admin . "', '" . $pass_admin . "', '" . $email . "');") or die(mysql_error());
 echo "User <b>" . $user_admin . "</b> added with success<br />\n";
 //tabella config
 mysql_query("CREATE TABLE `" . $prefix . "config` (\n\t  `title` text NOT NULL,\n\t  `description` text NOT NULL,\n\t  `themes` text NOT NULL,\n\t  `lang` text NOT NULL,\n\t  `limit` INT NOT NULL,\n\t  `footer` text NOT NULL, \n\t  `ip_log_active` INT NOT NULL \n\t);") or die(mysql_error());
 echo "Table <b>'" . $prefix . "config'</b> created with success<br />\n";
 mysql_query("INSERT INTO " . $prefix . "config (`title`, `description`, `themes`, `lang`, `limit`, `footer`, `ip_log_active`\n\t\t\t\t) VALUES (\n\t\t\t\t'" . $title . "', '" . $desc . "', 'default.css', '" . $lang . "', '" . $limit . "', '" . $footer . "', 1);") or die(mysql_error());
 echo "<b>Configuration</b> added with success<br />\n";
 //tabella articles
 mysql_query("CREATE TABLE `" . $prefix . "articles` (\n\t  `id` int(11) NOT NULL auto_increment,\n\t  `author` text NOT NULL,\n\t  `title` text NOT NULL,\n\t  `post` text NOT NULL,\n\t  `post_date` text NOT NULL,\n\t  `num_read` INT NOT NULL,\n  \t  `cat_id` INT NOT NULL,\n\t  KEY `id` (`id`)\n\t);") or die(mysql_error());
 echo "Table <b>'" . $prefix . "articles'</b> created with success<br />\n";
 //tabella comments
 mysql_query("CREATE TABLE `" . $prefix . "comments` (\n\t  `id` int(11) NOT NULL auto_increment,\n\t  `blog_id` int(11) NOT NULL default '0',\n\t  `name` text NOT NULL,\n\t  `comment` text NOT NULL,\n\t  `ip` text NOT NULL,\n\t  KEY `id` (`id`)\n\t);") or die(mysql_error());