function change_settings($_POST) { extract($_POST); $traddisc_check = getCSetting("SET_INV_TRADDISC"); db_connect(); if (!isset($traddisc_check) or strlen($traddisc_check) < 1) { #setting does not yet exist ... ad it :/ $add_sql = "INSERT INTO cubit.settings (constant,label,value,type,datatype,minlen,maxlen,div,readonly) VALUES ('SET_INV_TRADDISC','Include/Exclude Delivery Charge In Trade Discount','exclude','general','string','7','7','0','f');"; $run_add = db_exec($add_sql) or errDie("Unable to get settings information."); } else { #update the setting ... $upd_sql = "UPDATE settings SET value = '{$traddisc}' WHERE constant = 'SET_INV_TRADDISC'"; $run_upd = db_exec($upd_sql) or errDie("Unable to update setting information."); } return show_settings("<li class='err'>Settings Have Been Saved.</li><br>"); }
<?php session_start(); require_once '../config.php'; require_once '../database.php'; require_once '../ui.php'; show_header('../'); show_menu('../'); #Authentication: if (!isset($_SESSION['admin'])) { if (!isset($_POST['pwd'])) { include 'login.php'; } else { $user = list_users('admin'); print_r($user); print_r($_POST); if ($user['upassword'] == $_POST['pwd']) { $_SESSION['admin'] = 'yes'; print 'Access granted.'; } else { print 'Wrong password!'; } } } if (isset($_SESSION['admin'])) { $devices = list_secrets(); $settings = list_settings(); show_settings($settings); show_devices($devices); } include '../html_footer.html';
margin-right: auto; text-align: left; } .changed td { color: red; } </style> </head> <body> <div id="header"> <a href="http://www.simplemachines.org/" target="_blank"><img src="' . $smflogo . '" style="width: 250px; float: right;" alt="Simple Machines" border="0" /></a> <div>', $context['is_legacy'] ? $txt['smf11_repair_settings'] : $txt['smf_repair_settings'], '</div> </div> <div id="content">'; show_settings(); echo ' </div> </body> </html>'; function initialize_inputs() { global $smcFunc, $db_connection, $sourcedir, $db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_type, $context, $sources_exist, $sources_found_path; // Turn off magic quotes runtime and enable error reporting. @set_magic_quotes_runtime(0); error_reporting(E_ALL); if (ini_get('session.save_handler') == 'user') { ini_set('session.save_handler', 'files'); } @session_start(); if (function_exists('get_magic_quotes_gpc') && @get_magic_quotes_gpc() != 0) {