MemHT Portal is a Free PHP CMS and Blog that permit the creation
and the management online of websites with few and easy steps.
It's completelly customizable, expandable and suitable for all needs.
     Site demo
Viewed 922 times
Security

Filter always all ingoing and outgoing data from the database using the inCode and outCode functions. You cannot trust to anyone!

Outgoing data
code
$row = $dblink->get_row("SELECT value FROM table WHERE id=$id");
$name = outCode($row['value']);

Ingoing data
code
$var = inCode($_GET['value']);

Database communication

Do not use mysql_query, mysql_fetch_assoc and other dedicated functions to communicate with the database!

From the 2.5 version, using the bundled database class is the best solution to assure the database compatibility of your scripts in the future.

If you need to communicate with the database from external scripts use the following code to connect to the database:
code
require_once("inc/inc_config.php");
require_once("inc/inc_database.php");
$dblink = new database();
$dblink->connect();

// YOUR CODE GOES HERE

$dblink->disconnect();

Syntax:
code
//----------------------------------------------------------------
// GENERIC QUERY (Insert, Update, Delete...)
//----------------------------------------------------------------
//Original MySQL
mysql_query("UPDATE table SET value='$value' WHERE id='$id'");
//MemHT Portal class
$dblink->query("UPDATE table SET value='$value' WHERE id='$id'");

//----------------------------------------------------------------
// FETCH ROW
//----------------------------------------------------------------
//Original MySQL
$row = mysql_fetch_assoc(mysql_query("SELECT value FROM table WHERE id='$id'"));
name = $row['value'];
//MemHT Portal class
$row = $dblink->get_row("SELECT value FROM table WHERE id='$id'");
$name = $row['value'];

//----------------------------------------------------------------
// FETCH LIST
//----------------------------------------------------------------
//Original MySQL
$result = mysql_query("SELECT * FROM table ORDER BY id");
while ($row = mysql_fetch_assoc($result)) {
    echo $row['value'];
}
//MemHT Portal class
$result = $dblink->get_list("SELECT * FROM table ORDER BY id");
foreach ($result as $row) {
    echo $row['value'];
}

//----------------------------------------------------------------
// NUM ROWS
//----------------------------------------------------------------
//Original MySQL
$num = mysql_num_rows(mysql_query("SELECT * FROM table"));
//MemHT Portal class
$num = $dblink->get_num("SELECT * FROM table");

Do not forget to put global $dblink; in functions when using database connections and you want to use the existing connection

Example:
code
function example() {
    global $dblink;

    $row = $dblink->get_row("SELECT value FROM table WHERE id=12");
    //....
}
News Archive
Friends
Language
Quotes
"Hey for all! This system is excellent! I cant believe :D Thx so much"
Nicolyto77
Navigator
Tags Cloud
Search
Users Block
Hi Guest
IP: 38.103.63.18

Username
Password
New files
Recent news
Recent files
Recent comments
P mem: :)
P Docwyatt2001: I'm currently doing ..
P paulo89: lol ok no tiene prob..
P desa: jejej perdon pero co..
P doulis: what makes this down..
RSS Feeds
Disclaimer and Privacy Policy - NewsletterGoogle