tab_maillogs
in package
Class tab_maillogs
Represents a log entry in a database table.
Table of Contents
Properties
- $allowedcols : array<string|int, mixed>
- $db : db_master
- Represents a database connection.
Methods
- __construct() : void
- Class constructor.
- __destruct() : void
- Class destructor.
- all() : array<string|int, mixed>|bool
- Retrieves all records from the "logs_mail" table, ordered by the specified field in descending order.
- delete() : bool
- Deletes a record from the 'logs_db' table based on the given column and value.
- deleteall() : bool
- Deletes all records from the 'logs_db' table.
- get() : array<string|int, mixed>|bool
- Retrieves a record from the "logs_mail" table based on the specified column and value.
- getcount() : string|bool
- Retrieves the count of records from the "logs_db" table based on the specified value and column.
- insert() : bool
- Inserts a new record into the 'logs_db' table.
- update() : bool
- Updates a record in the "logs_mail" table.
Properties
$allowedcols
protected
array<string|int, mixed>
$allowedcols
= ['id', 'stamp', 'ip', 'mailid', 'message', 'debug']
List of allowed columns
$db
Represents a database connection.
protected
db_master
$db
Methods
__construct()
Class constructor.
public
__construct() : void
Initializes the object and sets the 'db' property to the global '$dbm' variable.
__destruct()
Class destructor.
public
__destruct() : void
Removes the 'db' property from the current object by unsetting it.
all()
Retrieves all records from the "logs_mail" table, ordered by the specified field in descending order.
public
all([string $sort = 'stamp' ]) : array<string|int, mixed>|bool
Parameters
- $sort : string = 'stamp'
-
(Optional) The field to sort the results by. Defaults to 'stamp'.
Return values
array<string|int, mixed>|bool —Returns an array of records if found, otherwise false.
delete()
Deletes a record from the 'logs_db' table based on the given column and value.
public
delete(string $val[, string $col = 'id' ]) : bool
If the record exists and is successfully deleted, it returns true. Otherwise, it returns false.
Parameters
- $val : string
-
The value to match in the column specified.
- $col : string = 'id'
-
The name of the column to search for the value. Default is 'id'.
Return values
bool —Returns true if the record is successfully deleted, false otherwise.
deleteall()
Deletes all records from the 'logs_db' table.
public
deleteall() : bool
Executes a DELETE query to remove all records from the 'logs' table in the database. Returns true if any records were successfully deleted, otherwise returns false.
Return values
bool —True if any records were deleted, false otherwise.
get()
Retrieves a record from the "logs_mail" table based on the specified column and value.
public
get(string $val[, string $col = 'id' ]) : array<string|int, mixed>|bool
Parameters
- $val : string
-
The value to search for in the specified column.
- $col : string = 'id'
-
(Optional) The column to search for the specified value. Defaults to 'id'.
Return values
array<string|int, mixed>|bool —Returns an array containing the record if found, otherwise false.
getcount()
Retrieves the count of records from the "logs_db" table based on the specified value and column.
public
getcount([string $val = '' ][, string $col = 'id' ]) : string|bool
Parameters
- $val : string = ''
-
(Optional) The value to match in the specified column. Defaults to an empty string, which retrieves the count of all records.
- $col : string = 'id'
-
(Optional) The column to search for the specified value. Defaults to 'id'.
Return values
string|bool —Returns the count of the records as a string if found, otherwise false.
insert()
Inserts a new record into the 'logs_db' table.
public
insert(string $mailid, string $message, string $debug) : bool
Parameters
- $mailid : string
- $message : string
-
The message to be inserted.
- $debug : string
Return values
bool —Returns true if the record is successfully inserted, false otherwise.
update()
Updates a record in the "logs_mail" table.
public
update(string $col, string $val, string $id, string $type) : bool
Parameters
- $col : string
-
The column name to update.
- $val : string
-
The new value for the specified column.
- $id : string
-
The ID or mail ID of the record to update.
- $type : string
-
The type of ID to use. '0' for ID, '1' for mail ID.
Return values
bool —Returns true if the update is successful, otherwise false.