DialPHP PHP Examples
PHP client examples for the DialPHP Major BBS v10 module. Demonstrates TCP authentication, user queries, and account management.
DialPHP is a TCP/IP authentication and user-management module for The Major BBS v10. It listens on a configurable port and accepts connections from external scripts, allowing PHP web applications to query and modify BBS user accounts in real time.
Each connection authenticates with a shared secret, issues one command, receives a response, then disconnects. The examples below demonstrate all supported commands.
Before using these examples, edit config.php with your BBS server address and secret. The shared secret must match the value configured in the DialPHP module options on the BBS.
| Command | Parameters | Returns |
|---|---|---|
| User Verification | ||
| USERIDEXISTS | userid | YES or NO |
| AUTHUSER | userid%%password | Password is correct / Password is incorrect / No such user |
| HASMASTER | userid | YES or NO |
| ISSUSPENDED | userid | YES or NO |
| USERONLINE | userid | YES or NO |
| User Information | ||
| PRIMARYCLASS | userid | Primary class name string |
| CURRENTCLASS | userid | Current class name string |
| NUMBEROFCREDITS | userid | Credit balance as integer string |
| NUMBEROFDAYS | userid | Days remaining (0 for non-expiring classes) |
| LASTLOGIN | userid | Date in MM/DD/YYYY format |
| CREATIONDATE | userid | Date in MM/DD/YYYY format |
| Key Management | ||
| HASKEY | keyname userid | YES or NO |
| GIVEKEY | keyname userid | Key given |
| TAKEKEY | keyname userid | Key taken |
| Credits & Days | ||
| GIVECREDITS | amount userid | Ok — use negative amount to subtract |
| GIVEDAYS | days userid | Ok — use negative days to subtract; only affects expiring classes |
| Class Management | ||
| SWITCHCLASS | classname userid | Ok — user must already be a member of the target class |
| Account Actions | ||
| SUSPENDUSER | userid | Ok |
| UNSUSPENDUSER | userid | Ok |
| DELETEUSER | userid | Ok |
| UNDELETEUSER | userid | Ok |
| Advanced | ||
| UPDATEUSERFIELD | fieldname userid%%newvalue | Ok — updates a specific field in the user record |
| AUDITMESSAGE | message text | Ok — posts a message to the BBS audit trail |
| SYSTEMVARIABLE | varnum | Variable value — see variable index below |
| Variable # | Description |
|---|---|
| 1 | Total downloads |
| 2 | Total uploads |
| 3 | Total messages posted |
| 5 | Total user accounts |
| 6 | Female accounts |
| 7 | Male accounts |
| 10 | Paid credits posted |
| 11 | Free credits posted |
| 12 | Total calls to date |
| 13 | Users currently online |
One command per connection. The BBS closes the TCP connection after every response. Each call to DialPHP::query() opens a fresh connection.
%% separator. AUTHUSER and UPDATEUSERFIELD use %% (double percent) to separate compound parameters rather than spaces, because userids, passwords, and field values may contain spaces.
Case insensitive. Command verbs and user IDs are case-insensitive. Passwords for AUTHUSER are case-sensitive.
Message terminator. The BBS appends two ASCII 245 bytes (0xF5 0xF5) to every outbound message to mark end-of-transmission.