Install Script

MicrotechXP

New Member
Messages
7,644
Reaction score
0
Points
0
Anyone know where I can get an tut for making an install script? :hsdance:
 

moose

New Member
Messages
1,056
Reaction score
0
Points
0
Ok.. Umm Do you want install scripts for like.. CGI stuff.. PHP.. ??

If you can provide us with some more info we can help ya out haha :)
 

James

Banned
Messages
1,062
Reaction score
0
Points
0
What type of scipt, i have thousands of php cgi and some htmls too.

Let me know and ill hook you up, with some
 

James

Banned
Messages
1,062
Reaction score
0
Points
0
MicrotechXP said:
I was looking for a php one.

ha ha, but it needs to do something
theres millions of install scripts
forums installer, account, ad, users, etc
 

Derek

Community Support Force
Community Support
Messages
12,882
Reaction score
186
Points
63
php.com maybe thers alot of tourials ther maby try
nenerdern.com or how you speell it there are lots of scripts and tourials there
 

MicrotechXP

New Member
Messages
7,644
Reaction score
0
Points
0
The_End said:
ha ha, but it needs to do something
theres millions of install scripts
forums installer, account, ad, users, etc
I want one to help my freind. He is making a CMS and he neads a install script for it.:runaway:
 

moose

New Member
Messages
1,056
Reaction score
0
Points
0
Have your friend try this tutorial out.

http://www.time-2-design.com/viewtut.php?id=17&type=php

Althought it turns out a little messy if you use the included layout files, it gives you the basic idea of it, and it helped me. It works, I've tried it. Just if he wants to use the basic scripts of this tutorial, I highly recomend adding some extra security to your php files. If you wanted, anyone could hack his whole website right now.. haha..
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
You say you need an install script, but what do you mean exactly?

If by saying "install script" you mean a script where you:
Have someone fill out some information (Such as MySQL connection data) and have it create a site's database tables then populate them with configuration data, or even creating a "configuration" file to be included after the installation has finished.​
(I think I might have worded that a little weird, sorry.)

You could create something like that easily, using a little PHP with HTML(Forms), even a few MySQL queries. Your probably not going to find a tutorial really on somethign like this, since it's not exactly.. Hmm, the same thing for everyone. I would think this type of thing varies from "job to job".

Well is that what you are looking to create, or am I off by a lot?
 

MicrotechXP

New Member
Messages
7,644
Reaction score
0
Points
0
Bryon said:
You say you need an install script, but what do you mean exactly?

If by saying "install script" you mean a script where you:
Have someone fill out some information (Such as MySQL connection data) and have it create a site's database tables then populate them with configuration data, or even creating a "configuration" file to be included after the installation has finished.​
(I think I might have worded that a little weird, sorry.)

You could create something like that easily, using a little PHP with HTML(Forms), even a few MySQL queries. Your probably not going to find a tutorial really on somethign like this, since it's not exactly.. Hmm, the same thing for everyone. I would think this type of thing varies from "job to job".

Well is that what you are looking to create, or am I off by a lot?
Yes thats what he neads...they MySAL things...he wants a script that can install his script.
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
Do you know any PHP? I have an *old* (And when I say old I mean.. pretttttyy old and ghetto) script to "install" some database tables and stuff like that.

I'll post it here, but, I don't know if it will help you at all.

PHP:
<html>
 <head>
  <title>Install</title>
   <link rel="stylesheet" title="default" type="text/css" media="screen" href="style.css">
 </head>
 <body>

