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

📄 groups.asp

📁 一个虚拟主机代理系统
💻 ASP
字号:
<%'=========================================
'ScriptMate User Manager Version 2.1
'Copyright 2001 (C) ScriptMate.Com
'Admin Module
'This module helps to add,edit and delete the groups
'For any help with modification to
'this file contact support@scriptmate.com
'=========================================%>

<script language="JAVASCRIPT">


	var errfound = false;

		function ValidLength(item, len) {
		   return (item.length >= len);
		}

		function error(elem, text) {
		   if (errfound) return;
		   window.alert(text);
		   elem.select();
		   elem.focus();
		   elem.style.backgroundColor=errorcolor;
		   errfound = true;
		}
		function Validate() {
		   errfound = false;
		   d=document.groups
		   if (!ValidLength(d.groups_groupname.value,1))error(d.groups_groupname,"Name of the Group should not be blank.");
		   return !errfound;
		}

</script>

<%Sub Groups()

	dim records,groupsar,i,groups_groupname,todo,id

	Response.Expires = 0

	smumadminheader("Groups Management")

	if not Application("smumdebugmode") then on error resume next
	
	if session("admin") = "" then Response.Redirect smumadminpage & "?action=login"
	
	action = request("action")
	todo = request("todo")
	
	if todo = "" then
	
		smumFormAction "<form action="""&smumadminpage&"?action=groups"" method=post name=groups language=""JAVASCRIPT"" onsubmit=""return Validate();"">"
		smumFormHiddenField "todo","add"
		smumFormOpenTable
		smumFormHeader "Add a Group"
		smumFormFields "Name of the Group","<input class=fieldbox type=text maxlength=255 size=30 name=groups_groupname>"
		smumFormButtons "<input class=fieldbox type=submit value=""Add Group"" name=submit>"
		smumFormCloseTable
		smumFormClose		

		smumquery = "select groups_id,groups_groupname from smum_groupstbl order by groups_id DESC"
		smumOpenrs smumquery,"smumrs",action
		
			if not smumrs.eof then
				records = true
				groupsar = smumrs.getrows
			else
				records = false
			end if	
			
		smumClosers(smumrs)
				
		if records then
			
			smumFormOpenTable%>

				<tr class=colorformheader>
					<td colspan=3><font class=textsize9><b>Existing Groups</b></font></td>
				</tr>
				<tr class=colorformfields>
					<td width=15% align=center><font class=textsize9><b>Group Id.</b></font></td>
					<td><font class=textsize9><b>Name of the Group</b></font></td>
					<td width=10% align=center><font class=textsize9><b>Options</b></font></td>
				</tr>
		
				<%for i = 0 to ubound(groupsar,2)
					Response.Write "<tr class=colorformfields>"
					Response.Write	"<td width=15% align=center><font class=textsize9>"&groupsar(0,i)&"</font></td>"
					Response.Write	"<td><font class=textsize9>"&groupsar(1,i)&"</font></td>"
					Response.Write	"<td width=10% align=center><font class=textsize9><a href="&smumadminpage&"?action=groups&todo=edit&id="&groupsar(0,i)&"><img src=""/smusermanager/images/edit.gif"" alt=""Edit this Group"" border=0></a> | <a href="&smumadminpage&"?action=groups&todo=delete&id="&groupsar(0,i)&"><img src=""/smusermanager/images/delete.gif"" alt=""Delete this Group"" border=0></a></font></td>"
					Response.Write	"</tr>"
				next
			
			smumFormCloseTable	

		end if
		
	elseif todo = "add" then
	
		groups_groupname = request("groups_groupname")
		
		if groups_groupname = "" then
			Response.Redirect smumadminpage&"?action=groups"
		else
			smumquery = "insert into smum_groupstbl (groups_groupname) values ('"&groups_groupname&"')"
			smumexecutequery smumquery,action
			
			Response.Redirect smumadminpage&"?action=groups"
		end if

	elseif todo = "delete" then

		id = request("id")
		
		if id = "" then
			Response.Redirect smumadminpage&"?action=groups"
		else

			smumquery = "select * from smum_groupstbl where groups_id = "& id
			smumOpenrs smumquery,"smumrs",action
			
				groups_groupname = smumrs("groups_groupname")

			smumClosers(smumrs)
			
			smumFormOpenTable
			smumFormHeader "Delete a Group"
			smumFormResponse "Do you really wish to delete <b>"&groups_groupname&"</b> group. Deleting it will delete all the Entries related to it ?"
			smumFormButtons "<input class=fieldbox type=button value=Yes onClick=""javascript:window.location=('"&smumadminpage&"?action=groups&todo=deleteyes&id="&id&"');"" name=button2>&nbsp;&nbsp;&nbsp;<input class=fieldbox type=button value=No onClick=""javascript:window.location=('"&smumadminpage&"?action=groups');"" name=button1>"
			smumFormCloseTable
			smumFormClose		

		end if

	elseif todo = "deleteyes" then
	
		id = request("id")
		
		if id = "" then
			Response.Redirect smumadminpage&"?action=groups"
		else
			smumquery = "delete from smum_usergroupstbl where usergroups_groupid = " & id
			smumexecutequery smumquery,action
			
			smumquery = "delete from smum_groupstbl where groups_id = " &id
			smumexecutequery smumquery,action
			
			Response.Redirect smumadminpage&"?action=groups"
		end if
	
	elseif todo = "edit" then
	
		id = request("id")
		
		if id = "" then
			Response.Redirect smumadminpage&"?action=groups"
		else	
			smumquery = "select * from smum_groupstbl where groups_id = "& id
			smumOpenrs smumquery,"smumrs",action
			
				groups_groupname = smumrs("groups_groupname")

			smumClosers(smumrs)
			
			smumFormAction "<form action="""&smumadminpage&"?action=groups"" method=post name=groups language=""JAVASCRIPT"" onsubmit=""return Validate();"">"
			smumFormHiddenField "todo","edityes"
			smumFormHiddenField "id",id
			smumFormOpenTable
			smumFormHeader "Edit a Group"
			smumFormFields "Name of the Group","<input class=fieldbox type=text maxlength=255 size=30 name=groups_groupname value="""&groups_groupname&""">"
			smumFormButtons "<input class=fieldbox type=submit value=""Update Group"" name=submit>"
			smumFormCloseTable
			smumFormClose		

		end if

	elseif todo = "edityes" then
	
		id = request("id")
		
		if id = "" then
			Response.Redirect smumadminpage&"?action=groups"
		else
			smumquery = "update smum_groupstbl set groups_groupname = '"&request("groups_groupname")&"' where groups_id = " &id
			smumexecutequery smumquery,action
			
			Response.Redirect smumadminpage&"?action=groups"
		end if
	
	end if

End Sub%>

⌨️ 快捷键说明

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