Location: PHPKode > projects > QuickTicket > quickticket/quickticket/install/qti_setup_user.inc
<?php

// QuickTicket 1.9.0.3 build:20081001

switch(substr($oDB->type,0,5))
{

case 'mysql':
  $strQ='CREATE TABLE '.$qti_prefix.'qtiuser (
  id int,
  name varchar(24) NOT NULL UNIQUE,
  closed char(1) NOT NULL default "0",
  role char(1) NOT NULL default "V",
  pwd varchar(40),
  www varchar(64),
  mail varchar(64),
  phone varchar(64),
  privacy char(1) NOT NULL default "1",
  location varchar(24),
  firstdate varchar(20) NOT NULL default "0",
  lastdate varchar(20) NOT NULL default "0",
  birthday varchar(20),
  numpost int,
  signature varchar(255),
  avatar varchar(4),
  children char(1) NOT NULL default "0",
  parentmail varchar(64),
  parentagree char(1),
  x decimal(13,10),
  y decimal(13,10),
  z decimal(13,2),
  ip varchar(24),
  PRIMARY KEY (id)
  )';
  break;

case 'mssql':
  $strQ='CREATE TABLE '.$qti_prefix.'qtiuser (
  id int NOT NULL CONSTRAINT pk_'.$qti_prefix.'qtiuser PRIMARY KEY,
  name varchar(24) NOT NULL CONSTRAINT uk_'.$qti_prefix.'qtiuser UNIQUE,
  closed char(1) NOT NULL default "0",
  role char(1) NOT NULL default "V",
  pwd varchar(40) NULL,
  www varchar(64) NULL,
  mail varchar(64) NULL,
  phone varchar(64) NULL,
  privacy char(1) NOT NULL default "1",
  location varchar(24) NULL,
  firstdate varchar(20) NOT NULL default "0",
  lastdate varchar(20) NOT NULL default "0",
  birthday varchar(20) NULL,
  numpost int NULL,
  signature varchar(255) NULL,
  avatar varchar(4) NULL,
  children char(1) NOT NULL default "0",
  parentmail varchar(64) NULL,
  parentagree char(1) NULL,
  x decimal(13,10) NULL,
  y decimal(13,10) NULL,
  z decimal(13,2) NULL,
  ip varchar(24) NULL
  )';
  break;

case 'pg':
  $strQ='CREATE TABLE '.$qti_prefix.'qtiuser (
  id integer,
  name varchar(24) UNIQUE,
  closed char(1) NOT NULL default "0",
  role char(1) NOT NULL default "V",
  pwd varchar(40),
  www varchar(64),
  mail varchar(64),
  phone varchar(64),
  privacy char(1) NOT NULL default "1",
  location varchar(24),
  firstdate varchar(20) NOT NULL default "0",
  lastdate varchar(20) NOT NULL default "0",
  birthday varchar(20),
  numpost integer,
  signature varchar(255),
  avatar varchar(4),
  children char(1) NOT NULL default "0",
  parentmail varchar(64),
  parentagree char(1),
  x decimal(13,10),
  y decimal(13,10),
  z decimal(13,2),
  ip varchar(24),
  PRIMARY KEY (id)
  )';
  break;

case 'ibase':
  $strQ='CREATE TABLE '.$qti_prefix.'qtiuser (
  id integer,
  name varchar(24) UNIQUE,
  closed char(1) default "0",
  role char(1) default "V",
  pwd varchar(40),
  www varchar(64),
  mail varchar(64),
  phone varchar(64),
  privacy char(1) default "1",
  location varchar(24),
  firstdate varchar(20) default "0",
  lastdate varchar(20) default "0",
  birthday varchar(20),
  numpost integer,
  signature varchar(255),
  avatar varchar(4),
  children char(1) default "0",
  parentmail varchar(64),
  parentagree char(1),
  x decimal(13,10),
  y decimal(13,10),
  z decimal(13,2),
  ip varchar(24),
  PRIMARY KEY (id)
  )';
  break;

case 'sqlit':
  $strQ='CREATE TABLE '.$qti_prefix.'qtiuser (
  id integer,
  name text UNIQUE,
  closed text NOT NULL default "0",
  role text NOT NULL default "V",
  pwd text,
  www text,
  mail text,
  phone text,
  privacy text NOT NULL default "1",
  location text,
  firstdate text,
  lastdate text,
  birthday text,
  numpost integer,
  signature text,
  avatar text,
  children text NOT NULL default "0",
  parentmail text,
  parentagree text,
  x real,
  y real,
  z real,
  ip text,
  PRIMARY KEY (id)
  )';
  break;