<?php

   $showForm = 'Yes';

   function installScript() {
      global $showForm;
      $host = $_POST['mysqlHost'];
      $username = $_POST['mysqlUsername'];
      $password = $_POST['mysqlPassword'];
      $database = $_POST['mysqlDatabase'];
      $adminusername = $_POST['adminUsername'];
      $adminpassword = $_POST['adminPassword'];
      $string = '';

      if ((!$host) OR (!$username) OR (!$password) OR (!$database) OR (!$adminusername) OR (!$adminpassword)) {
         return '<span class="error"><b>Error!</b>&nbsp;You must fill out all fields.</span><br />';
      }

      $connect = @mysql_connect($host, $username, $password);
      if($connect != false) {
         $string .= '&nbsp;&nbsp;<b>-Step 1</b>:&nbsp;Connected to mysql server.<br />';
      } else {
         return '<span class="error"><b>Error!</b>&nbsp;There was a problem connecting to the MySQL Server.<br /><b>MySQL Said</b>: '. mysql_error() .'</span>';
      }

      $sdatabase = @mysql_select_db($database);
   
      if($sdatabase != false) {
         $string .= '&nbsp;&nbsp;<b>-Step 2</b>:&nbsp;Selected the database.<br />';
      } else {
         return $string .'<span class="error"><b>Error!</b>&nbsp;The database could not be selected. Please check the name and<br />make sure the mysql account has access to the database.</span><br />';
      }

      @mysql_query("DROP TABLE IF EXISTS `nedren_newsposts`") or die(mysql_error());
      @mysql_query("DROP TABLE IF EXISTS `nedren_newsadmins`") or die(mysql_error());

      $table1_sql = "CREATE TABLE `nedren_newsposts` (`id` INT( 16 ) NOT NULL AUTO_INCREMENT ,`title` VARCHAR( 100 ) NOT NULL ,`body` TEXT NOT NULL ,`date` VARCHAR( 32 ) NOT NULL ,`time` VARCHAR( 32 ) NOT NULL ,`timestamp` VARCHAR( 32 ) NOT NULL ,`username` VARCHAR( 32 ) NOT NULL ,PRIMARY KEY ( `id` )) TYPE = MYISAM COMMENT = 'Table to hold news posts for nedrens news poster'";

      $table2_sql = "CREATE TABLE `nedren_newsadmins` (  `id` int(16) NOT NULL auto_increment,  `username` varchar(32) NOT NULL default '',  `password` varchar(32) NOT NULL default '',  `last_login` varchar(32) NOT NULL default '',  `total_posts` varchar(32) NOT NULL default '',  `type` varchar(32) NOT NULL default '',  `keep` varchar(32) NOT NULL default '',  PRIMARY KEY  (`id`) ) TYPE=MyISAM COMMENT='Table to hold admin news posting accounts for nedren''s news ' AUTO_INCREMENT=3 ;";

      $table1_results = @mysql_query($table1_sql);
      if($table1_results != false) {
         $string .= '&nbsp;&nbsp;<b>-Step 3</b>:&nbsp;Table `nedren_newsposts` created.<br />';
      } else {
         return $string .'<span class="error"><b>Error!</b>&nbsp;Table `nedren_newsposts` could not be created.</span><br /><b>MySQL Said</b>:&nbsp;'. mysql_error() .'</span>';
      }

      $table2_results = @mysql_query($table2_sql);
      if($table2_results != false) {
         $string .= '&nbsp;&nbsp;<b>-Step 4</b>:&nbsp;Table `nedren_admins` created.<br />';
      } else {
         return $string .'<span class="error"><b>Error!</b>&nbsp;Table `nedren_newsadmins` could not be created.</span><br /><b>MySQL Said</b>:&nbsp;'. mysql_error() .'</span>';
      }
      
      $date = date("m/d/y");
      $time = date("g:i a");
      $timestamp = time();

      @mysql_query("INSERT INTO `nedren_newsposts` (`title`,`body`,`date`,`time`,`timestamp`,`username`) VALUES ('Welcome!','Welcome to NedreN\'s News System. Thank you for installing this and using it. If you have any problems, questions, or suggestions, you can contact me at <a href=\"http://nedren.com/contact.php\">NedreN.com</a>.','$date','$time','$timestamp','System')") or die(mysql_error());
   
      $admin_results = @mysql_query("INSERT INTO `nedren_newsadmins` (`username`,`password`,`total_posts`,`type`,`keep`) VALUES ('$adminusername','$adminpassword','0','Admin','Yes')");

      if($admin_results != false) {
         $string .= '&nbsp;&nbsp;<b>-Step 5</b>:&nbsp;Administrator account added.<br />';
      } else {
         return $string .'<span class="error"><b>Error!</b>&nbsp;Administrator account could not be added..</span><br /><b>MySQL Said</b>:&nbsp;'. mysql_error() .'</span>';
      }

      $string .= '<br /><span class="worked"><b>Success!</b>&nbsp;Everything was set up correctly. You can now use your news posting system!</span><br />';
      $showForm = 'No';
      return $string;
   }

   if (!$_POST['mysqlHost']) {
      $_POST['mysqlHost'] = 'localhost';
   }
   
?>

<form action="install.php" method="post">
<table id="installTable">
<tr>
<td colspan="2" class="alignCenter"><h3>Install NedreN's News System</h3></td>
</tr>

<tr>
<td colspan="2" class="alignCenter">Fill out your required information and submit to install NedreN's News System</td>
</tr>

<?php 
   if ($_POST['submit']) {
      echo '<tr><td class="results">'. installScript() .'</td></tr>';
   }
?>

<tr>
<td>

<?php
   if ($showForm != 'No') {
?>

<center>
<table id="installSubTable">
<tr>
<td><b>MySQL Host</b>:</td>
<td><input type="text" name="mysqlHost" value="<?php echo $_POST['mysqlHost']; ?>" size="25" /></td>
</tr>

<tr>
<td><b>MySQL Username</b>:</td>
<td><input type="text" name="mysqlUsername" value="<?php echo $_POST['mysqlUsername']; ?>" size="25" /></td>
</tr>

<tr>
<td><b>MySQL Password</b>:</td>
<td><input type="text" name="mysqlPassword" value="<?php echo $_POST['mysqlPassword']; ?>" size="25" /></td>
</tr>

<tr>
<td><b>MySQL Database</b>:</td>
<td><input type="text" name="mysqlDatabase" value="<?php echo $_POST['mysqlDatabase']; ?>" size="25" /></td>
</tr>

<tr>
<td><b>Administrator Username</b>:</td>
<td><input type="text" name="adminUsername" value="<?php echo $_POST['adminUsername']; ?>" size="25" /></td>
</tr>

<tr>
<td><b>Administrator Password</b>:</td>
<td><input type="text" name="adminPassword" value="<?php echo $_POST['adminPassword']; ?>" size="25" /></td>
</tr>

<tr>
<td colspan="2" class="alignCenter"><input type="submit" name="submit" value="Install" /></td>
</tr>
</table>
</center>
<?php
   }
?>
</td>
</tr>
</table>

</form>
</body>

Again, I'm not sure if this will help you much. It's pretty self-explanitory. I check for various things to be filled out, then use the supplied information to connect to a MySQL database and create the tables.
 
Last edited:
Top