It’s not a home made script. And not full open source. Add on to it, this a plug and play “module”. A chat room setup, written in js, jq, and php. The main source actually is the one which changes out the mysql_real_escape.
Originating function
[php]function escape($text)
{
return mysqli_real_escape_string($this->connection_id, $text);
}
[/php]
Combined with the foreach()
[php]if(isset($_POST[‘submit’])) {
foreach($_POST[‘set’] as $name => $value) {
$db->query(“UPDATE settings SET conf_value = '”.mysql_real_escape_string($value)."’ WHERE conf_name = ‘".$name."’");
}
$set=array();
$settq=$db->query(“SELECT * FROM settings”);
while($r=$db->fetch_row($settq)) {
$set[$r[‘conf_name’]]=$r[‘conf_value’];
}
$saved = true;
}[/php]
I’ve never used PDO. I considered it as a good alternative awhile ago (while I was trying to learn this system AND php) but did not seem like a good idea to change an entire scripts database structure when I could barely read the php I was learning at the moment. lol.
I actually have 2 forms of error handlers on this. One debug and one to email me when/if an error occurs.
Problem is, I do not understand the foreach(). I’ve learned it is a loop, such as while(), but could not tell you the difference. But rather than instructions on foreach(), I get details on other functions
Even if I were to change it, I would need to know something about foreach() to know what I’m suppose to be recoding. But nada.