case 'acces':
  $strQ='CREATE TABLE '.$qti_prefix.'qtiuser (
  id int CONSTRAINT pk_'.$qti_prefix.'qtiuser PRIMARY KEY,
  name varchar(24) CONSTRAINT uk_'.$qti_prefix.'qtiuser UNIQUE,
  closed char(1),
  role char(1),
  pwd varchar(40),
  www varchar(64),
  mail varchar(64),
  phone varchar(64),
  privacy char(1),
  location varchar(24),
  firstdate varchar(20),
  lastdate varchar(20),
  birthday varchar(20),
  numpost int,
  signature varchar(255),
  avatar varchar(4),
  children char(1),
  parentmail varchar(64),
  parentagree char(1),
  x float,
  y float,
  z float,
  ip varchar(24)
  )';
  break;

case 'db2':
  $strQ='CREATE TABLE '.$qti_prefix.'qtiuser (
  id integer NOT NULL,
  name varchar(24) NOT NULL UNIQUE,
  closed char(1) NOT NULL default "0",
  role char(1) NOT NULL default "V",
  pwd varchar(40),
  www varchar(64),
  mail varchar(64),
  phone varchar(64),
  privacy char(1) NOT NULL default "1",
  location varchar(24),
  firstdate varchar(20) NOT NULL default "0",
  lastdate varchar(20) NOT NULL default "0",
  birthday varchar(20),
  numpost integer,
  signature varchar(255),
  avatar varchar(4),
  children char(1) NOT NULL default "0",
  parentmail varchar(64),
  parentagree char(1),
  x decimal(13,10),
  y decimal(13,10),
  z decimal(13,2),
  ip varchar(24),
  PRIMARY KEY (id)
  )';
  break;

case 'ifx':
  $strQ='CREATE TABLE '.$qti_prefix.'qtiuser (
  id integer,
  name varchar(24),
  closed char(1) default "0" NOT NULL,
  role char(1) default "V" NOT NULL,
  pwd varchar(40),
  www varchar(64),
  mail varchar(64),
  phone varchar(64),
  privacy char(1) default "1" NOT NULL,
  location varchar(24),
  firstdate varchar(20) default "0" NOT NULL,
  lastdate varchar(20) default "0" NOT NULL,
  birthday varchar(20),
  numpost integer,
  signature varchar(255),
  avatar varchar(4),
  children char(1) default "0" NOT NULL,
  parentmail varchar(64),
  parentagree char(1),
  x decimal(13,10),
  y decimal(13,10),
  z decimal(13,2),
  ip varchar(24),
  PRIMARY KEY (id)
  )';
  break;


case 'oci':
  $strQ='CREATE TABLE '.$qti_prefix.'qtiuser (
  id number(32),
  name varchar2(24),
  closed char(1) default "0" NOT NULL,
  role char(1) default "V" NOT NULL,
  pwd varchar2(40),
  www varchar2(64),
  mail varchar2(64),
  phone varchar2(64),
  privacy char(1) default "1" NOT NULL,
  location varchar2(24),
  firstdate varchar2(20) default "0" NOT NULL,
  lastdate varchar2(20) default "0" NOT NULL,
  birthday varchar2(20) default "0" NOT NULL,
  numpost number(32),
  signature varchar2(255),
  avatar varchar2(4),
  children char(1) default "0" NOT NULL,
  parentmail varchar2(64),
  parentagree char(1),
  x decimal(13,10),
  y decimal(13,10),
  z decimal(13,2),
  ip varchar2(24),
  CONSTRAINT pk_'.$qti_prefix.'qtiuser PRIMARY KEY (id))';
  break;

default:
  die("Database type [{$oDB->type}] not supported... Must be mysql, mssql, pg, sqlite, firebird, db2, ifx or access");

}

echo '<div style="margin-left:20px; color:blue;">';
$b=$oDB->Query($strQ);
echo '</div>';

if ( !empty($oDB->error) || !$b )
{
  echo '<div class="div_setup_err">',sprintf ($L['E_install'],$qti_prefix.'qtiuser',$qti_database,$qti_user),'</div>';
  echo '<br/><table cellspacing="0" class="ta_button"><tr><td></td><td class="td_button" style="width:120px">&nbsp;<a href="qti_setup_1.php">',$L['Restart'],'</a>&nbsp;</td></tr></table>';
  exit;
}

$oDB->Query( 'INSERT INTO '.$qti_prefix.'qtiuser (id,name,avatar,closed,role,firstdate,lastdate,numpost,privacy,children,parentagree) VALUES (0,"Visitor","0","0","V","'.Date('Ymd His').'","'.Date('Ymd His').'",0,"0","0","0")' );
$oDB->Query( 'INSERT INTO '.$qti_prefix.'qtiuser (id,name,avatar,closed,role,pwd,firstdate,lastdate,numpost,privacy,signature,children,parentagree) VALUES (1,"Admin","0","0","A","'.sha1('Admin').'","'.Date('Ymd His').'","'.Date('Ymd His').'",0,"0","[i][b]The board Administrator[/b][/i]","0","0")' );

?>
Return current item: QuickTicket