Advertisement
Guest User

Untitled

a guest
Jun 10th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.05 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL);
  3. $HTML = "";
  4.  
  5.  
  6. if($_POST['sname'] == "")
  7. {
  8.  
  9.  
  10.  
  11.  
  12. $HTML .= "<html>
  13.  
  14. <head>
  15. <meta http-equiv='Content-Language' content='en-us'>
  16. <meta http-equiv='Content-Type' content='text/html; charset=windows-1252'>
  17. <meta name='GENERATOR' content='Microsoft FrontPage 4.0'>
  18. <meta name='ProgId' content='FrontPage.Editor.Document'>
  19. <title>Articulate Installer</title>
  20.  
  21. <style type='text/css'>
  22.  
  23. #form
  24. {
  25. margin-top:40px;
  26. width:400px;
  27. }
  28.  
  29. </style>
  30. </head>
  31.  
  32. <body>
  33. <div id='centerit' align='center'>
  34. <div id='form'>
  35. <p align='center'><h1>Welcome To Articulate Setup Page</h1>
  36. <br />
  37. <form method='POST' action='setup.php'>
  38.  <p align='center'>
  39.  
  40.         Database Host: <input type='text' value='localhost' name='host'><br /><br />
  41.        
  42.     Database User: <input name='user' type='text' value='root' > <br /><br />
  43.    
  44.     Database Pass: <input name='pass' type='password' value='' > <br /><br />
  45.     Database Name: <input type='text' name='db' value='articulate' > <br /><br />
  46.     Site Name: <input type='text' value='Articulate' name='sname' > <br /><br />
  47.   Site Message: <input type='text' value='Articles By The People' name='subname' > <br /><br />
  48.  </p>
  49.  
  50.  <p align='right'>
  51.     <input type='submit' value='Install'><br />
  52.  
  53.     </p>
  54. </form>
  55. <p align='center'>&nbsp;</p>
  56.  
  57. </div>
  58. </div>
  59.  
  60. </body>
  61.  
  62. </html>";
  63.  
  64. }
  65. else
  66. {
  67. $host = $_POST['host'];
  68. $user = $_POST['user'];
  69. $pass = $_POST['pass'];
  70. $dbname = $_POST['db'];
  71.  
  72. $name = $_POST['sname'];
  73. $sname = $_POST['subname'];
  74.  
  75. $sql_end = "
  76. CREATE TABLE `admin` (
  77.  `username` text,
  78.  `password` text
  79. ) ENGINE=MyISAM /*!40100 DEFAULT CHARSET=latin1*/;
  80.  
  81. INSERT INTO `admin` (`username`, `password`) VALUES
  82.     ('admin','admin');
  83.  
  84.  
  85. CREATE TABLE `articles` (
  86.  `id` int(10) unsigned NOT NULL auto_increment,
  87.  `views` bigint(20) unsigned NOT NULL,
  88.  `title` text,
  89.  `article` longblob,
  90.  UNIQUE KEY `id` (`id`)
  91. ) ENGINE=MyISAM AUTO_INCREMENT=2;
  92.  
  93. INSERT INTO `articles` (`id`, `views`, `title`, `article`) VALUES
  94.     ('1','2','Introduction','Welcome to the Articulate Article System!\r\n\r\nIn this system you allow visitors to your site to post articles about certain subjects.  You can use the moderation system that was given to make sure no spam or useless articles are posted.  All articles are written in HTML - so monitor the HTML for anything that could be seen as \'harmful\'.  With HTML also means it supports javascript, giving your users more control over their articles.  It gives a more interactive view toward writing documentation.  More Advanced BB Code will be in the future!\r\n\r\n');
  95.  
  96.  
  97. CREATE TABLE `m_articles` (
  98.  `id` int(10) unsigned NOT NULL auto_increment,
  99.  `views` bigint(20) unsigned NOT NULL,
  100.  `title` text,
  101.  `article` longblob,
  102.  UNIQUE KEY `id` (`id`)
  103. ) ENGINE=MyISAM AUTO_INCREMENT=1;
  104. ";
  105.  
  106.  
  107.  
  108. $con = mysql_connect($host,$user,$pass) or mysql_error($con);
  109. mysql_query("CREATE DATABASE IF NOT EXISTS `{$dbname}`;",$con) or die(mysql_error());
  110. mysql_select_db($dbname,$con) or die(mysql_error());;
  111. mysql_query($sql_end,$con) or die(mysql_error());
  112. mysql_close($con) or die(mysql_error());
  113.  
  114.  
  115.  
  116. $configfile = fopen("configh.php",'w') or die("fail");
  117. $configcontent = "
  118. <?php
  119. unlink(\"configh.php\");
  120. //Auto Generated Config File
  121. //Database Information
  122. \$host = \"{$host}\"; // This is the host location of your database
  123. \$user = \"{$user}\"; // This is the username used to connect to your database
  124. \$pass = \"{$pass}\"; // This is the password user to connect to your database
  125. \$dbname = \"{$dbname}\";  // The name of the database name
  126.  
  127. //Site Information
  128. \$sitename = \"{$name}\";  //Site Name - such as articulate, because people are allowed to post articles for others to read
  129. \$sdesc = \"{$sname}\"; // Small Descriptions - its a miniture descriptions of your site.  Don't make it too long
  130.  
  131. \$configfilled = true;
  132.  
  133. ?>";
  134.  
  135. fwrite($configfile, $configcontent);
  136.  
  137. fclose($configfile);
  138.  
  139. $HTML .= "<head>
  140. <title>Articulate Installer - Complete</title></head> <h2> Articulate Has Been Installed </h2>";
  141. }
  142.  
  143.  
  144.  
  145.  
  146. echo $HTML;
  147.  
  148.  
  149.  
  150. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement