📄 aaa.txt
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="Pages/mlogin.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<!--#include file="Connections/conn.asp" -->
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert")) = "form1") Then
MM_editConnection = MM_conn_STRING
MM_editTable = "book"
MM_editRedirectUrl = "Pages/manager.asp"
MM_fieldsStr = "sm|value|zz|value|ym|value|cbs|value|jg|value|hyj|value|cbrq|value|advice|value|amount|value|shuhao|value|beizhu|value|leibie|value|rePic|value"
MM_columnsStr = "sm|',none,''|zz|',none,''|ym|',none,''|cbs|',none,''|jg|none,none,NULL|hyj|none,none,NULL|cbrq|',none,''|advice|none,none,NULL|amount|',none,''|shuhao|',none,''|beizhu|',none,''|leibie|',none,''|tstp|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
Dim MM_tableValues
Dim MM_dbValues
If (CStr(Request("MM_insert")) <> "") Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<!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>添加图书</title>
<link href="Pages/font.css" rel="stylesheet" type="text/css" />
<link href="Pages/css.css" rel="stylesheet" type="text/css" />
<script type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function YY_checkform() { //v4.07
//copyright (c)1998,2001 Yaromat.com
var args = YY_checkform.arguments,myDot=true,myV='',myErr='',addErr=false,myReq,rx,myObj1,myMa,myAt;
for (var i=1; i<args.length;i=i+4){
if (args[i+1].charAt(0)=='#'){myReq=true; args[i+1]=args[i+1].substring(1);}else{myReq=false}
var myObj = MM_findObj(args[i].replace(/\[\d+\]/ig,""));myV=myObj.value;
if (myObj.type=='text'||myObj.type=='password'){
if (myReq&&myObj.value.length==0)addErr=true;
if ((myV.length>0)&&(args[i+2]==1)){ //fromto
if (!(myV/1)||myV<args[i+1].split('_')[0]/1||myV > args[i+1].split('_')[1]/1){addErr=true}
}
if ((myV.length>0)&&(args[i+2]==2)){ // email
rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$");if(!rx.test(myV))addErr=true;
}
if ((myV.length>0)&&(args[i+2]==3)){ // date
myMa=args[i+1].split("#");myAt=myV.match(myMa[0]);
if(myAt){
var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var myY=myAt[myMa[3]];
var myDate=new Date(myY,myM,myD);
if(myDate.getFullYear()!=myY||myDate.getDate()!=myD||myDate.getMonth()!=myM){addErr=true};
}else{addErr=true}
}
if ((myV.length>0)&&(args[i+2]==4)){myMa=args[i+1].split("#");myAt=myV.match(myMa[0]);if(!myAt)addErr=true}// time
if (myV.length>0&&args[i+2]==5){ // check this 2
var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,""));
if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,"")];
if(!myObj1.checked)addErr=true;
}
if (myV.length>0&&args[i+2]==6){myObj1=MM_findObj(args[i+1]);if(myV!=myObj1.value)addErr=true;}// the same
}else
if (!myObj.type&&myObj.length>0&&myObj[0].type=='radio'){
var myTest = args[i].match(/(.*)\[(\d+)\].*/i);
var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj;
if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
if (args[i+2]==2){
var myDot=false;
for(var j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}
if(!myDot){myErr+='' +args[i+3]+'\n'}
}
}else
if (myObj.type=='checkbox'){
if(args[i+2]==1&&myObj.checked==false){addErr=true}
if(args[i+2]==2&&myObj.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
}else
if (myObj.type=='select-one'||myObj.type=='select-multiple'){
if(args[i+2]==1&&myObj.selectedIndex/1==0){addErr=true}
}else
if (myObj.type=='textarea'){
if(myV.length<args[i+1]){addErr=true}
}
if (addErr){myErr+=''+args[i+3]+'\n'; addErr=false}
}
if (myErr!=''){alert('\t\t\t\t\t\n\n'+myErr)}
document.MM_returnValue = (myErr=='');
}
//-->
</script>
</head>
<body background="Images/c31.gif">
<p> </p>
<p> </p>
<table width="287" height="40" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="middle"><img src="Images/005.gif" width="28" height="34" /> <span class="bluefont">管理员请在此添加图书</span> </td>
</tr>
</table>
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="form1" id="form1" onsubmit="YY_checkform('form1','ym','#q','0','请输入图书页码','cbs','#q','0','请输入出版社名称','jg','#q','0','请输入书的价格','hyj','#q','0','请输入会员价','cbrq','#q','0','请输入图书出版日期','advice','#q','0','请确认图书是否是要推荐的书','amount','#q','0','请输入图书入库的数量','shuhao','#q','0','请输入书号','leibie','#q','0','请填写图书类别','beizhu','1','1','请输入图书的详细信息');return document.MM_returnValue">
<table width="499" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="35" colspan="3" align="left" valign="middle" class="bluefont"> 图书信息添加</td>
</tr>
<tr>
<td height="18" colspan="3" class="play"> 打“*”的为必填项哦!</td>
</tr>
<tr>
<td width="154" height="25" align="center" class="bluesmallfont"> 书名*:</td>
<td width="345" height="25" colspan="2"><label>
<input name="sm" type="text" id="sm" />
</label></td>
</tr>
<tr>
<td height="25" align="center" class="bluesmallfont"> 作者*:</td>
<td height="25" colspan="2"><label>
<input name="zz" type="text" id="zz" />
</label></td>
</tr>
<tr>
<td height="25" align="center" class="bluesmallfont"> 页码*:</td>
<td height="25" colspan="2"><label>
<input name="ym" type="text" id="ym" />
</label></td>
</tr>
<tr>
<td height="25" align="center" class="bluesmallfont"> 出版社*:</td>
<td height="25" colspan="2"><label>
<input name="cbs" type="text" id="cbs" />
</label></td>
</tr>
<tr>
<td height="25" align="center" class="bluesmallfont"> 价格*:</td>
<td height="25" colspan="2"><label>
<input name="jg" type="text" id="jg" />
</label></td>
</tr>
<tr>
<td height="25" align="center" class="bluesmallfont"> 会员价*:</td>
<td height="25" colspan="2"><label>
<input name="hyj" type="text" id="hyj" />
</label></td>
</tr>
<tr>
<td height="25" align="center" class="bluesmallfont"> 出版日期*:</td>
<td height="25" colspan="2"><label>
<input name="cbrq" type="text" id="cbrq" />
<span class="yellow">请按*年*月*日的格式书写</span></label></td>
</tr>
<tr>
<td height="25" align="center" valign="middle" class="bluesmallfont"> 推荐图书*:</td>
<td height="25" colspan="2"><label>
<input name="advice" type="text" id="advice" />
<span class="yellow">(是要推荐的书输1,不是输0)</span></label></td>
</tr>
<tr>
<td height="25" align="center" valign="middle" class="bluesmallfont"> 数量*:</td>
<td height="25" colspan="2"><label>
<input name="amount" type="text" id="amount" />
</label></td>
</tr>
<tr>
<td height="25" align="center" valign="middle" class="bluesmallfont"> 书号*:</td>
<td height="25" colspan="2"><label>
<input name="shuhao" type="text" id="shuhao" />
</label></td>
</tr>
<tr>
<td height="25" align="center" valign="middle" class="bluesmallfont"> 备注*:</td>
<td height="25" colspan="2"><label>
<textarea name="beizhu" id="beizhu"></textarea>
</label></td>
</tr>
<tr>
<td height="25" align="center" valign="middle" class="bluesmallfont"> 类别*:</td>
<td height="25" colspan="2"><label>
<input name="leibie" type="text" id="leibie" />
</label></td>
</tr>
<tr>
<td height="25" align="center" valign="middle" class="bluesmallfont"> 图片:</td>
<td height="25" colspan="2"><label><img src="icon_prev.gif" alt="?????λ" name="showImg" id="showImg" onClick='javascript:alert("?????λ");'>
<input type="button" name="Submit" value="图片添加" onClick="window.open('fupload.asp?useForm=form1&prevImg=showImg&upUrl=uploadimages&ImgS=&ImgW=&ImgH=&reItem=rePic','fileUpload','width=400,height=180')">
<input name="rePic" type="hidden" id="rePic" size="4">
</label></td>
</tr>
<tr>
<td height="25" colspan="3"><label>
<input type="submit" name="Submit" value="添加 " />
</label> <label>
<input type="reset" name="Submit2" value="重填" />
</label>
<a href="Pages/manager.asp"> 返回</a></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -