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

// QuickTalk 2.5 build:20100924

session_start();

function SqlDrop($strTable,$strConstrain=null)
{
  global $oDB;
  if ( isset($strConstrain) && $oDB->type=='oci' ) $oDB->Query('ALTER TABLE '.$strTable.' DROP CONSTRAINT '.$strConstrain);
  $oDB->Query('DROP TABLE '.$strTable);
}

// INITIALISATION

include('../bin/qt_lib_db.php');
include('../bin/config.php');
define ('TABDOMAIN', $qtf_prefix.'qtadomain');
define ('TABSECTION', $qtf_prefix.'qtaforum');
define ('TABUSER', $qtf_prefix.'qtauser');
define ('TABTOPIC', $qtf_prefix.'qtatopic');
define ('TABPOST', $qtf_prefix.'qtapost');
define ('TABSETTING', $qtf_prefix.'qtasetting');
define ('TABLANG', $qtf_prefix.'qtalang');

$strAppl = 'QuickTalk 1.9';
include('qtf_lang_en.php');

// --------
// HTML START
// --------

echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" xml:lang="en" lang="en">
<head>
<title>Uninstalling ',$strAppl,'</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<link rel="stylesheet" href="../admin/qtf_main.css">
</head>

<body>

<!-- PAGE CONTROL -->
<div class="qtf_page">
<table class="qtf_page" width="750" cellspacing="0" style="margin:5px">
<tr class="qtf_page">
<td class="qtf_page">
<!-- PAGE CONTROL -->

<!-- HEADER BANNER -->
<div class="banner">
<div class="banner_in">
<img  class="banner_logo" src="qtf_logo.gif" alt="QuickTalk" title="QuickTalk"/>
</div>
</div>
<!-- END HEADER BANNER -->

<!-- BODY MAIN -->
<table width="100%" cellspacing="0" style="border-style:solid;border-color:#AAAAAA;border-width:1px;">
<tr class="tr_body">
<td class="td_body">
<!-- BODY MAIN -->
';

echo '1. <b>Opening database connection</b>... ';

$oDB = new cDB($qtf_dbsystem,$qtf_host,$qtf_database,$qtf_user,$qtf_pwd,$qtf_port,$qtf_dsn);
if ( !empty($oDB->error) ) die ('<p style="color:red">Connection with database failed.<br/>Check that server is up and running.<br/>Check that the settings in the file <b>bin/config.php</b> are correct for your database.</p>');

echo 'done<br/><br/>';

// SUBMITTED

