Resource:Woltlab-Connector: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Resource page}} '''Current Version: 1.1.0''' This is a library, created by xthepr0mise, which allows you to connect to your forum software easily. It uses the MySQL-Plugin to ...")
 

Revision as of 15:34, 4 October 2012

Current Version: 1.1.0

This is a library, created by xthepr0mise, which allows you to connect to your forum software easily. It uses the MySQL-Plugin to connect to the database and includes a full log which documents nearly every (woltlab_)function called by the user.

Functions

woltlab_connect

Click to collapse [-]
Server

Syntax

bool woltlab_connect ( dbHost, dbUsername, dbPasswort, dbName ) 

Required Arguments

  • dbHost: The IP-Address of the database
  • dbUsername: The username of the database
  • dbPasswort: The password of the database
  • dbName: The name of the database

Returns

Returns true if it connected successfully else false

-- TODO

woltlab_disconnect

Click to collapse [-]
Server

Syntax

bool woltlab_disconnect ( )

Required Arguments

  • None

Returns

Returns true if it disconnected successfully else false

-- TODO

woltlab_checkPassword

Click to collapse [-]
Server

Syntax

bool woltlab_checkPassword ( username, password )

Required Arguments

  • username: The username of the player you want to check
  • password: The password he entered (encrypted)

Returns

Returns true if the password is right else false

-- TODO

woltlab_getUserID

Click to collapse [-]
Server

Syntax

int woltlab_getUserID ( username )

Required Arguments

  • username: The username of the player whose ID you want to get

Returns

Returns int ID or false if the user does not exist

-- TODO

woltlab_getBoardID

Click to collapse [-]
Server

Syntax

int woltlab_getBoardID ( title )

Required Arguments

  • title: The title of the board whose ID you want to get

Returns

Returns int ID or false if the board does not exist

-- TODO

woltlab_getBoardTitle

Click to collapse [-]
Server

Syntax

string woltlab_getBoardTitle ( id )

Required Arguments

  • id: The ID of the board whose title you want to get

Returns

Returns string title or false if the board does not exist

-- TODO

woltlab_addThread

Click to collapse [-]
Server

Syntax

bool woltlab_addThread ( username, boardID, prefix, head, description, [registered] )

Required Arguments

  • username: The username of the player which creates the thread
  • boardID: The ID of the board in which the thread should be created
  • prefix: The prefix of the thread
  • head: The title of the thread
  • description: The content of the thread

Optional Arguments

  • registered: A bool whether the user is registered in the forum or not

Returns

Returns true if the thread got created or false

-- TODO

woltlab_userExists

Click to collapse [-]
Server

Syntax

bool woltlab_userExists ( username )

Required Arguments

  • username: The username of the player you want to check

Returns

Returns true or false

-- TODO

woltlab_addUser

Click to collapse [-]
Server

Syntax

bool woltlab_addUser ( username, email, password )

Required Arguments

  • username: The username of the player you want to add
  • email: His e-mail address
  • password: His password (encrypted)

Returns

Returns true if the user got created or false

-- TODO

Usage

Option 1

exports.woltlab:FUNCTION ( PARAMETERS )

Option 2

exports:['woltlab']:FUNCTION ( PARAMETERS )

Examples

Simple password-checking

Click to collapse [-]
Server
exports.woltlab:woltlab_connect ( "127.0.0.1", "root", "", "wcf" )
local login = exports.woltlab:woltlab_checkPassword ( "xthepr0mise", "test" )
if login == true then
    outputChatBox("Your password is right!")
else
    outputChatBox("Your password is wrong!")
end
exports.woltlab:woltlab_disconnect()

Known Bugs

  • none