Some code cleanup
This commit is contained in:
parent
00322f7da8
commit
58a32d7999
93
c.php
93
c.php
@ -179,7 +179,7 @@ class connector
|
|||||||
if (!$result_id) {
|
if (!$result_id) {
|
||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
} else {
|
} else {
|
||||||
echo OK;
|
echo 'OK';
|
||||||
}
|
}
|
||||||
|
|
||||||
$info = mysql_info();
|
$info = mysql_info();
|
||||||
@ -204,7 +204,7 @@ class connector
|
|||||||
if (!$result_id) {
|
if (!$result_id) {
|
||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
} else {
|
} else {
|
||||||
echo OK;
|
echo 'OK';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -233,56 +233,47 @@ if (($user == null) || ($password == null) || ($action == null))
|
|||||||
|
|
||||||
$con = new connector($user, $password, $server);
|
$con = new connector($user, $password, $server);
|
||||||
|
|
||||||
switch ($action) {
|
if($action=="login"){
|
||||||
case "login":
|
echo $con->connect();
|
||||||
echo $con->connect();
|
} else {
|
||||||
break;
|
$con->connect();
|
||||||
case "dblist":
|
switch ($action) {
|
||||||
$con->connect();
|
case "dblist":
|
||||||
$list = $con->dbList();
|
$list = $con->dbList();
|
||||||
echo json_encode($list);
|
echo json_encode($list);
|
||||||
break;
|
break;
|
||||||
case "tablelist":
|
case "tablelist":
|
||||||
$con->connect();
|
echo json_encode($con->tableList($database));
|
||||||
echo json_encode($con->tableList($database));
|
break;
|
||||||
break;
|
case "fieldlist":
|
||||||
case "fieldlist":
|
|
||||||
$con->connect();
|
|
||||||
$con->selectDb($database);
|
|
||||||
echo json_encode($con->fieldList($table));
|
|
||||||
break;
|
|
||||||
case "numrows":
|
|
||||||
$con->connect();
|
|
||||||
$con->selectDb($database);
|
|
||||||
echo $con->numRows($table);
|
|
||||||
break;
|
|
||||||
case "query":
|
|
||||||
$con->connect();
|
|
||||||
if (isset($database))
|
|
||||||
$con->selectDb($database);
|
$con->selectDb($database);
|
||||||
$con->query($query);
|
echo json_encode($con->fieldList($table));
|
||||||
break;
|
break;
|
||||||
case "getrows":
|
case "numrows":
|
||||||
$con->connect();
|
$con->selectDb($database);
|
||||||
$con->selectDb($database);
|
echo $con->numRows($table);
|
||||||
echo json_encode($con->selectTable($table, $start, $limit));
|
break;
|
||||||
break;
|
case "query":
|
||||||
case "updateelement":
|
if (isset($database))
|
||||||
$con->connect();
|
$con->selectDb($database);
|
||||||
$con->selectDb($database);
|
$con->query($query);
|
||||||
$con->updateElement($table, $header, $oldValues, $values);
|
break;
|
||||||
break;
|
case "getrows":
|
||||||
case "addelement":
|
$con->selectDb($database);
|
||||||
$con->connect();
|
echo json_encode($con->selectTable($table, $start, $limit));
|
||||||
$con->selectDb($database);
|
break;
|
||||||
$con->addElement($table, $header, $values);
|
case "updateelement":
|
||||||
break;
|
$con->selectDb($database);
|
||||||
case "removeelement":
|
$con->updateElement($table, $header, $oldValues, $values);
|
||||||
$con->connect();
|
break;
|
||||||
$con->selectDb($database);
|
case "addelement":
|
||||||
//print_r($_GET);
|
$con->selectDb($database);
|
||||||
$con->removeElement($table, $header, $values);
|
$con->addElement($table, $header, $values);
|
||||||
|
break;
|
||||||
|
case "removeelement":
|
||||||
|
$con->selectDb($database);
|
||||||
|
$con->removeElement($table, $header, $values);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$con->disconnect();
|
$con->disconnect();
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user