if ( isset($_GET['a']) )
{
  switch ($_GET['a'])
  {
  case 'Drop ALL tables':
    echo ' Dropping Post...'; SqlDrop(TABPOST,'pk_'.$qtf_prefix.'qtapost'); echo 'done.<br/>';
    echo ' Dropping Topic...'; SqlDrop(TABTOPIC,'pk_'.$qtf_prefix.'qtatopic'); echo 'done.<br/>';
    echo ' Dropping Section...'; SqlDrop(TABSECTION,'pk_'.$qtf_prefix.'qtaforum'); echo 'done.<br/>';
    echo ' Dropping Domain...'; SqlDrop(TABDOMAIN,'pk_'.$qtf_prefix.'qtadomain'); echo 'done.<br/>';
    echo ' Dropping User...'; SqlDrop(TABUSER,'pk_'.$qtf_prefix.'qtauser'); echo 'done.<br/>';
    echo ' Dropping Setting...'; SqlDrop(TABSETTING); echo 'done.<br/>';
    echo ' Dropping Lang...'; SqlDrop(TABLANG); echo 'done.<br/>';
    break;
  case 'Drop table Post':
    echo ' Dropping Post...'; SqlDrop(TABPOST,'pk_'.$qtf_prefix.'qtapost'); echo 'done.<br/>'; break;
  case 'Drop table Topic':
    echo ' Dropping Topic...'; SqlDrop(TABTOPIC,'pk_'.$qtf_prefix.'qtatopic'); echo 'done.<br/>'; break;
  case 'Drop table Section':
    echo ' Dropping Section...'; SqlDrop(TABSECTION,'pk_'.$qtf_prefix.'qtaforum'); echo 'done.<br/>'; break;
  case 'Drop table Domain':
    echo ' Dropping Domain...'; SqlDrop(TABDOMAIN,'pk_'.$qtf_prefix.'qtadomain'); echo 'done.<br/>'; break;
  case 'Drop table User':
    echo ' Dropping User...'; SqlDrop(TABUSER,'pk_'.$qtf_prefix.'qtauser'); echo 'done.<br/>'; break;
  case 'Drop table Setting':
    echo ' Dropping Setting...'; SqlDrop(TABSETTING); echo 'done.<br/>'; break;
  case 'Drop table Lang':
    echo ' Dropping Lang...'; SqlDrop(TABLANG); echo 'done.<br/>'; break;
  case 'Add table Post':
    include('qtf_setup_post.php'); echo $_GET['a'],' done'; break;
  case 'Add table Topic':
    include('qtf_setup_topic.php'); echo $_GET['a'],' done'; break;
  case 'Add table Sectionm':
    include('qtf_setup_section.php'); echo $_GET['a'],' done'; break;
  case 'Add table Domain':
    include('qtf_setup_domain.php'); echo $_GET['a'],' done'; break;
  case 'Add table User':
    include('qtf_setup_user.php'); echo $_GET['a'],' done'; break;
  case 'Add table Setting':
    include('qtf_setup_setting.php'); echo $_GET['a'],' done'; break;
  case 'Add table Lang':
    include('qtf_setup_lang.php'); echo $_GET['a'],' done'; break;
  }
}

// Tables do drop

echo '<br/>2. <b>Drop the tables</b><br/>';

echo '<form action="qtf_droptables.php" method="get">';
echo '<input type="submit" name="a" value="Drop ALL tables"/> from the database ',$qtf_database,'<br/><br/>';
echo '<input type="submit" name="a" value="Drop table Post"/> ',TABPOST,'<br/>';
echo '<input type="submit" name="a" value="Drop table Topic"/> ',TABTOPIC,'<br/>';
echo '<input type="submit" name="a" value="Drop table User"/> ',TABUSER,'<br/>';
echo '<input type="submit" name="a" value="Drop table Section"/> ',TABSECTION,'<br/>';
echo '<input type="submit" name="a" value="Drop table Domain"/> ',TABDOMAIN,'<br/>';
echo '<input type="submit" name="a" value="Drop table Setting"/> ',TABSETTING,'<br/>';
echo '<input type="submit" name="a" value="Drop table Lang"/> ',TABLANG,'<br/><br/>';
echo '<input type="submit" name="a" value="Add table Post"/> ',TABPOST,'<br/>';
echo '<input type="submit" name="a" value="Add table Topic"/> ',TABTOPIC,'<br/>';
echo '<input type="submit" name="a" value="Add table User"/> ',TABUSER,'<br/>';
echo '<input type="submit" name="a" value="Add table Section"/> ',TABSECTION,'<br/>';
echo '<input type="submit" name="a" value="Add table Domain"/> ',TABDOMAIN,'<br/>';
echo '<input type="submit" name="a" value="Add table Setting"/> ',TABSETTING,'<br/>';
echo '<input type="submit" name="a" value="Add table Lang"/> ',TABLANG,'<br/>';
echo '</form>';

echo '<p><a href="qtf_setup.php">install &raquo;</a></p>';

// --------
// HTML END
// --------

echo '
<!-- END BODY MAIN -->
</td>
</tr>
</table>
<!-- END BODY MAIN -->

<div class="div_footer_copy">
<span class="footer_copy">powered by <a href="http://www.qt-cute.org" class="footer_copy">QT-cute</a></span>
</div>

<!-- END PAGE CONTROL -->
</td>
</tr>
</table>
</div>
<!-- END PAGE CONTROL -->

</body>
</html>';
?>
Return current item: QuickTalk Forum