Here we will try to mention post by post what to change in your Lavalair script. I think it would be best to post only works with explanation to keep the topic cleaner as possible.
Remove all globals which are used more than three times and add it to core.php with per case checking.
Heres are a few:
Connecting to database:
Remove all globals which are used more than three times and add it to core.php with per case checking.
Heres are a few:
PHP Code:
$action = empty($_GET['action']) ? null : htmlentities($_GET['action'], ENT_QUOTES, 'UTF-8');
$sid = !empty($_GET['sid']) ? ((bool) preg_match('/^[a-z0-9]{32}$/iD', $_GET['sid']) !== false ? $_GET['sid'] : null) : null;
$page = empty($_GET['page']) ? null : (int) $_GET['page'];
$who = empty($_GET['who']) ? null : (int) $_GET['who'];
$fid = empty($_GET['fid']) ? null : (int) $_GET['fid'];
$tid = empty($_GET['tid']) ? null : (int) $_GET['tid'];
$pid = empty($_GET['pid']) ? null : (int) $_GET['pid'];
PHP Code:
function connectdb() {
global $dbname, $dbuser, $dbhost, $dbpass;
if ($dbcon === null)
$dbcon = mysql_connect($dbhost, $dbuser, $dbpass) or exit;
if ($dbsel === null && $dbcon !== null)
$dbsel = mysql_select_db($dbname, $dbcon) or exit;
if ($dbcon !== null && $dbsel !== null)
return true;
return false;
}
Comment