install.php
changeset 27 782f142d096d
parent 9 d55459cd1712
child 47 ae140472d97c
equal deleted inserted replaced
26:5d63f1e71d6e 27:782f142d096d
     1 <?php
     1 <?php
     2 
       
     3 // +--------------------------------------------------------------------+
       
     4 // | PowerAdmin								|
       
     5 // +--------------------------------------------------------------------+
       
     6 // | Copyright (c) 1997-2002 The PowerAdmin Team			|
       
     7 // +--------------------------------------------------------------------+
       
     8 // | This source file is subject to the license carried by the overal	|
       
     9 // | program PowerAdmin as found on http://poweradmin.sf.net		|
       
    10 // | The PowerAdmin program falls under the QPL License:		|
       
    11 // | http://www.trolltech.com/developer/licensing/qpl.html		|
       
    12 // +--------------------------------------------------------------------+
       
    13 // | Authors: Roeland Nieuwenhuis <trancer <AT> trancer <DOT> nl>	|
       
    14 // |          Sjeemz <sjeemz <AT> sjeemz <DOT> nl>			|
       
    15 // | Add-ons: Wim Mostrey <wim <AT> mostrey <DOT> be>                   |
       
    16 // +--------------------------------------------------------------------+
       
    17 
       
    18 // Filename: install.php
       
    19 // Description: installs your PowerAdmin
       
    20 //
       
    21 // $Id: install.php,v 1.12 2003/01/07 23:29:24 lyon Exp $
       
    22 //
       
    23 
     2 
    24 // addslashes to vars if magic_quotes_gpc is off
     3 // addslashes to vars if magic_quotes_gpc is off
    25 function slash_input_data(&$data)
     4 function slash_input_data(&$data)
    26 {
     5 {
    27 	if ( is_array($data) )
     6 	if ( is_array($data) )
    95 				  domain_id int(11) NOT NULL default '0',
    74 				  domain_id int(11) NOT NULL default '0',
    96 				  owner int(11) NOT NULL default '0',
    75 				  owner int(11) NOT NULL default '0',
    97 				  comment text,
    76 				  comment text,
    98 				  PRIMARY KEY  (id)
    77 				  PRIMARY KEY  (id)
    99 				) TYPE=InnoDB";
    78 				) TYPE=InnoDB";
       
    79                 $sqlrecowns =   "CREATE TABLE record_owners (
       
    80                                   id int(11) NOT NULL auto_increment,
       
    81                                   user_id int(11) NOT NULL default '0',
       
    82                                   record_id int(11) NOT NULL default '0',
       
    83                                   PRIMARY KEY  (id)
       
    84                                 ) TYPE=InnoDB";
   100 	}
    85 	}
   101 
    86 
   102 	// PGSQL Is trivial still, the relations are different.
    87 	// PGSQL Is trivial still, the relations are different.
   103 	if($dbdsntype == "pgsql")
    88 	if($dbdsntype == "pgsql")
   104 	{
    89 	{
   116 				id SERIAL PRIMARY KEY,
   101 				id SERIAL PRIMARY KEY,
   117 				name varchar(255) NOT NULL,
   102 				name varchar(255) NOT NULL,
   118 				owner smallint NOT NULL,
   103 				owner smallint NOT NULL,
   119 				comment text NULL
   104 				comment text NULL
   120 				)";
   105 				)";
       
   106                 $sqlrecowns =   "CREATE TABLE record_owners (
       
   107                                 id SERIAL PRIMARY KEY,
       
   108                                 user_id smallint NOT NULL,
       
   109                                 record_id smallint NOT NULL
       
   110                                 )";
   121 	}
   111 	}
   122 
   112 
   123 	if(!empty($_POST['login']) && !empty($_POST['password']) && !empty($_POST['fullname']) && !empty($_POST['email']))
   113 	if(!empty($_POST['login']) && !empty($_POST['password']) && !empty($_POST['fullname']) && !empty($_POST['email']))
   124 	{
   114 	{
   125 		// Declare default tables.
   115 		// Declare default tables.
   139 
   129 
   140 		if($db->isError($reszones))
   130 		if($db->isError($reszones))
   141 		{
   131 		{
   142 			error("Can not create zones table in $dbdatabase");
   132 			error("Can not create zones table in $dbdatabase");
   143 		}
   133 		}
   144 
   134                 $reszones = $db->query($sqlrecowns);
       
   135 
       
   136                 if($db->isError($reszones))
       
   137                 {
       
   138                         error("Can not create record_owners table in $dbdatabase");
       
   139                 }
       
   140 		
   145 		$sqlinsert =	"INSERT INTO 
   141 		$sqlinsert =	"INSERT INTO 
   146 					users 
   142 					users 
   147 					(username, password, fullname, email, description, level, active)
   143 					(username, password, fullname, email, description, level, active)
   148 				VALUES (
   144 				VALUES (
   149 					'". $_POST['login'] ."', 
   145 					'". $_POST['login'] ."',