ASPPlayground.net Site Integration Package Readme

 ·  ASP Playground

This NEW SIP (Site Integration Package) for ASPPlayground.net Forum ASP.NET Editions is designed for those who want to display messages, member info, etc. outside the forum by retrieving information stored in the forum's database using simple COM like interface. The SIP also allows you to register, login, add/remove users from a group remotely (see below for full functionality).

This new SIP is designed for interacting with version 2.5 (ANSI & Unicode) of the Advanced Edition. This Site Integration Package will not work with forum version prior to 2.5.

There are 2 SIP files in the package (under the folder SIP):

  • SIPUnicode.vb: consists of 6 .NET Classes for version 2.5 Unicode
  • SIPANSI.vb: consists of 6 .NET Classes for version 2.5 ANSI
  • There are also two sets of examples in the package (under folder examples). Note: Examples below references the Unicode classes (SIPUnicode.vb)

  • RSS and Login examples (under folder RSS and Login)
  • SigmaChat Integration Script re-written using this SIP (under folder SigmaChat)
  • NOTE: In order to use the SIP, you must first upload and reference one of the two files (depending on your forum version) in your own ASPX File. You will also need some knowledge and experience with ASP.NET programming. Example usage is provided for each of the 6 Classes. At the top of your ASP.NET file, reference them this way:

    For 2.5 Unicode users:

    <%@ Assembly src="SIPUnicode.vb" %>
    <%@ Import Namespace="ASPPGDSIP"%>

    For 2.5 ANSI users:

    <%@ Assembly src="SIPANSI.vb" %>
    <%@ Import Namespace="ASPPGDSIP"%>

    6 SIP classes (identical for the two versions of 2.5, ANSI and Unicode):

  • PGDDatabase Class
    The main class that encapsulates the database connection and basic forum information. All other classes depends on this class to work
  • PGDLogin Class
    This is the class for external login
  • PGDRegistration Class
    This is the class for external registration
  • PGDSessions Class
    This is the class used to retrieve active sessions. This is only useful if you enable online user tracking
  • PGDMembers Class
    This is the class used to retrieve member list and basic group membership info.
  • PGDMessages Class
    This is the class used to retrieve message list and create RSS feeds (version 2.0)
  • PGDDatabase

  • Properties

    • dbUser as String (read/write)
      the login name for accessing the database
    • dbName as String (read/write)
      the database name of the forum database
    • dbPass as String (read/write)
      the password for accessing the database
    • dbServer as String (read/write)
      the server IP address or named pipe.
    • dbOwnerPrefix as String (read/write) ; Optional
      the owner of the stored procedure
    • IntegratedSecurity as Boolean (read/write) ; Optional
      indicates whether to use Integrated Security to connect to the database. Default is False.
    • datastore as String (read)
      the database connection string.
  • Properties

  • dbUser as String (read/write)
    the login name for accessing the database
  • dbName as String (read/write)
    the database name of the forum database
  • dbPass as String (read/write)
    the password for accessing the database
  • dbServer as String (read/write)
    the server IP address or named pipe.
  • dbOwnerPrefix as String (read/write) ; Optional
    the owner of the stored procedure
  • IntegratedSecurity as Boolean (read/write) ; Optional
    indicates whether to use Integrated Security to connect to the database. Default is False.
  • datastore as String (read)
    the database connection string.
  • Methods

    • function GetSiteinfo as Hashtable
      retrieves a hashtable that holds basic site configuration information.
  • Methods

  • function GetSiteinfo as Hashtable
    retrieves a hashtable that holds basic site configuration information.
  • Example Usage |

    Dim objDB as PGDDatabase, key as string, DictSiteInfo as hashtable

    objDB = new PGDDatabase
    objDB.dbUser = "sa"
    objDB.dbPass = "sapass"
    objDB.dbName = "aspplayground_forum_db"
    objDB.dbServer = "192.168.0.5"
    objDB.dbOwnerPrefix = "sa."

    Response.write ("<strong>Database Connection String <br></strong> " & objDB.datastore & "<br>")

    Response.write ("<br><strong>Forum Properties:</strong> <br>")

    DictSiteInfo = objDB.GetSiteInfo

    for each key in DictSiteInfo.keys
    response.write ("<font color=""#FF0000"">" & key & "</font>: " & DictSiteInfo.item(key) & "<br>")
    next

    objDB = nothing

  • Example Usage|

    Dim objDB as PGDDatabase, key as string, DictSiteInfo as hashtable

    objDB = new PGDDatabase
    objDB.dbUser = "sa"
    objDB.dbPass = "sapass"
    objDB.dbName = "aspplayground_forum_db"
    objDB.dbServer = "192.168.0.5"
    objDB.dbOwnerPrefix = "sa."

    Response.write ("<strong>Database Connection String <br></strong> " & objDB.datastore & "<br>")

    Response.write ("<br><strong>Forum Properties:</strong> <br>")

    DictSiteInfo = objDB.GetSiteInfo

    for each key in DictSiteInfo.keys
    response.write ("<font color=""#FF0000"">" & key & "</font>: " & DictSiteInfo.item(key) & "<br>")
    next

    objDB = nothing

    Dim objDB as PGDDatabase, key as string, DictSiteInfo as hashtable

    objDB = new PGDDatabase
    objDB.dbUser = "sa"
    objDB.dbPass = "sapass"
    objDB.dbName = "aspplayground_forum_db"
    objDB.dbServer = "192.168.0.5"
    objDB.dbOwnerPrefix = "sa."

    Response.write ("<strong>Database Connection String <br></strong> " & objDB.datastore & "<br>")

    Response.write ("<br><strong>Forum Properties:</strong> <br>")

    DictSiteInfo = objDB.GetSiteInfo

    for each key in DictSiteInfo.keys
    response.write ("<font color=""#FF0000"">" & key & "</font>: " & DictSiteInfo.item(key) & "<br>")
    next

    objDB = nothing

    PGDLogin

  • Properties

    • DatabaseObject as PGDDatabase (read/write)
      You must pass a valid PGDDatabase object into this property in order for this class to work.
    • Username as String (read/write)
      The user name
    • Password as String (read/write)
      User's password
    • saveCookie as Boolean (read/write); Optional
      whether to create Auto-Login cookies once the user is successfully logged in. Default is False.
    • fromCookie as Boolean (read/write); Optional
      whether the supplied username/password combination is retrieved from user's input (e.g. form post) or from user's Auto-Login cookie. Default is False.
    • generateSession as Boolean (read/write); Optional
      whether to create session state once the user is successfully logged in. Default is False.
    • memID as Integer (read)
      the user's member ID in the forum database. It can be retrieved after calling the SignIn method (see below). If it is retrieved before calling the SignIn method, the returned value will read from the user's session state. If the user does not have a valid session, the value will always be -1 (Guest).
  • Properties

  • DatabaseObject as PGDDatabase (read/write)
    You must pass a valid PGDDatabase object into this property in order for this class to work.
  • Username as String (read/write)
    The user name
  • Password as String (read/write)
    User's password
  • saveCookie as Boolean (read/write); Optional
    whether to create Auto-Login cookies once the user is successfully logged in. Default is False.
  • fromCookie as Boolean (read/write); Optional
    whether the supplied username/password combination is retrieved from user's input (e.g. form post) or from user's Auto-Login cookie. Default is False.
  • generateSession as Boolean (read/write); Optional
    whether to create session state once the user is successfully logged in. Default is False.
  • memID as Integer (read)
    the user's member ID in the forum database. It can be retrieved after calling the SignIn method (see below). If it is retrieved before calling the SignIn method, the returned value will read from the user's session state. If the user does not have a valid session, the value will always be -1 (Guest).
  • Methods

    • function SignIn() as Boolean
      the main function which takes Username and Password and generates cookies/session. This method returns True if user is logged in successfully, and False if not.
    • function isAdmin() as Boolean
      whether the current user has administrative privilege on the forum
    • function isGuest() as Boolean
      whether the current user is a Guest. The memID property above will return -1 if this method returns True.
    • function getLoginCookies() as String
      returns the Username portion of the Auto-Login cookie. It can be called before calling the SignIn method to retrieve existing Auto-Login cookie value.
    • function getPassCookies() as HexString
      returns the password portion of the Auto-Login cookie. It can be called before calling the SignIn method to retrieve existing Auto-Login cookie value.
    • sub SignOut()
      sign out a user by removing the auto-login cookie, session variable, and his record in the session table.
  • Methods

  • function SignIn() as Boolean
    the main function which takes Username and Password and generates cookies/session. This method returns True if user is logged in successfully, and False if not.
  • function isAdmin() as Boolean
    whether the current user has administrative privilege on the forum
  • function isGuest() as Boolean
    whether the current user is a Guest. The memID property above will return -1 if this method returns True.
  • function getLoginCookies() as String
    returns the Username portion of the Auto-Login cookie. It can be called before calling the SignIn method to retrieve existing Auto-Login cookie value.
  • function getPassCookies() as HexString
    returns the password portion of the Auto-Login cookie. It can be called before calling the SignIn method to retrieve existing Auto-Login cookie value.
  • sub SignOut()
    sign out a user by removing the auto-login cookie, session variable, and his record in the session table.
  • A sample code in addition to the following Example Usage is available in this package as well. Please refer to the file, login.aspx, in the package.
  • A sample code in addition to the following Example Usage is available in this package as well.Please refer to the file,login.aspx, in the package.
  • Example Usage |

    Dim objDB as PGDDatabase, objLogin as PGDLogin, success as Boolean

    objDB = new PGDDatabase
    objDB.dbUser = "sa"
    objDB.dbPass = "sapass"
    objDB.dbName = "aspplayground_forum_db"
    objDB.dbServer = "192.168.0.5"
    objDB.dbOwnerPrefix = "sa."

    objLogin = new PGDLogin
    objLogin.DatabaseObject = objDB

    objLogin.Username = "admin"
    objLogin.Password = "admin"
    objLogin.saveCookie = true
    objLogin.fromCookie = false
    objLogin.generateSession = true

    success = objLogin.signin()

    if success then
    response.write ("<br>MemID: ")
    response.write (objLogin.memID)
    response.write ("<br>Username: ")
    response.write (objLogin.username)
    response.write ("<br>isAdmin: ")
    response.write (objLogin.isAdmin)
    response.write ("<br>isGuest: ")
    response.write (objLogin.isGuest)
    response.write ("<br>Cookie, Login: ")
    response.write (objLogin.getLoginCookies)
    response.write ("<br>Cookie, Pass: ")
    response.write (objLogin.getPassCookies)
    else
    response.write("failed")
    end if

    objDB = nothing
    objLogin = nothing

  • Example Usage|

    Dim objDB as PGDDatabase, objLogin as PGDLogin, success as Boolean

    objDB = new PGDDatabase
    objDB.dbUser = "sa"
    objDB.dbPass = "sapass"
    objDB.dbName = "aspplayground_forum_db"
    objDB.dbServer = "192.168.0.5"
    objDB.dbOwnerPrefix = "sa."

    objLogin = new PGDLogin
    objLogin.DatabaseObject = objDB

    objLogin.Username = "admin"
    objLogin.Password = "admin"
    objLogin.saveCookie = true
    objLogin.fromCookie = false
    objLogin.generateSession = true

    success = objLogin.signin()

    if success then
    response.write ("<br>MemID: ")
    response.write (objLogin.memID)
    response.write ("<br>Username: ")
    response.write (objLogin.username)
    response.write ("<br>isAdmin: ")
    response.write (objLogin.isAdmin)
    response.write ("<br>isGuest: ")
    response.write (objLogin.isGuest)
    response.write ("<br>Cookie, Login: ")
    response.write (objLogin.getLoginCookies)
    response.write ("<br>Cookie, Pass: ")
    response.write (objLogin.getPassCookies)
    else
    response.write("failed")
    end if

    objDB = nothing
    objLogin = nothing

    Dim objDB as PGDDatabase, objLogin as PGDLogin, success as Boolean

    objDB = new PGDDatabase
    objDB.dbUser = "sa"
    objDB.dbPass = "sapass"
    objDB.dbName = "aspplayground_forum_db"
    objDB.dbServer = "192.168.0.5"
    objDB.dbOwnerPrefix = "sa."

    objLogin = new PGDLogin
    objLogin.DatabaseObject = objDB

    objLogin.Username = "admin"
    objLogin.Password = "admin"
    objLogin.saveCookie = true
    objLogin.fromCookie = false
    objLogin.generateSession = true

    success = objLogin.signin()

    if success then
    response.write ("<br>MemID: ")
    response.write (objLogin.memID)
    response.write ("<br>Username: ")
    response.write (objLogin.username)
    response.write ("<br>isAdmin: ")
    response.write (objLogin.isAdmin)
    response.write ("<br>isGuest: ")
    response.write (objLogin.isGuest)
    response.write ("<br>Cookie, Login: ")
    response.write (objLogin.getLoginCookies)
    response.write ("<br>Cookie, Pass: ")
    response.write (objLogin.getPassCookies)
    else
    response.write("failed")
    end if

    objDB = nothing
    objLogin = nothing

    PGDRegistration

  • Properties

    • DatabaseObject as PGDDatabase (read/write)
      You must pass a valid PGDDatabase object into this property in order for this class to work.
    • Username as String (write)
      The user name
    • Password as String (read/write)
      User's password
    • Email as String (read/write)
      User's Email address for registration
    • MemID as Long (read)
      User's member ID on the forum after successfully registered. Should be called after calling the Register method (see below).
    • ErrorCode as Int (read)
      If registration fails, the error code returned. Should be called after calling the Register method (see below).
    • ErrorMessage as String (read)
      If registration fails, the error message returned in English. Should be called after calling the Register method (see below).
  • Properties

  • DatabaseObject as PGDDatabase (read/write)
    You must pass a valid PGDDatabase object into this property in order for this class to work.
  • Username as String (write)
    The user name
  • Password as String (read/write)
    User's password
  • Email as String (read/write)
    User's Email address for registration
  • MemID as Long (read)
    User's member ID on the forum after successfully registered. Should be called after calling the Register method (see below).
  • ErrorCode as Int (read)
    If registration fails, the error code returned. Should be called after calling the Register method (see below).
  • ErrorMessage as String (read)
    If registration fails, the error message returned in English. Should be called after calling the Register method (see below).
  • Methods

    • function Register as Boolean
      the main function which takes Username, email, and Password and registers the user. This method returns True if user is registered in successfully, and False if not.
  • Methods

  • function Register as Boolean
    the main function which takes Username, email, and Password and registers the user. This method returns True if user is registered in successfully, and False if not.
  • Example Usage |

    Dim objDB as pgddatabase, objReg as pgdregistration, success as boolean

    objDB = new PGDDatabase
    objDB.dbUser = "sa"
    objDB.dbPass = "sapass"
    objDB.dbName = "aspplayground_forum_db"
    objDB.dbServer = "192.168.0.5"
    objDB.dbOwnerPrefix = "sa."

    objReg = new PGDRegistration
    objReg.DatabaseObject = objDB
    objReg.Username = "admin"
    objReg.Password = "admin"
    objReg.Email = "[email protected]"

    success = objReg.Register()

    if not success then
    response.write ("<br>Error Code: ")
    response.write (objReg.ErrorCode)
    response.write ("<br>Error Message: ")
    response.write (objReg.ErrorMessage)
    else
    response.write ("<br>New Member ID ")
    response.write (objReg.memID)
    end if

    objReg = nothing
    objDB = nothing

  • Example Usage|

    Dim objDB as pgddatabase, objReg as pgdregistration, success as boolean

    objDB = new PGDDatabase
    objDB.dbUser = "sa"
    objDB.dbPass = "sapass"
    objDB.dbName = "aspplayground_forum_db"
    objDB.dbServer = "192.168.0.5"
    objDB.dbOwnerPrefix = "sa."

    objReg = new PGDRegistration
    objReg.DatabaseObject = objDB
    objReg.Username = "admin"
    objReg.Password = "admin"
    objReg.Email = "[email protected]"

    success = objReg.Register()

    if not success then
    response.write ("<br>Error Code: ")
    response.write (objReg.ErrorCode)
    response.write ("<br>Error Message: ")
    response.write (objReg.ErrorMessage)
    else
    response.write ("<br>New Member ID ")
    response.write (objReg.memID)
    end if

    objReg = nothing
    objDB = nothing

    Dim objDB as pgddatabase, objReg as pgdregistration, success as boolean

    objDB = new PGDDatabase
    objDB.dbUser = "sa"
    objDB.dbPass = "sapass"
    objDB.dbName = "aspplayground_forum_db"
    objDB.dbServer = "192.168.0.5"
    objDB.dbOwnerPrefix = "sa."

    objReg = new PGDRegistration
    objReg.DatabaseObject = objDB
    objReg.Username = "admin"
    objReg.Password = "admin"
    objReg.Email = "[email protected]"

    success = objReg.Register()

    if not success then
    response.write ("<br>Error Code: ")
    response.write (objReg.ErrorCode)
    response.write ("<br>Error Message: ")
    response.write (objReg.ErrorMessage)
    else
    response.write ("<br>New Member ID ")
    response.write (objReg.memID)
    end if

    objReg = nothing
    objDB = nothing

    PGDSessions

  • Properties

    • DatabaseObject as PGDDatabase (read/write)
      You must pass a valid PGDDatabase object into this property in order for this class to work.
  • Properties

  • DatabaseObject as PGDDatabase (read/write)
    You must pass a valid PGDDatabase object into this property in order for this class to work.
  • Methods

    • function GetSessions as 2 dimensional array
      This function returns all users currently in the session table in a 2 dimensional array. The 2 dimensional array is produced by the Recordset.GetRows method. Make sure you check the returned data with the VBScript's isArray() function first.
    • sub DemoSessions
      This sub writes out all users currently in the session table. The string being written is produced by the Recordset.GetString method. This method is useful if you don't know what are returned by the GetSessions method above.
  • Methods

  • function GetSessions as 2 dimensional array
    This function returns all users currently in the session table in a 2 dimensional array. The 2 dimensional array is produced by the Recordset.GetRows method. Make sure you check the returned data with the VBScript's isArray() function first.
  • sub DemoSessions
    This sub writes out all users currently in the session table. The string being written is produced by the Recordset.GetString method. This method is useful if you don't know what are returned by the GetSessions method above.
  • Example Usage |

    Dim objDB as PGDDatabase, objSess as PGDSessions
    Dim allData as object
    Dim irow, iCol as Integer

    objDB = new PGDDatabase
    objDB.dbUser = "sa"
    objDB.dbPass = "sapass"
    objDB.dbName = "aspplayground_forum_db"
    objDB.dbServer = "192.168.0.5"
    objDB.dbOwnerPrefix = "sa."

    objSess = New PGDSessions
    objSess.DatabaseObject = objDB

    objSess.demoSessions()

    allData = objSess.GetSessions
    if isArray(allData) then
    response.write ("<table>")
    for irow = 0 to ubound(alldata,2)
    response.write ("<tr>")
    for iCol = 0 to ubound(allData,1)
    response.write ("<td>" & cStr(allData(icol,irow)) & "</td>")
    next
    response.write ("</tr>")
    next
    response.write ("</table>")
    end if

    objSess = nothing
    objDB = nothing

  • Example Usage|

    Dim objDB as PGDDatabase, objSess as PGDSessions
    Dim allData as object
    Dim irow, iCol as Integer

    objDB = new PGDDatabase
    objDB.dbUser = "sa"
    objDB.dbPass = "sapass"
    objDB.dbName = "aspplayground_forum_db"
    objDB.dbServer = "192.168.0.5"
    objDB.dbOwnerPrefix = "sa."

    objSess = New PGDSessions
    objSess.DatabaseObject = objDB

    objSess.demoSessions()

    allData = objSess.GetSessions
    if isArray(allData) then
    response.write ("<table>")
    for irow = 0 to ubound(alldata,2)
    response.write ("<tr>")
    for iCol = 0 to ubound(allData,1)
    response.write ("<td>" & cStr(allData(icol,irow)) & "</td>")
    next
    response.write ("</tr>")
    next
    response.write ("</table>")
    end if

    objSess = nothing
    objDB = nothing

    Dim objDB as PGDDatabase, objSess as PGDSessions
    Dim allData as object
    Dim irow, iCol as Integer

    objDB = new PGDDatabase
    objDB.dbUser = "sa"
    objDB.dbPass = "sapass"
    objDB.dbName = "aspplayground_forum_db"
    objDB.dbServer = "192.168.0.5"
    objDB.dbOwnerPrefix = "sa."

    objSess = New PGDSessions
    objSess.DatabaseObject = objDB

    objSess.demoSessions()

    allData = objSess.GetSessions
    if isArray(allData) then
    response.write ("<table>")
    for irow = 0 to ubound(alldata,2)
    response.write ("<tr>")
    for iCol = 0 to ubound(allData,1)
    response.write ("<td>" & cStr(allData(icol,irow)) & "</td>")
    next
    response.write ("</tr>")
    next
    response.write ("</table>")
    end if

    objSess = nothing
    objDB = nothing

    PGDMembers

  • Properties

    • DatabaseObject as PGDDatabase (read/write)
      You must pass a valid PGDDatabase object into this property in order for this class to work.
  • Properties

  • DatabaseObject as PGDDatabase (read/write)
    You must pass a valid PGDDatabase object into this property in order for this class to work.
  • Methods

    • function GetMembers (top as int, mode as int , order as int) as 2 dimensional array and sub DemoMembers (top as int, mode as int , order as int)
      This function GetMembers returns users based on supplied arguments in a 2 dimensional array. The 2 dimensional array is produced by the Recordset.GetRows method. Make sure you check the returned data with the VBScript's isArray() function first.

      This sub DemoMembers writes out all users based on supplied arguments. The string being written is produced by the Recordset.GetString method. This method is useful if you don't know what are returned by the GetMembers method above.

      Arguments
      • top
        how many records to return.
      • mode
        2 different modes are supported
        • 1: return users sorted based on number of posts
        • 0: return users sorted based on date of registration
      • order
        complement the argument mode above
        • 0: Ascending
        • 1: Descending
    • function GetModerators (forumid as int) as 2 dimensional array and sub DemoModerators (forumid as int)
      This function GetModerators returns moderators based on the supplied forumid in a 2 dimensional array. The 2 dimensional array is produced by the Recordset.GetRows method. Make sure you check the returned data with the VBScript's isArray() function first.

      This sub DemoModerators writes out moderators based on supplied arguments. The string being written is produced by the Recordset.GetString method. This method is useful if you don't know what are returned by the GetModerators method above.

      Arguments
      • forumid
        the ID of the forum which the moderators you want to display belongs to. If set to 0, the funciton returns all moderators of all forums.
    • function isAdmin (memID as int) as Boolean
      check whether a member has administrative privilege or not.

      Arguments
      • memid
        the ID of the member
    • function isModerator (memID as int) as Boolean
      check whether a member is a moderator.

      Arguments
      • memid
        the ID of the member
    • function isGroupMember (GID as int, memID as int) as Boolean
      check whether a member belongs to a user group.

      Arguments
      • GID
        the ID of the user group
      • memid
        the ID of the member
    • sub addUserToGroup (GID as int, memID as int)
      add a member to a user group

      Arguments
      • GID
        the ID of the user group
      • memid
        the ID of the member
    • sub removeUserFromGroup (GID as int, memID as int)
      remove a member from a user group

      Arguments
      • GID
        the ID of the user group
      • memid
        the ID of the member
    • sub UpdatePM
      The forum caches Private members and Moderators in the forum table. If you use the method addUserToGroup or removeUserFromGroup, make sure you call this method to update the cache.
  • Methods

  • function GetMembers (top as int, mode as int , order as int) as 2 dimensional array and sub DemoMembers (top as int, mode as int , order as int)
    This function GetMembers returns users based on supplied arguments in a 2 dimensional array. The 2 dimensional array is produced by the Recordset.GetRows method. Make sure you check the returned data with the VBScript's isArray() function first.

    This sub DemoMembers writes out all users based on supplied arguments. The string being written is produced by the Recordset.GetString method. This method is useful if you don't know what are returned by the GetMembers method above.

    Arguments
    • top
      how many records to return.
    • mode
      2 different modes are supported
      • 1: return users sorted based on number of posts
      • 0: return users sorted based on date of registration
    • order
      complement the argument mode above
      • 0: Ascending
      • 1: Descending
  • top
    how many records to return.
  • mode
    2 different modes are supported
    • 1: return users sorted based on number of posts
    • 0: return users sorted based on date of registration
  • 1: return users sorted based on number of posts
  • 0: return users sorted based on date of registration
  • order
    complement the argument mode above
    • 0: Ascending
    • 1: Descending
  • 0: Ascending
  • 1: Descending
  • function GetModerators (forumid as int) as 2 dimensional array and sub DemoModerators (forumid as int)
    This function GetModerators returns moderators based on the supplied forumid in a 2 dimensional array. The 2 dimensional array is produced by the Recordset.GetRows method. Make sure you check the returned data with the VBScript's isArray() function first.

    This sub DemoModerators writes out moderators based on supplied arguments. The string being written is produced by the Recordset.GetString method. This method is useful if you don't know what are returned by the GetModerators method above.

    Arguments
    • forumid
      the ID of the forum which the moderators you want to display belongs to. If set to 0, the funciton returns all moderators of all forums.
  • forumid
    the ID of the forum which the moderators you want to display belongs to. If set to 0, the funciton returns all moderators of all forums.
  • function isAdmin (memID as int) as Boolean
    check whether a member has administrative privilege or not.

    Arguments
    • memid
      the ID of the member
  • memid
    the ID of the member
  • function isModerator (memID as int) as Boolean
    check whether a member is a moderator.

    Arguments
    • memid
      the ID of the member
  • memid
    the ID of the member
  • function isGroupMember (GID as int, memID as int) as Boolean
    check whether a member belongs to a user group.

    Arguments
    • GID
      the ID of the user group
    • memid
      the ID of the member
  • GID
    the ID of the user group
  • memid
    the ID of the member
  • sub addUserToGroup (GID as int, memID as int)
    add a member to a user group

    Arguments
    • GID
      the ID of the user group
    • memid
      the ID of the member
  • GID
    the ID of the user group
  • memid
    the ID of the member
  • sub removeUserFromGroup (GID as int, memID as int)
    remove a member from a user group

    Arguments
    • GID
      the ID of the user group
    • memid
      the ID of the member
  • GID
    the ID of the user group
  • memid
    the ID of the member
  • sub UpdatePM
    The forum caches Private members and Moderators in the forum table. If you use the method addUserToGroup or removeUserFromGroup, make sure you call this method to update the cache.
  • Example Usage |

    Dim objDB as PGDDatabase, objMem as PGDMembers, allData as object
    Dim irow, iCol as Integer

    objDB.dbUser = "sa"
    objDB.dbPass = "sapass"
    objDB.dbName = "aspplayground_forum_db"
    objDB.dbServer = "192.168.0.5"
    objDB.dbOwnerPrefix = "sa."

    objMem = New PGDMembers
    objMem.DatabaseObject = objDB

    objMem.DemoMembers(20, 1, 0)

    allData = objMem.GetMembers(20, 1, 0)

    if isArray(allData) then
    response.write ("<table>")
    for irow = 0 to ubound(alldata,2)
    response.write ("<tr>")
    for iCol = 0 to ubound(allData,1)
    response.write ("<td>" & allData(icol,irow) & "</td>")
    next
    response.write ("</tr>")
    next
    response.write ("</table>")
    end if

    objMem.DemoModerators(0)

    allData = objMem.GetModerators(0)

    if isArray(allData) then
    response.write ("<table>")
    for irow = 0 to ubound(alldata,2)
    response.write ("<tr>")
    for iCol = 0 to ubound(allData,1)
    response.write ("<td>" & allData(icol,irow) & "</td>")
    next
    response.write ("</tr>")
    next
    response.write ("</table>")
    end if

    response.write ("<br>IsAdmin: ")
    response.write (objMem.isAdmin(0))
    response.write ("<br>IsModerator: ")
    response.write (objMem.isModerator(2))
    response.write ("<br>IsGroupMember: ")
    response.write (objMem.IsGroupMember(11,6))

    response.write ("<br>Remove User from group: ")
    objMem.removeUserFromGroup(11,6)
    response.write ("<br>Is GroupMember: ")
    response.write (objMem.IsGroupMember(11,6))
    response.write ("<br>Add user back to group: ")
    objMem.addUserToGroup(11,6)
    response.write ("<br>Is GroupMember: ")
    response.write (objMem.IsGroupMember(11,6))
    objMem.updatePM()
    objMem = nothing
    objDB = nothing

  • Example Usage|

    Dim objDB as PGDDatabase, objMem as PGDMembers, allData as object
    Dim irow, iCol as Integer

    objDB.dbUser = "sa"
    objDB.dbPass = "sapass"
    objDB.dbName = "aspplayground_forum_db"
    objDB.dbServer = "192.168.0.5"
    objDB.dbOwnerPrefix = "sa."

    objMem = New PGDMembers
    objMem.DatabaseObject = objDB

    objMem.DemoMembers(20, 1, 0)

    allData = objMem.GetMembers(20, 1, 0)

    if isArray(allData) then
    response.write ("<table>")
    for irow = 0 to ubound(alldata,2)
    response.write ("<tr>")
    for iCol = 0 to ubound(allData,1)
    response.write ("<td>" & allData(icol,irow) & "</td>")
    next
    response.write ("</tr>")
    next
    response.write ("</table>")
    end if

    objMem.DemoModerators(0)

    allData = objMem.GetModerators(0)

    if isArray(allData) then
    response.write ("<table>")
    for irow = 0 to ubound(alldata,2)
    response.write ("<tr>")
    for iCol = 0 to ubound(allData,1)
    response.write ("<td>" & allData(icol,irow) & "</td>")
    next
    response.write ("</tr>")
    next
    response.write ("</table>")
    end if

    response.write ("<br>IsAdmin: ")
    response.write (objMem.isAdmin(0))
    response.write ("<br>IsModerator: ")
    response.write (objMem.isModerator(2))
    response.write ("<br>IsGroupMember: ")
    response.write (objMem.IsGroupMember(11,6))

    response.write ("<br>Remove User from group: ")
    objMem.removeUserFromGroup(11,6)
    response.write ("<br>Is GroupMember: ")
    response.write (objMem.IsGroupMember(11,6))
    response.write ("<br>Add user back to group: ")
    objMem.addUserToGroup(11,6)
    response.write ("<br>Is GroupMember: ")
    response.write (objMem.IsGroupMember(11,6))
    objMem.updatePM()
    objMem = nothing
    objDB = nothing

    Dim objDB as PGDDatabase, objMem as PGDMembers, allData as object
    Dim irow, iCol as Integer

    objDB.dbUser = "sa"
    objDB.dbPass = "sapass"
    objDB.dbName = "aspplayground_forum_db"
    objDB.dbServer = "192.168.0.5"
    objDB.dbOwnerPrefix = "sa."

    objMem = New PGDMembers
    objMem.DatabaseObject = objDB

    objMem.DemoMembers(20, 1, 0)

    allData = objMem.GetMembers(20, 1, 0)

    if isArray(allData) then
    response.write ("<table>")
    for irow = 0 to ubound(alldata,2)
    response.write ("<tr>")
    for iCol = 0 to ubound(allData,1)
    response.write ("<td>" & allData(icol,irow) & "</td>")
    next
    response.write ("</tr>")
    next
    response.write ("</table>")
    end if

    objMem.DemoModerators(0)

    allData = objMem.GetModerators(0)

    if isArray(allData) then
    response.write ("<table>")
    for irow = 0 to ubound(alldata,2)
    response.write ("<tr>")
    for iCol = 0 to ubound(allData,1)
    response.write ("<td>" & allData(icol,irow) & "</td>")
    next
    response.write ("</tr>")
    next
    response.write ("</table>")
    end if

    response.write ("<br>IsAdmin: ")
    response.write (objMem.isAdmin(0))
    response.write ("<br>IsModerator: ")
    response.write (objMem.isModerator(2))
    response.write ("<br>IsGroupMember: ")
    response.write (objMem.IsGroupMember(11,6))

    response.write ("<br>Remove User from group: ")
    objMem.removeUserFromGroup(11,6)
    response.write ("<br>Is GroupMember: ")
    response.write (objMem.IsGroupMember(11,6))
    response.write ("<br>Add user back to group: ")
    objMem.addUserToGroup(11,6)
    response.write ("<br>Is GroupMember: ")
    response.write (objMem.IsGroupMember(11,6))
    objMem.updatePM()
    objMem = nothing
    objDB = nothing

    PGDMessages

  • Properties

    • DatabaseObject as PGDDatabase (read/write)
      You must pass a valid PGDDatabase object into this property in order for this class to work.
    • isPinned as Boolean (write); Optional
      whether to show sticky threads only. Default is False.
    • isFAQ as Boolean (write) ; Optional
      whether to show FAQ threads only. Default is False.
    • isPoll as Boolean (write); Optional
      whether to show polls only. Default is False.
    • threadOnly as Boolean (write); Optional
      whether to show topics only. Default is True.
    • timefilter as int (write); Optional
      the number in day. If you want to display messages from last 10 days, set it to 10. Default is 30.
    • forumid as comma-delimited String (write); Optional
      the id of the forum from which to display message. e.g. "1" or "1,2,3". Default is "ALL".
    • top as int (write); Optional
      the number of message to retrieve. Default is 10.
    • orderBy as int (write); Optional
      the criteria you want to sort message list by. Accepts one of the following 3 values: 0 (by message date), 1 (by number of views), 2 (by number of replies). Default is 0.
    • orderDir as int (write); Optional
      the direction you want to sort the message list by; complements the orderBy property above. Acceptable value are either 1 (descending) or 0 (ascending). Default is 1.
    • bypassContextCheck as Boolean (write); Optional
      whether to check security context before displaying the message. Default is True (don't check). For example, if you specify "ALL" as the value of the forumid property, but you want to make sure that members should only see messages they are supposed to see, set this property to False and specify the value of the memID property (see below)
    • memID as int (write); Optional
      ID of a member. Default is 0 (administrator). You can programmatically derive the member ID using the PGDLogin class's memID property.
  • Properties

  • DatabaseObject as PGDDatabase (read/write)
    You must pass a valid PGDDatabase object into this property in order for this class to work.
  • isPinned as Boolean (write); Optional
    whether to show sticky threads only. Default is False.
  • isFAQ as Boolean (write) ; Optional
    whether to show FAQ threads only. Default is False.
  • isPoll as Boolean (write); Optional
    whether to show polls only. Default is False.
  • threadOnly as Boolean (write); Optional
    whether to show topics only. Default is True.
  • timefilter as int (write); Optional
    the number in day. If you want to display messages from last 10 days, set it to 10. Default is 30.
  • forumid as comma-delimited String (write); Optional
    the id of the forum from which to display message. e.g. "1" or "1,2,3". Default is "ALL".
  • top as int (write); Optional
    the number of message to retrieve. Default is 10.
  • orderBy as int (write); Optional
    the criteria you want to sort message list by. Accepts one of the following 3 values: 0 (by message date), 1 (by number of views), 2 (by number of replies). Default is 0.
  • orderDir as int (write); Optional
    the direction you want to sort the message list by; complements the orderBy property above. Acceptable value are either 1 (descending) or 0 (ascending). Default is 1.
  • bypassContextCheck as Boolean (write); Optional
    whether to check security context before displaying the message. Default is True (don't check). For example, if you specify "ALL" as the value of the forumid property, but you want to make sure that members should only see messages they are supposed to see, set this property to False and specify the value of the memID property (see below)
  • memID as int (write); Optional
    ID of a member. Default is 0 (administrator). You can programmatically derive the member ID using the PGDLogin class's memID property.
  • Methods

    • function GetMessages as 2 dimensional array
      This function returns messages based on the arguments you specified using the properties above in a 2 dimensional array. The 2 dimensional array is produced by the Recordset.GetRows method. Make sure you check the returned data with the VBScript's isArray() function first.
    • sub DemoMessages
      This sub writes out messages based on the arguments you specified using the properties. The string being written is produced by the Recordset.GetString method. This method is useful if you don't know what are returned by the GetMessages method above.
    • sub GetRSS (Desc as string , Lang as string , ttl as int) ?
      This sub writes out messages in RSS 2.0 format. Remember, when this method is called, it will clear everything in the Response buffer.

      Arguments
      • Desc
        Phrase or sentence describing the channel. Required for the <description> element.
      • Lang
        The language the channel is written in. Required for the <language> element.
      • ttl
        ttl stands for time to live. It's a number of minutes that indicates how long a channel can be cached before refreshing from the source.
  • Methods

  • function GetMessages as 2 dimensional array
    This function returns messages based on the arguments you specified using the properties above in a 2 dimensional array. The 2 dimensional array is produced by the Recordset.GetRows method. Make sure you check the returned data with the VBScript's isArray() function first.
  • sub DemoMessages
    This sub writes out messages based on the arguments you specified using the properties. The string being written is produced by the Recordset.GetString method. This method is useful if you don't know what are returned by the GetMessages method above.
  • sub GetRSS (Desc as string , Lang as string , ttl as int) ?
    This sub writes out messages in RSS 2.0 format. Remember, when this method is called, it will clear everything in the Response buffer.

    Arguments
    • Desc
      Phrase or sentence describing the channel. Required for the <description> element.
    • Lang
      The language the channel is written in. Required for the <language> element.
    • ttl
      ttl stands for time to live. It's a number of minutes that indicates how long a channel can be cached before refreshing from the source.
  • Desc
    Phrase or sentence describing the channel. Required for the <description> element.
  • Lang
    The language the channel is written in. Required for the <language> element.
  • ttl
    ttl stands for time to live. It's a number of minutes that indicates how long a channel can be cached before refreshing from the source.
  • A sample code for generating RSS feed in addition to the following Example Usage is available in this package as well. Please refer to the file, RSS.aspx, in the package.
  • A sample code for generating RSS feed in addition to the following Example Usage is available in this package as well.Please refer to the file,RSS.aspx, in the package.
  • Example Usage |

    Dim objDB as PGDDatabase, objMessage as PGDMessages, allData as object
    Dim irow, iCol as Integer

    objDB = new PGDDatabase
    objDB.dbUser = "sa"
    objDB.dbPass = "sapass"
    objDB.dbName = "aspplayground_forum_db"
    objDB.dbServer = "192.168.0.5"
    objDB.dbOwnerPrefix = "sa."

    objMessage = New PGDMessages
    objMessage.DatabaseObject = objDB
    objMessage.memID = 0
    objMessage.forumid = "16,3,41"
    objMessage.timefilter = 1000
    objMessage.byassContextCheck = false

    objMessage.DemoMessages

    allData = objMessage.GetMessages

    if isArray(allData) then
    response.write ("<table border= 1>")
    for irow = 0 to ubound(alldata,2)
    response.write ("<tr>")
    for iCol = 0 to ubound(allData,1)
    response.write ("<td>"&allData(icol,irow)&"</td>")
    next
    response.write ("</tr>")
    next
    response.write ("</table>")
    end if

    ' uncomment the following line to write RSS feed.
    'call objMessage.GetRss("Testing this RSS feature","en-us",60)

    objMessage = nothing
    objDB = nothing

  • Example Usage|

    Dim objDB as PGDDatabase, objMessage as PGDMessages, allData as object
    Dim irow, iCol as Integer

    objDB = new PGDDatabase
    objDB.dbUser = "sa"
    objDB.dbPass = "sapass"
    objDB.dbName = "aspplayground_forum_db"
    objDB.dbServer = "192.168.0.5"
    objDB.dbOwnerPrefix = "sa."

    objMessage = New PGDMessages
    objMessage.DatabaseObject = objDB
    objMessage.memID = 0
    objMessage.forumid = "16,3,41"
    objMessage.timefilter = 1000
    objMessage.byassContextCheck = false

    objMessage.DemoMessages

    allData = objMessage.GetMessages

    if isArray(allData) then
    response.write ("<table border= 1>")
    for irow = 0 to ubound(alldata,2)
    response.write ("<tr>")
    for iCol = 0 to ubound(allData,1)
    response.write ("<td>"&allData(icol,irow)&"</td>")
    next
    response.write ("</tr>")
    next
    response.write ("</table>")
    end if

    ' uncomment the following line to write RSS feed.
    'call objMessage.GetRss("Testing this RSS feature","en-us",60)

    objMessage = nothing
    objDB = nothing

    Dim objDB as PGDDatabase, objMessage as PGDMessages, allData as object
    Dim irow, iCol as Integer

    objDB = new PGDDatabase
    objDB.dbUser = "sa"
    objDB.dbPass = "sapass"
    objDB.dbName = "aspplayground_forum_db"
    objDB.dbServer = "192.168.0.5"
    objDB.dbOwnerPrefix = "sa."

    objMessage = New PGDMessages
    objMessage.DatabaseObject = objDB
    objMessage.memID = 0
    objMessage.forumid = "16,3,41"
    objMessage.timefilter = 1000
    objMessage.byassContextCheck = false

    objMessage.DemoMessages

    allData = objMessage.GetMessages

    if isArray(allData) then
    response.write ("<table border= 1>")
    for irow = 0 to ubound(alldata,2)
    response.write ("<tr>")
    for iCol = 0 to ubound(allData,1)
    response.write ("<td>"&allData(icol,irow)&"</td>")
    next
    response.write ("</tr>")
    next
    response.write ("</table>")
    end if

    ' uncomment the following line to write RSS feed.
    'call objMessage.GetRss("Testing this RSS feature","en-us",60)

    objMessage = nothing
    objDB = nothing