KesionCMSV4.0 second-level domain name redirection handler for personal space

Source: Internet
Author: User
Tags servervariables

Copy codeThe Code is as follows: <! -- # Include file = "conn. asp" -->
<! -- # Include file = "KS_Cls/KS. PublicCls. asp" -->
<%
'================================================ ======
'Kesioncmsv4. 0 the second-level domain name of the personal space is transferred to the handler.
'================================================ ======
'*************************************** *************
'Software name: Kesion CMS 4.0
'Email: service@kesion.com. QQ: 111394,9537636
'Web: http://www.kesion.com http://www.kesion.cn
'Copyright (C) Kesion Network All Rights Reserved.
'*************************************** *************
Dim KSCls
Set KSCls = New SiteIndex
KSCls. Kesion ()
Set KSCls = Nothing

Class SiteIndex
Private KS
Private From, gourl, sdomain, title, username
Private Sub Class_Initialize ()
If (Not Response. IsClientConnected) Then
Response. Clear
Response. End
End If
Set KS = New PublicCls
End Sub
Private Sub Class_Terminate ()
Call CloseConn ()
Set KS = Nothing
End Sub
Public Sub Kesion ()
From = LCase (Request. ServerVariables ("HTTP_HOST "))
Sdomain = LCase (KS. SSetting (15 ))
Sdomain = Replace (sdomain, "http ://","")
Sdomain = Replace (sdomain ,"/","")

Dim domain1, domain2
Domain = LCase (from)
Domain = Replace (domain, "http ://","")
Domain = Replace (domain ,"/","")

If sdomain = domain and sdomain <> "" then
Title = KS. Setting (1) & "-personal space"
Gourl = "space/index. asp"
Else
Domain1 = Replace (Left (domain, InStr (domain ,".")),".","")
If Trim (domain1) = "" or domain1 = "www" Then Response. Redirect ("index. asp"): Response. End
Dim rs: set rs1_conn.exe cute ("select username, blogname from ks_blog where [domain] = '" & KS. R (domain1 )&"'")
If rs. eof and rs. bof then
Rs. close: set rs = nothing

'================================== Here, the second-level domain name redirection of non-personal spaces of other systems is defined, for example, Forum ================================
If instr (Request. ServerVariables ("SERVER_NAME"), "bbs.kesion.com")> 0 then
Response. redirect "bbs/index. asp"
Elseif instr (Request. ServerVariables ("SERVER_NAME"), "news.kesion.com")> 0 then
Response. redirect "news /"
Elseif instr (Request. ServerVariables ("SERVER_NAME"), "help.kesion.com")> 0 then
Response. redirect "help /"
Else
Response. redirect "index. asp"
End if
'================================================ ============================================

Exit sub
End if
Title = rs ("blogname ")
Domain1 = rs ("username ")
Rs. close: set rs = nothing

Domain2 = Right (domain, Len (domain)-InStr (domain ,"."))
Gourl = "space/space. asp? Username = "& domain1
End if

Response. Write ("Response. Write ("<meta http-equiv =" "Content-Type" "content =" "text/html; charset = gb2312" "/>") & vbcrlf
Response. Write ("<title>" & title & "</title>") & vbcrlf
Response. Write ("Response. Write ("Response. Write ("<frameset> <frame src =" & gourl & ""> </frameset> ")
End Sub
End Class
%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.