sys_data_replace.htm
6 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<!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=<?php echo $cfg_soft_lang; ?>">
<title>数据批量替换</title>
<script language='javascript' src='js/main.js'></script>
<script language='javascript' src='../include/js/dedeajax2.js'></script>
<script language='javascript'>
function ShowFields(){
var exptable = $DE('exptable').options[$DE('exptable').selectedIndex].value;
var queryUrl = "sys_data_replace.php?exptable="+exptable+"&action=getfields";
var myajax = new DedeAjax($DE('fields'),true,true,'','x','...');
myajax.SendGet(queryUrl);
}
function CheckSubmit(){
if($DE('rpfield').value==""){
alert("你选择的操作为手工指定字段,但你并没指定!");
return false;
}
if($DE('rpstring').value==""){
alert("你没指定要替换的字符串!");
return false;
}
return true;
}
function pf(v){
$DE('rpfield').value = v;
}
</script>
<link href="css/base.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="bodytitle">
<div class="bodytitleleft"></div>
<div class="bodytitletxt" style="padding-left:10px;">批量管理</div>
</div>
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle" style=" background:#CFCFCF;">
<form action="sys_data_replace.php" name="form1" method="post" target="stafrm" onSubmit="return CheckSubmit()">
<input type='hidden' name='action' value='apply'>
<tr>
<td height="28" bgcolor="#EDF9D5" background="images/tbg.gif" style="padding-left:10px;">
<strong>数据库内容替换:</strong>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF">
<table width="100%" border="0" cellpadding="2" cellspacing="2">
<tr bgcolor="#FFFFFF">
<td colspan="2" style="line-height:180%">
<img src="images/help.gif" width="16" height="16" /> 程序用于批量替换数据库中某字段的内容,此操作极为危险,请小心使用。
</td>
</tr>
<tr id='datasel'>
<td width="15%" height="66"> 选择数据表与字段:</td>
<td> <table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td id="tables">
<?php
$dsql->SetQuery("Show Tables");
$dsql->Execute('t');
if($dsql->GetError()!=''){
echo "<font color='red'>找不到你所指定的数据库! $dbname</font><br>";
echo $qbutton;
}
echo "<select name='exptable' id='exptable' size='10' style='width:60%' onchange='ShowFields()'>\r\n";
while($row = $dsql->GetArray('t',MYSQL_BOTH)){
echo "<option value='{$row[0]}'>{$row[0]}</option>\r\n";
}
echo "</select>\r\n";
$dsql->Close();
?> </td>
</tr>
<tr>
<td id='fields'></td>
</tr>
<tr>
<td height="28"> 要替换的字段:
<input name="rpfield" type="text" id="rpfield" class="alltxt" />
</td>
</tr>
</table></td>
</tr>
<tr bgcolor="#FBFCE2">
<td> 替换方式:</td>
<td>
<input name="rptype" type="radio" id="ot1" value="replace" checked='1' class='np' />
普通替换
<input type="radio" name="rptype" id="ot2" value="regex" class='np' />
正则表达式 主键字段:
<input name="keyfield" type="text" id="keyfield" size="12" class="alltxt"/>
(正则模式必须指定)
</td>
</tr>
<tr>
<td> 被替换内容:</td>
<td><textarea name="rpstring" id="rpstring" class="alltxt" style="width:60%;height:50px"></textarea></td>
</tr>
<tr>
<td> 替换为:</td>
<td><textarea name="tostring" id="tostring" class="alltxt" style="width:60%;height:50px"></textarea></td>
</tr>
<tr>
<td height="29"> 替换条件:</td>
<td><input name="condition" type="text" id="condition" style="width:45%" class="alltxt" />
(空完全替换)</td>
</tr>
<tr>
<td height="29"> 安全确认码:</td>
<td>
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="90">
<input type="text" name="validate" class="alltxt" style="width:80px;text-transform: uppercase;" />
</td>
<td>
<img src='../include/vdimgck.php' />
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="31" bgcolor="#ffffff" align="center">
<input type="submit" name="Submit" value="开始替换数据" class="np coolbg" />
</td>
</tr>
</form>
<tr bgcolor="#F9FCEF">
<td height="20" > <table width="100%">
<tr>
<td width="74%"><strong>结果:</strong></td>
<td width="26%" align="right">
<script language='javascript'>
function ResizeDiv(obj,ty)
{
if(ty=="+") document.all[obj].style.pixelHeight += 50;
else if(document.all[obj].style.pixelHeight>80) document.all[obj].style.pixelHeight = document.all[obj].style.pixelHeight - 50;
}
</script>
[<a href='#' onClick="ResizeDiv('mdv','+');">增大</a>] [<a href='#' onClick="ResizeDiv('mdv','-');">缩小</a>] </td>
</tr>
</table></td>
</tr>
<tr bgcolor="#FFFFFF">
<td id="mtd"> <div id='mdv' style='width:100%;height:250px;'>
<iframe name="stafrm" frameborder="0" id="stafrm" width="100%" height="100%"></iframe>
</div>
</td>
</tr>
</table>
</body>
</html>