-
Notifications
You must be signed in to change notification settings - Fork 84
/
cloneTable.php
40 lines (34 loc) · 937 Bytes
/
cloneTable.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
include_once 'config.inc.php';
include_once 'templates/style.css';
if(!@$_GET['database'])
{
die($lang['dieDatabaseChoose']);
}
else
{
if(!@$_GET['table'])
{
echo "<script>window.location=dbStructure.php?database=".$_GET['database']."</script>";
}
else
{
$transport = new TSocket(HOST, PORT);
$protocol = new TBinaryProtocol($transport);
$client = new ThriftHiveClient($protocol);
$transport->open();
$client->execute('use '.$_GET['database']);
echo "<a href=dbStructure.php?database=".$_GET['database'].">".$lang['back']."</a><br><br>";
if(!@$_POST['newtablename'])
{
include_once "templates/clone_table.html";
}
else
{
$sql = 'CREATE TABLE '.$_POST['newtablename'].' LIKE '.$_POST['table'];
echo $sql;
$client->execute($sql);
echo "<script>alert('".$lang['createTableSuccess']."');window.location='dbStructure.php?database=".$_POST['database']."';</script>";
}
}
}