Location: PHPKode > projects > WorkOrder TS > workorder-ts/setup_files/uninstall_drop.php
<?PHP error_reporting(E_ALL);$inc_dir='../include/';require_once $inc_dir.'magic_quotes.php';require_once 'defaults.php';if( count($_POST) < 2 ) { die("You can not run this script directly.");} $_joLfj=NULL;$_jolJC=NULL;$_jolfC=NULL;$_jolof=NULL;$_jC001=NULL;$_jC0Q0=NULL;$_jC0ti=NULL;require_once $inc_dir.'config-user.inc.php';require_once $inc_dir.'conn-string-user.inc.php';require_once $inc_dir.'workorder_function_general.inc.php';$CONF=_OFB10($inc_dir);if( isset($_POST['txtAdminUser']) ) { $wouau=addslashes($_POST['txtAdminUser']);} else { $wouau='admin';} if( isset($_POST['txtAdminPassword']) ) { $wouap=$_POST['txtAdminPassword'];} else { $wouap=Null;} if( isset($_POST['DropDatabaseAndAccounts']) ) { $_joLfj=addslashes($_POST['DropDatabaseAndAccounts']);} if( isset($_POST['DropDatabaseOnly']) ) { $_jolJC=addslashes($_POST['DropDatabaseOnly']);} if( isset($_POST['DropTablesOnly']) ) { $_jolfC=addslashes($_POST['DropTablesOnly']);} if( isset($_POST['DropAccountsOnly']) ) { $_jolof=addslashes($_POST['DropAccountsOnly']);} if( isset($_POST['DropThisDB']) ) { $_jC001=addslashes($_POST['DropThisDB']);} if( isset($_POST['db_un_root']) ) { $db_un_root=addslashes($_POST['db_un_root']);} if( isset($_POST['db_pw_root']) ) { $db_pw_root=$_POST['db_pw_root'];} if(get_magic_quotes_gpc()) { if(ini_get('magic_quotes_sybase')) { $wouau=str_replace("''","'", $wouau);    $wouap = str_replace("''", "'",$wouap);} else { $wouau=stripslashes($wouau);$wouap=stripslashes($wouap);} } $_jCQfl=$wouap;$wouap=addslashes($wouap);$wouap=md5($wouap);$_jCQtj=sprintf("SELECT `User_ID` FROM `%s` WHERE `User_name` = '%s' AND `Userpassword` = '%s' AND `User_system` = '1' AND `User_active` = '1'",mysql_real_escape_string($CONF['TableNameUsers'],$conn),mysql_real_escape_string($wouau,$conn),mysql_real_escape_string($wouap,$conn));$res=mysql_query($_jCQtj,$conn);if( @mysql_num_rows($res) !=1 ) { $_jCQtj=sprintf("SELECT `User_ID` FROM `%s` WHERE `User_name` = '%s' AND `User_password` = '%s' AND `User_system` = '1' AND `User_active` = '1'",mysql_real_escape_string($CONF['TableNameUsers'],$conn),mysql_real_escape_string($wouau,$conn),mysql_real_escape_string($wouap,$conn));$res=mysql_query($_jCQtj,$conn) or die("$_jCQtj <br />".mysql_error());if( mysql_num_rows($res) !=1 ) { if( file_exists("../SkipPasswd")==False && file_exists("../SkipPasswd.pwd")==False ) { die('FATAL ERROR, invalid System Username or Password. You can skip this check by creating the file SkipPasswd or SkipPasswd.pwd in the WorkOrder TS root directory. Update Aborted! <img src="'.ERROR_IMG.'" width="22" height="11" />');} } } $_IljlI=0;if( isset($_POST['TableCount']) ) { $_joLQJ=addslashes($_POST['TableCount']);for( $x=0;$_joLQJ >=$x;$x++) { if( isset($_POST['DropTable'.$x]) ) { $_jC0ti[$_IljlI]=addslashes($_POST['DropTable'.$x]);$_IljlI++;} } } if( $_joLfj==1 || $_jolJC==1 ) { require_once $inc_dir.'config-user.inc.php';$conn=mysql_connect("$db_server_user","$db_un_root","$db_pw_root");$sql="DROP DATABASE $_jC001";$res=mysql_query($sql,$conn);$_j6oJi=mysql_error();$_jjQIJ=mysql_errno();if( $_jjQIJ !=0 ) { echo("An error occurred during the database drop, the script has been stopped.<br />     Database Error Message: $_j6oJi<br /> Error: uninstall_drop12");die();} echo("<p>Database Deleted</p>");} if( $_joLfj==1 || $_jolof==1 ) { require $inc_dir.'config-guest.inc.php';require_once $inc_dir.'config-user.inc.php';require_once $inc_dir.'conn-string-user.inc.php';if( isset($webserverip)==True ) { if( $webserverip=="" ) { $webserverip="localhost";} } else { $webserverip="localhost";} $conn=@mysql_connect("$db_server_user","$db_un_root","$db_pw_root");$_jCQOl=mysql_get_server_info();$_jCQOl=explode(".",$_jCQOl);$_jCI86=count($_jCQOl);if( $_jCI86 > 0 ) { if( $_jCQOl[0]==4 ) { $sql="DELETE FROM mysql.user WHERE User = '$db_un_guest'";} else { $sql="DROP USER '$db_un_guest'@'$webserverip'";} } $res=mysql_query($sql,$conn);$_j6oJi=mysql_error();$_jjQIJ=mysql_errno();if( $_jjQIJ !=0 ) { echo("Error: uninstall_drop13 <br />$sql <br />Unable to Delete the Guest Account, MySQL server returned $_j6oJi<br />");} echo("<p>Guest Account Deleted</p>");$_jCQOl=mysql_get_server_info();$_jCQOl=explode(".",$_jCQOl);$_jCI86=count($_jCQOl);if( $_jCI86 > 0 ) { if( $_jCQOl[0]==4 ) { $sql="DELETE FROM mysql.user WHERE User = '$db_un_user'";} else { $sql="DROP USER '$db_un_user'@'$webserverip'";} } $res=mysql_query($sql,$conn);$_j6oJi=mysql_error();$_jjQIJ=mysql_errno();if( $_jjQIJ !=0 ) { echo("Error: uninstall_drop14 <br />$sql <br />Unable to Delete the Guest Account, MySQL server returned $_j6oJi<br />");} echo("<p>User Account Deleted</p>");$sql="FLUSH PRIVILEGES";@$res=mysql_query($sql,$conn);} if( $_jolfC==1 ) { require_once $inc_dir.'config-user.inc.php';require_once $inc_dir.'conn-string-user.inc.php';require_once $inc_dir.'workorder_function_general.inc.php';$CONF=_OFB10($inc_dir);$_jIOL6=$CONF['TablePrefix'];$sql="SHOW TABLES FROM $db_user LIKE '$_jIOL6%'";$_j6f0I=mysql_query($sql);if (!$_j6f0I) { echo "DB Error, could not list tables\n";echo 'MySQL Error: '.mysql_error();exit;} $_joi6O=NULL;for( $x=0;$row=mysql_fetch_row($_j6f0I);$x++) { $sql="DROP TABLE $row[0]";$res=mysql_query($sql,$conn);$_j6oJi=mysql_error();$_jjQIJ=mysql_errno();if( $_jjQIJ !=0 ) { echo("An error occurred while dropping the tables, the script has been stopped.<br />      Database Error Message: $_j6oJi<br /> Error: uninstall_drop15a");die();} echo("<p>Table $row[0] Deleted</p>");} } $_jCIl8=count($_jC0ti);if( $_jCIl8 > 0 ) { for( $x=0;$x < $_jCIl8;$x++) { require_once $inc_dir.'config-user.inc.php';require_once $inc_dir.'conn-string-user.inc.php';$sql="DROP TABLE $_jC0ti[$x]";$res=mysql_query($sql,$conn);$_j6oJi=mysql_error();$_jjQIJ=mysql_errno();if( $_jjQIJ !=0 ) { echo("An error occured while dropping the tables, the script has been stopped.<br />      Database Error Message: $_j6oJi<br /> Error: uninstall_drop15");die();} echo("<p>Table $_jC0ti[$x] Deleted</p>");} } echo("Requested Uninstall Operation Completed Successfully!<br /> Maybe you could let me know why you decided to uninstall the software so that I can improve it further. <a href=\"http://www.workorderts.com/Contact?subject=Uninstalled%20WorkOrder%20TS\" target=\"_blank\">Contact</a>. Thank You.");?>
Return current item: WorkOrder TS