Location: PHPKode > projects > QuickTalk Forum > quicktalk/install/qtf_setup_user.php
<?php

// QuickTalk 2.5 build:20100924

switch($oDB->type)
{

case 'mysql4':
  $strQ='CREATE TABLE '.$qtf_prefix.'qtauser (
  id int,
  name varchar(24)  UNIQUE,
  closed char(1) default "0",
  role char(1) default "V",
  pwd varchar(40),
  www varchar(255),
  mail varchar(255),
  privacy char(1),
  location varchar(24),
  firstdate varchar(20),
  lastdate varchar(20),
  birthday varchar(20),
  numpost int,
  signature varchar(255),
  picture varchar(255),
  children char(1),
  parentmail varchar(255),
  parentagree char(1),
  secret_q varchar(255),
  secret_a varchar(255),
  parentagree char(1),
  x decimal(13,10),
  y decimal(13,10),
  z decimal(13,2),
  ip varchar(24),
  PRIMARY KEY (id)
  )';
  break;

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

case 'mssql':
  $strQ='CREATE TABLE '.$qtf_prefix.'qtauser (
  id int CONSTRAINT pk_'.$qtf_prefix.'qtauser PRIMARY KEY,
  name varchar(24) CONSTRAINT uk_'.$qtf_prefix.'qtauser UNIQUE,
  closed char(1) default "0",
  role char(1) default "V",
  pwd varchar(40) NULL,
  www varchar(255) NULL,
  mail varchar(255) NULL,
  privacy char(1) NULL,
  location varchar(24) NULL,
  firstdate varchar(20) NULL,
  lastdate varchar(20) NULL,
  birthday varchar(20) NULL,
  numpost int NULL,
  signature varchar(255) NULL,
  picture varchar(255),
  children char(1) NULL,
  parentmail varchar(255) NULL,
  parentagree char(1) NULL,
  secret_q varchar(255)NULL,
  secret_a varchar(255) 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 '.$qtf_prefix.'qtauser (
  id integer,
  name varchar(24),
  closed char(1) default "0",
  role char(1) default "V",
  pwd varchar(40),
  www varchar(255),
  mail varchar(255),
  privacy char(1),
  location varchar(24),
  firstdate varchar(20),
  lastdate varchar(20),
  birthday varchar(20),
  numpost integer,
  signature varchar(255),
  picture varchar(255),
  children char(1),
  parentmail varchar(255),
  parentagree char(1),
  secret_q varchar(255),
  secret_a varchar(255),
  x decimal(13,10),
  y decimal(13,10),
  z decimal(13,2),
  ip varchar(24),
  PRIMARY KEY (id),
  UNIQUE (name)
  )';
  break;
  
case 'ibase':
  $strQ='CREATE TABLE '.$qtf_prefix.'qtauser (
  id integer,
  name varchar(24),
  closed char(1) default "0",
  role char(1) default "V",
  pwd varchar(40),
  www varchar(255),
  mail varchar(255),
  privacy char(1),
  location varchar(24),
  firstdate varchar(20),
  lastdate varchar(20),
  birthday varchar(20),
  numpost integer,
  signature varchar(255),
  picture varchar(255),
  children char(1),
  parentmail varchar(255),
  parentagree char(1),
  secret_q varchar(255),
  secret_a varchar(255),
  x decimal(13,10),
  y decimal(13,10),
  z decimal(13,2),
  ip varchar(24),
  PRIMARY KEY (id),
  UNIQUE (name)
  )';
  break;

case 'sqlite':
  $strQ='CREATE TABLE '.$qtf_prefix.'qtauser (
  id integer,
  name text,
  closed text default "0",
  role text default "V",
  pwd text,
  www text,
  mail text,
  privacy text,
  location text,
  firstdate text,
  lastdate text,
  birthday text,
  numpost integer,
  signature text,
  picture text,
  children text,
  parentmail text,
  parentagree text,
  secret_q text,
  secret_a text,
  x real,
  y real,
  z real,
  ip text,
  PRIMARY KEY (id),
  UNIQUE (name)
  )';
  break;
  
case 'db2':
  $strQ='CREATE TABLE '.$qtf_prefix.'qtauser (
  id integer ,
  name varchar(24)  UNIQUE,
  closed char(1)  default "0",
  role char(1)  default "V",
  pwd varchar(40),
  www varchar(255),
  mail varchar(255),
  privacy char(1),
  location varchar(24),
  firstdate varchar(20),
  lastdate varchar(20),
  birthday varchar(20),
  numpost integer,
  signature varchar(255),
  picture varchar(255),
  children char(1),
  parentmail varchar(255),
  parentagree char(1),
  secret_q varchar(255),
  secret_a varchar(255),
  x decimal(13,10),
  y decimal(13,10),
  z decimal(13,2),
  ip varchar(24),
  PRIMARY KEY (id)
  )';
  break;

case 'oci':
  $strQ='CREATE TABLE '.$qtf_prefix.'qtauser (
  id number(32),
  name varchar2(24) ,
  closed char(1) default "0" ,
  role char(1) default "V" ,
  pwd varchar2(40),
  www varchar2(255),
  mail varchar2(255),
  privacy char(1),
  location varchar2(24),
  firstdate varchar2(20),
  lastdate varchar2(20),
  birthday varchar2(20),
  numpost number(32),
  signature varchar2(255),
  picture varchar2(255),
  children char(1),
  parentmail varchar2(255),
  parentagree char(1),
  secret_q varchar2(255),
  secret_a varchar2(255),
  x decimal(13,10),
  y decimal(13,10),
  z decimal(13,2),
  ip varchar2(24),
  CONSTRAINT pk_'.$qtf_prefix.'qtauser PRIMARY KEY (id))';
  break;
  
default:
  die('Database type ['.$this->type.'] not supported... Must be mysql, mssql, pg, firebird, db2, oci');
}

echo '<span style="color:blue">';
$b=$oDB->Query($strQ);
echo '</span>';

if ( !empty($oDB->error) || !$b )
{
  echo '<div class="setup_err">',sprintf ($L['E_install'],$qtf_prefix.'qtauser',$qtf_database,$qtf_user),'</div>';
  echo '<br/><table cellspacing="0" class="button"><tr><td></td><td class="button" style="width:120px">&nbsp;<a href="qtf_setup_1.php">',$L['Restart'],'</a>&nbsp;</td></tr></table>';
  exit;
}

$oDB->Query( 'INSERT INTO '.$qtf_prefix.'qtauser (id,name,picture,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 '.$qtf_prefix.'qtauser (id,name,picture,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 forum Administrator[/b][/i]","0","0")' );

?>
Return current item: QuickTalk Forum