?? softlist.asp
字號:
<!--#include file="config.asp"-->
<!--#include file="check.asp"-->
<!--#include file="../inc/ubbcode.asp"-->
<!--#include file="head.inc"-->
<%
Call InnerLocation("我發布的軟件")
Dim Action,SQL,Rs,i,softid
softid = Newasp.ChkNumeric(Request("softid"))
ChannelID = 2
Action = LCase(Request("action"))
Select Case Trim(Action)
Case "save"
Call SaveSoft
Case "edit"
Call EditSoft
Case "del"
Call DeleteSoft
Case "view"
Call SoftView
Case Else
Call showmain
End Select
If Founderr = True Then
Call Returnerr(ErrMsg)
End If
Sub showmain()
If Founderr = True Then Exit Sub
%>
<script language="JavaScript">
<!--
function myuser_softlist_top(accept){
//document.write ('<table cellspacing=1 align=center cellpadding=3 border=0 class=Usertableborder>');
document.write ('<th valign=middle>');
if (accept==1)
{
document.write ('我的軟件列表--已審核的軟件');
}else{
document.write ('我的軟件列表--未審核的軟件');
}
document.write ('</th>');
document.write ('<th valign=middle noWrap>審核</th>');
document.write ('<th valign=middle noWrap>發布日期</th>');
document.write ('<th valign=middle noWrap>管理操作</th>');
document.write ('</tr>');
}
function myuser_softlist_not(){
document.write ('<tr>');
document.write ('<td class=Usertablerow1 align=center valign=middle colspan=5>沒有找到任何軟件。</td>');
document.write ('</tr>');
}
function myuser_softlist_loop(channelid,softid,accept,softname,classname,softdate,hits,style){
var tablebody;
if (style==1)
{
tablebody="Usertablerow1";
}else{
tablebody="Usertablerow2";
}
document.write ('<tr>');
document.write ('<td class='+tablebody+' valign=middle>['+classname+'] ');
document.write ('<a href="softlist.asp?action=view&channelid='+channelid+'&softid='+softid+'">'+softname+'</a></td>');
document.write ('<td class='+tablebody+' align=center valign=middle>');
if (accept==1)
{
document.write ('<font color=blue>已審</font>');
}else{
document.write ('<font color=red>未審</font>');
}
document.write ('</td>');
document.write ('<td class='+tablebody+' align=center valign=middle>'+softdate+'</td>');
document.write ('<td class='+tablebody+' align=center valign=middle>');
document.write ('<a href="softlist.asp?action=edit&channelid='+channelid+'&softid='+softid+'">修改</a> | ');
document.write ('<a href="softlist.asp?action=del&channelid='+channelid+'&softid='+softid+'" onClick="return confirm(\'確定要刪除此軟件開發包嗎?\')">刪除</a>');
document.write ('</td>');
document.write ('</tr>');
}
-->
</script>
<table cellspacing=1 align=center cellpadding=3 border=0 class=Usertableborder>
<tr height=20 align=center>
<td class=Usertablerow2 colspan=5><a href="?ChannelID=<%=ChannelID%>&Accept=1">已審核的軟件</a> |
<a href="?ChannelID=<%=ChannelID%>">未審核的軟件</a> |
<a href="softpost.asp?ChannelID=<%=ChannelID%>">發布新的軟件</a> </td>
</tr>
<%
Dim CurrentPage,page_count,totalrec,Pcount,maxperpage
Dim isAccept,s
maxperpage = 20 '###每頁顯示數
If Trim(Request("Accept")) <> "" Then
isAccept = 1
Else
isAccept = 0
End If
CurrentPage = Request("page")
If CurrentPage = "" Or Not IsNumeric(CurrentPage) Then
CurrentPage = 1
Else
CurrentPage = CInt(CurrentPage)
End If
If CInt(CurrentPage) = 0 Then CurrentPage = 1
Response.Write "<script>myuser_softlist_top("& isAccept &")</script>" & vbNewLine
totalrec = Newasp.Execute("SELECT COUNT(SoftID) FROM NC_SoftList WHERE ChannelID = " & ChannelID & " And username='" & MemberName & "' And isAccept="& isAccept)(0)
Pcount = CInt(totalrec / maxperpage) '得到總頁數
If Pcount < totalrec / maxperpage Then Pcount = Pcount + 1
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > Pcount Then CurrentPage = Pcount
Set Rs = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT A.SoftID,A.SoftName,A.SoftVer,A.SoftTime,A.AllHits,A.isAccept,C.ClassName FROM [NC_SoftList] A INNER JOIN [NC_Classify] C on A.ClassID=C.ClassID WHERE A.ChannelID = " & ChannelID & " And A.username='" & MemberName & "' And isAccept="& isAccept &" ORDER BY A.isTop DESC, A.SoftTime DESC ,A.SoftID DESC" 'And username='" & MemberName & "'
If IsSqlDataBase = 1 Then
Set Rs = Newasp.Execute(SQL)
Else
Rs.Open SQL, Conn, 1, 1
End If
If Rs.EOF And Rs.BOF Then
Response.Write "<script>myuser_softlist_not()</script>" & vbNewLine
Else
If Pcount > 1 then Rs.Move (CurrentPage - 1) * maxperpage
page_count = 0
If Rs.EOf Then Exit Sub
SQL = Rs.GetRows(maxperpage)
For i=0 To Ubound(SQL,2)
If (i mod 2) = 0 Then
s = 2
Else
s = 1
End If
Response.Write VbCrLf
Response.Write "<script>myuser_softlist_loop("
Response.Write ChannelID
Response.Write ","
Response.Write SQL(0,i)
Response.Write ","
Response.Write SQL(5,i)
Response.Write ",'"
Response.Write EncodeJS(SQL(1,i) &" "& SQL(2,i))
Response.Write "','"
Response.Write EncodeJS(SQL(6,i))
Response.Write "','"
Response.Write FormatDated(SQL(3,i),4)
Response.Write "',"
Response.Write SQL(4,i)
Response.Write ","
Response.Write s
Response.Write ")</script>"
Response.Write VbCrLf
page_count = page_count + 1
Next
SQL=Null
End If
Rs.Close:Set Rs = Nothing
Response.Write "<tr align=right><td class=Usertablerow2 colspan=5>"
Response.Write ShowPages(CurrentPage,Pcount,totalrec,maxperpage,"&ChannelID="& ChannelID &"&Accept="& Request("Accept"))
Response.Write "</td></tr>" & vbNewLine
Response.Write "</table>"
End Sub
Sub DeleteSoft()
If CInt(GroupSetting(12)) = 0 Then
ErrMsg = ErrMsg + "<li>對不起!您沒有刪除軟件的權限,如需要該權限請聯系管理員。</li>"
Founderr = True
Exit Sub
End If
If Newasp.CheckPost=False Then
ErrMsg = ErrMsg + Postmsg
FoundErr = True
Exit Sub
End If
If softid = 0 Then
FoundErr = True
ErrMsg = ErrMsg + "<li>Sorry!您選擇了錯誤的系統參數。</li>"
Exit Sub
End If
SQL = "SELECT isAccept FROM NC_SoftList WHERE ChannelID=" & ChannelID & " And username='" & MemberName & "' And isAccept=0 And softid=" & CLng(softid)
Set Rs = Newasp.Execute(SQL)
If Rs.BOF And Rs.EOF Then
FoundErr = True
ErrMsg = ErrMsg + "<li>Sorry!此軟件已經通過審核,您沒有權限刪除,如有什么問題請聯系管理員。</li>"
Set Rs = Nothing
Exit Sub
Else
Newasp.Execute("DELETE FROM NC_SoftList WHERE ChannelID=" & ChannelID & " And username='" & MemberName & "' And isAccept=0 And softid=" & CLng(softid))
End If
Set Rs = Nothing
Response.Redirect Request.ServerVariables("HTTP_REFERER")
End Sub
Sub SaveSoft()
Dim TextContent,isAccept,ForbidEssay
If CInt(GroupSetting(12)) = 0 Then
ErrMsg = ErrMsg + "<li>對不起!您沒有修改軟件的權限,如需要該權限請聯系管理員。</li>"
Founderr = True
Exit Sub
End If
If Newasp.CheckPost=False Then
ErrMsg = ErrMsg + Postmsg
FoundErr = True
Exit Sub
End If
If CInt(GroupSetting(2)) = 1 Then
If Not Newasp.CodeIsTrue() Then
ErrMsg = ErrMsg + "<meta http-equiv=refresh content=""2;URL="&Request.ServerVariables("HTTP_REFERER")&"""><li>驗證碼校驗失敗,請返回刷新頁面再試。兩秒后自動返回</li>"
Founderr = True
Exit Sub
End If
Session("GetCode") = ""
End If
If softid = 0 Then
FoundErr = True
ErrMsg = ErrMsg + "<li>Sorry!您選擇了錯誤的系統參數。</li>"
Exit Sub
End If
If Trim(Request.Form("SoftName")) = "" Then
FoundErr = True
ErrMsg = ErrMsg + "<li>軟件名稱不能為空!</li>"
End If
If Len(Request.Form("SoftName")) => 200 Then
FoundErr = True
ErrMsg = ErrMsg + "<li>軟件名稱不能超過200個字符!</li>"
End If
If Len(Request.Form("Related")) => 200 Then
FoundErr = True
ErrMsg = ErrMsg + "<li>相關軟件不能超過200個字符!</li>"
End If
If Not IsNumeric(Request.Form("star")) Then
FoundErr = True
ErrMsg = ErrMsg + "<li>軟件星級不能為空。</li>"
End If
If Not IsNumeric(Request.Form("ClassID")) Then
FoundErr = True
ErrMsg = ErrMsg + "<li>該一級分類已經有下屬分類,不能添加軟件!</li>"
Exit Sub
End If
If CLng(Request.Form("ClassID")) = 0 Then
FoundErr = True
ErrMsg = ErrMsg + "<li>該分類是外部連接,不能添加軟件!</li>"
End If
If Trim(Request.Form("SoftType")) = "" Then
FoundErr = True
ErrMsg = ErrMsg + "<li>請選擇軟件類型!</li>"
End If
If Trim(Request.Form("impower")) = "" Then
FoundErr = True
ErrMsg = ErrMsg + "<li>請選擇軟件授權方式!</li>"
End If
If Trim(Request.Form("Languages")) = "" Then
FoundErr = True
ErrMsg = ErrMsg + "<li>請選擇軟件語言!</li>"
End If
If Trim(Request.Form("content1")) = "" Then
FoundErr = True
ErrMsg = ErrMsg + "<li>軟件簡介不能為空!</li>"
End If
TextContent = ""
For i = 1 To Request.Form("content1").Count
TextContent = TextContent & Request.Form("content1")(i)
Next
If Len(Request.Form("RunSystem")) = 0 Then
Founderr = True
ErrMsg = ErrMsg + "<li>運行環境不能為空!</li>"
End If
If Not IsNumeric(Request.Form("SoftSize")) Then
Founderr = True
ErrMsg = ErrMsg + "<li>軟件大小請輸入整數!</li>"
End If
ForbidEssay = Newasp.ChkNumeric(Request.Form("ForbidEssay"))
isAccept = Newasp.ChkNumeric(Request.Form("isAccept"))
If Founderr = True Then Exit Sub
On Error Resume Next
Call PreventRefresh '防刷新
Set Rs = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT * FROM NC_SoftList WHERE username='" & MemberName & "' And SoftID=" & CLng(softid)
Rs.Open SQL,Conn,1,3
'Rs("ChannelID") = ChannelID
Rs("ClassID") = Newasp.ChkNumeric(Request.Form("ClassID"))
Rs("SoftName") = Newasp.ChkFormStr(Request.Form("SoftName"))
Rs("SoftVer") = Newasp.ChkFormStr(Request.Form("SoftVer"))
Rs("Related") = Newasp.ChkFormStr(Request.Form("Related"))
Rs("Content") = Html2Ubb(TextContent)
Rs("Languages") = Newasp.ChkFormStr(Request.Form("Languages"))
Rs("SoftType") = Newasp.ChkFormStr(Request.Form("SoftType"))
Rs("RunSystem") = Newasp.ChkFormStr(Request.Form("RunSystem"))
Rs("impower") = Newasp.ChkFormStr(Request.Form("impower"))
If UCase(Request.Form("SizeUnit")) = "MB" Then
Rs("SoftSize") = Newasp.CheckNumeric(Request.Form("SoftSize") * 1024)
Else
Rs("SoftSize") = Newasp.CheckNumeric(Request.Form("SoftSize"))
End If
Rs("star") = Newasp.ChkNumeric(Request.Form("star"))
Rs("Homepage") = Newasp.ChkFormStr(Request.Form("Homepage"))
Rs("Contact") = Newasp.ChkFormStr(Request.Form("Contact"))
Rs("Author") = Newasp.ChkFormStr(Request.Form("Author"))
Rs("Regsite") = Newasp.ChkFormStr(Request.Form("Regsite"))
'Rs("username") = Trim(MemberName)
Rs("SoftPrice") = Newasp.CheckNumeric(Request.Form("SoftPrice"))
Rs("SoftImage") = Newasp.ChkFormStr(Request.Form("SoftImage"))
Rs("Decode") = Newasp.ChkFormStr(Request.Form("Decode"))
Rs("ForbidEssay") = ForbidEssay
Rs.update
softid = Rs("softid")
Rs.Close:Set Rs = Nothing
'---- 開始批量更新下載地址
Dim TempAddress,TempSiteName
Dim tempid,tempdownid
If Trim(Request.Form("DownAddress")) <> "" Then
For i = 1 To Request.Form("DownAddress").Count
TempAddress = Trim(Request.Form("DownAddress")(i))
TempSiteName = Trim(Request.Form("SiteName")(i))
tempdownid = Newasp.ChkNumeric(Request.Form("downid")(i))
tempid = Newasp.ChkNumeric(Request.Form("id")(i))
If Len(TempSiteName) = 0 Then TempSiteName = "立即下載"
If tempid > 0 Then
If LCase(TempAddress) <> "del" And Trim(TempAddress) <> "" Then
Conn.Execute ("UPDATE NC_DownAddress SET DownFileName='" & TempAddress & "',DownText='" & TempSiteName & "' WHERE softid=" & softid & " And id="& CLng(tempid))
End If
Else
If LCase(TempAddress) <> "del" And Trim(TempAddress) <> "" Then
AddDownAddress 0,softid,TempAddress,TempSiteName
End If
End If
Next
End If
'---- 批量更新下載地址完成
Call Returnsuc("<li>恭喜您!修改軟件成功。</li><li><a href=?action=view&ChannelID=" & ChannelID & "&SoftID=" & SoftID & ">點擊此處查看該軟件</a></li>")
End Sub
Function AddDownAddress(downid,softid,DownFileName,DownText)
If Len(DownText) = 0 Then DownText = "立即下載"
downid = Newasp.ChkNumeric(downid)
DownFileName = Server.HTMLEncode(DownFileName)
DownText = Server.HTMLEncode(DownText)
If Trim(DownFileName) <> "" Then
SQL = "INSERT INTO NC_DownAddress (ChannelID,softid,downid,DownFileName,DownText) VALUES (" & ChannelID & "," & softid & "," & downid & ",'" & Replace(DownFileName, "'", "") & "','" & Replace(DownText, "'", "") & "')"
Conn.Execute(SQL)
End If
End Function
Function EncodeJS(str)
str = Newasp.HtmlEncode(str)
str = Replace(Replace(Replace(Replace(str,"\","\\"),"'","\'"),VbCrLf,"\n"),Chr(13),"")
EnCodeJs = str
End Function
Private Sub SoftView()
If softid = 0 Then
FoundErr = True
ErrMsg = ErrMsg + "<li>Sorry!您選擇了錯誤的系統參數。</li>"
Exit Sub
End If
If ChannelID = 0 Then
FoundErr = True
ErrMsg = ErrMsg + "<li>請指定頻道。</li>"
Exit Sub
End If
SQL = "SELECT * FROM NC_SoftList WHERE ChannelID=" & ChannelID & " And username='" & MemberName & "' And softid=" & CLng(softid)
Set Rs = Newasp.Execute(SQL)
If Rs.BOF And Rs.EOF Then
FoundErr = True
ErrMsg = ErrMsg + "<li>沒有找到任何軟件。或者您選擇了錯誤的系統參數!</li>"
Exit Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -