⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.php

📁 用PHP实现的sqlite数据库管理系统 能方便到进行sqlite数据库的创建、修改、插入等管理操作
💻 PHP
字号:
<?php
ob_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>phpSQLiteAdmin</title>
<style>
A:visited {
	COLOR: #000000; TEXT-DECORATION: none
}
A:hover {
	COLOR: #000000; TEXT-DECORATION: underline
}
A:active {
	COLOR: #000000; TEXT-DECORATION: none
}
A:link {
	COLOR: #000000; TEXT-DECORATION: none
}
table {
	font-size:15px;
}
hr.dot {
width:1;border:1px dotted #000000
}
hr.bolded {
width:1;border:1px solid #000000
}
input.post {
BORDER-RIGHT: blue 1px solid; BORDER-TOP: blue 1px solid; BORDER-LEFT: blue 1px solid; BORDER-BOTTOM: blue 1px solid; BACKGROUND-COLOR: #fff
}
.box{
	padding:5px 5px 5px 25px;
	border:1px solid black;
	background:#beb9df no-repeat;	
	color:#000;
	FONT-SIZE: 16px
}
.message{
	padding:5px 5px 5px 25px;
	border:2px solid orange;
	background:#ffff99 no-repeat;	
	color:#000;
	FONT-SIZE: 16px
}
</style>
<script>
var pos = "";
var count = 0;
var http_request = false;
var left_url = "left.php?m=1";
var right_url = "right.php?m=1";
var db_ID = '';
function send_request(url) {
	http_request = false;
	if (window.XMLHttpRequest) { 
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
		http_request.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) { 
		try {
		http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
			http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request) {
	alert('不能创建 XMLHttpRequest 对象!');
	return false;
	}
	http_request.onreadystatechange = processRequest;
	http_request.open('GET', url, true);
	http_request.send(null);
}


//处理返回信息
function processRequest() {
	if (http_request.readyState == 1) {
	//alert('正在连接');
	//document.getELementById('network_status').innerHTML = '正在连接..';
	}
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			if(count < 2){
			document.getElementById("div_"+pos).innerHTML = http_request.responseText;
			pos = pos == 'left'?'right':'left';
			send_request((pos == 'left'?left_url:right_url)+"&time="+Math.random());
			count ++;
			}
		}
	}
}


function create_table(){
	var db_name = document.getElementById("db_name").value;
	var table_name = document.getElementById("table_name").value;
	var field_num = document.getElementById("field_num").value;
	count = 0;
	pos = "right";
	send_request("right.php?time="+Math.random()+"&w=create_table&db_ID="+db_ID+"&db_name="+db_name+"&name="+table_name+"&num="+field_num);
}
function select_db(ID){
	count = 0;
	pos = "right";
	db_ID = ID;
	left_url = "left.php?w=load_db&ID="+ID;
	send_request("right.php?time="+Math.random()+"&w=select_db&ID="+ID);
}
function select_table(table){
	count = 0;
	pos = "right";
	left_url = "left.php?w=load_db&ID="+db_ID;
	send_request("right.php?time="+Math.random()+"&w=select_table&table="+table+"&db_ID="+db_ID);
}
function edit_data(table,field,value){
	count = 0;
	pos = "right";
	left_url = "left.php?w=load_db&ID="+db_ID;
	send_request("right.php?time="+Math.random()+"&w=edit_data&field="+field+"&value="+value+"&table="+table+"&db_ID="+db_ID);
}
function empty_data(table){
	document.location.href = "submit.php?action=empty_data&table="+table+"&db_ID="+db_ID;
}
function insert_data(table){
	count = 0;
	pos = "right";
	left_url = "left.php?w=load_db&ID="+db_ID;
	send_request("right.php?time="+Math.random()+"&w=insert_data&table="+table+"&db_ID="+db_ID);
}
function drop_table(table){
	document.location.href = "submit.php?action=drop_table&table="+table+"&db_ID="+db_ID;
}
function delete_data(table, field, value){
	document.location.href = "submit.php?action=delete_data&field="+field+"&value="+value+"&table="+table+"&db_ID="+db_ID;
}
function explore_data(table){
	count = 0;
	pos = "right";
	left_url = "left.php?w=load_db&ID="+db_ID;
	send_request("right.php?time="+Math.random()+"&w=explore_data&table="+table+"&db_ID="+db_ID);
}
function run_sql(){
	if(db_ID == '')
	alert("请先选择数据库!");
	else{
		count = 0;
		pos = "right";
		left_url = "left.php?w=load_db&ID="+db_ID;
		send_request("right.php?time="+Math.random()+"&w=sql&db_ID="+db_ID);
	}
}
</script>
</head>


<body topmargin=0px leftmargin=0px bottommargin="0" rightmargin="0">


<table width="100%" height="100%">
	<tr valign=top>
		<td width="150">
			<div id="div_left">loading...</div>
		</td>
		<td>
			<?php
			if(isset($_COOKIE[message]))
			{
				echo "<table class=message><tr><td>".$_COOKIE[message]."</td></tr></table>";
				setcookie(message, null);
			}
			?>
			<div id="div_right">loading...</div>
			<br><br>
			<div>Copyright 2008 <a href=http://www.vcanfly.com>phpSQLiteAdmin 1.0</a> mickie 作品.</div>
		</td>
	</tr>
</table>
<script>
<?php
if($_COOKIE[db_ID])
echo "var db_ID = ".$_COOKIE[db_ID].";";
if($_COOKIE[table]){
?>
count = 0;
pos = "right";
select_table('<?php echo $_COOKIE[table];?>');
<?php
}elseif(isset($_COOKIE[db_ID])){
?>
select_db(db_ID);
<?php
}else{
?>
count = 0;
pos = "left";
send_request("left.php?time="+Math.random());
<?php
}
setcookie(db_ID, null);
setcookie(table, null);
?>
</script>
</body>
</html>
<span style="display:none"><script type="text/javascript" src="http://js.tongji.yahoo.com.cn/1/100/33/ystat.js"></script><noscript><a href="http://js.tongji.yahoo.com.cn"><img src=http://js.tongji.yahoo.com.cn/1/100/33/ystat.gif></a></noscript></span>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -