Código PHP:
<?
if(! defined('BASEPATH') ){ exit('Unable to view file.'); }
$mesaj = '';
if(isset($_POST['submit'])){
$posts = $db->EscapeString($_POST['set']);
foreach ($posts as $key => $value){
if($site[$key] != $value){
if($key == 'hideref' || $key == 'target_system'){
$value = ($value > 2 ? 2 : ($value < 0 ? 0 : $value));
}elseif($key == 'mysql_random'){
$value = ($value > 1 ? 1 : ($value < 0 ? 0 : $value));
}elseif($key == 'report_limit'){
$value = ($value < 0 ? 0 : $value);
}
$db->Query("UPDATE `site_config` SET `config_value`='".$value."' WHERE `config_name`='".$key."'");
$site[$key] = $value;
}
}
$mesaj = '<div class="alert success"><span class="icon"></span><strong>Success!</strong> Settings successfully changed</div>';
}
if(isset($_POST['usubmit'])){
$posts = $db->EscapeString($_POST['set2']);
foreach ($posts as $key => $value){
if($site[$key] != $value){
if($key == 'transfer_fee'){
$value = ($value > 100 ? 100 : ($value < 0 ? 0 : $value));
}elseif($key == 'free_cpc' || $key == 'premium_cpc'){
$value = ($value < 2 ? 2 : $value);
}
$db->Query("UPDATE `site_config` SET `config_value`='".$value."' WHERE `config_name`='".$key."'");
$site[$key] = $value;
}
}
$mesaj = '<div class="alert success"><span class="icon"></span><strong>Success!</strong> Settings successfully changed</div>';
}
?>
<section id="content" class="container_12 clearfix"><?=$mesaj?>
<div class="grid_6">
<form action="" method="post" class="box">
<div class="header">
<h2>General Settings</h2>
</div>
<div class="content">
<div class="row">
<label><strong>Site Title</strong></label>
<div><input type="text" name="set[site_name]" value="<?=$site['site_name']?>" required /></div>
</div>
<div class="row">
<label><strong>Site Description</strong></label>
<div><textarea name="set[site_description]" required><?=$site['site_description']?></textarea></div>
</div>
<div class="row">
<label><strong>Site URL</strong><small>Without trailing slash</small></label>
<div><input type="text" name="set[site_url]" value="<?=$site['site_url']?>" required /></div>
</div>
<div class="row">
<label><strong>Contact Email</strong></label>
<div><input type="text" name="set[site_email]" value="<?=$site['site_email']?>" required /></div>
</div>
<div class="row">
<label><strong>Default Language</strong></label>
<div><select name="set[def_lang]"><?=$set_def_lang?></select></div>
</div>
<div class="row">
<label><strong>Theme</strong></label>
<div><select name="set[theme]"><?=$set_def_theme?></select></div>
</div>
<div class="row">
<label><strong>Maintenance Mode</strong></label>
<div><select name="set[maintenance]"><option value="0">Inactive</option><option value="1"<?=($site['maintenance'] != 0 ? ' selected' : '')?>>Active</option></select></div>
</div>
<div class="row">
<label><strong>Progress (%)</strong><small>Maintenance Progress</small></label>
<div><input type="text" name="set[m_progress]" value="<?=$site['m_progress']?>" required /></div>
</div>
<div class="row">
<label><strong>FB Fanpage Username</strong></label>
<div><input type="text" name="set[fb_fan_url]" value="<?=$site['fb_fan_url']?>" /></div>
</div>
<div class="row">
<label><strong>Twitter Username</strong></label>
<div><input type="text" name="set[m_twitter]" value="<?=$site['m_twitter']?>" /></div>
</div>
<div class="row">
<label><strong>Anonymous referring</strong></label>
<div><select name="set[hideref]"><option value="0">Disabled</option><option value="1"<?=($site['hideref'] == 1 ? ' selected' : '')?>>HideRef</option><option value="2"<?=($site['hideref'] == 2 ? ' selected' : '')?>>RevShare</option></select></div>
</div>
<div class="row">
<label><strong>RevShare API Key</strong><small><a href="http://rs.hideref.org/" target="_blank">Click here to get your API key</a></small></label>
<div><input type="text" name="set[revshare_api]" value="<?=$site['revshare_api']?>" placeholder="For RevShare anonymous"/></div>
</div>
<div class="row">
<label><strong>Targeting System</strong><small>Clicks based on Countries & Genders</small></label>
<div><select name="set[target_system]"><option value="0">Enabled</option><option value="2"<?=($site['target_system'] == 2 ? ' selected' : '')?>>Disabled</option><option value="1"<?=($site['target_system'] == 1 ? ' selected' : '')?>>VIP Only</option></select></div>
</div>
<div class="row">
<label><strong>Active Reports Limit</strong><small>Set 0 to disable</small></label>
<div><input type="text" name="set[report_limit]" value="<?=$site['report_limit']?>" required /></div>
</div>
<div class="row">
<label><strong>Randomize Module Results</strong><small>Will increase your server usage</small></label>
<div><select name="set[mysql_random]"><option value="0">Disabled</option><option value="1"<?=($site['mysql_random'] == 1 ? ' selected' : '')?>>Enabled</option></select></div>
</div>
</div>
<div class="actions">
<div class="right">
<input type="submit" value="Submit" name="submit" />
</div>
</div>
</form>
</div>