". __("Logout") . ""; $username = $_SESSION['username']; // Save the settings mysql_connect($sql['server'],$sql['username'],$sql['password']) or die (__("Unable to connect to MySQL server.")); mysql_select_db($sql['database']) or die (__("Unable to select requested database")); if (isset($_POST['update'])) { foreach ($confval as $dbparam) { $param = str_replace(" ", "+", $dbparam); unset($val2); if (isset($_POST[$param])) $val2 = $_POST[$param]; $val = ""; if ((isset($saparams[$dbparam]['mult']) && $saparams[$dbparam]['mult']) || $saparams[$dbparam]['type'] == "list") { if (isset($val2)) foreach ($val2 as $v) $val = $val . " " . $v; } elseif ($saparams[$dbparam]['type'] == "checkbox") { if (!isset($val2) || $val2 != 1) $val = "0"; else $val = "1"; } else { $val = $val2; } if (preg_match($saparams[$dbparam]['inputcheck'], $val)) { $query = "select count(*) from " . $sql['userpreftable'] . " where username='$username' and preference='$dbparam'"; $result = mysql_query($query); $row = mysql_fetch_row($result); if ($row[0] == 0) { $query = "insert into " . $sql['userpreftable'] . " set username='$username',preference='$dbparam',value='$val'"; } else { $query = "update " . $sql['userpreftable'] . " set value='$val' where username='$username' and preference='$dbparam'"; } mysql_query($query); } } } // Load the settings $query = "select preference, value from " . $sql['userpreftable'] . " where username = '$username'"; $result = mysql_query($query); while($row = mysql_fetch_row($result)) { $pname = $row[0]; $val = $row[1]; $saparams[$pname]['default'] = $val; } ?>
\n\n"; $trcounter++; } ?>
"; print $saparams[$param]['text'] . ""; switch ($saparams[$param]['type']) { case "select": if ($saparams[$param]['mult']) print ""; foreach ($saparams[$param]['values'] as $val => $desc) { if (strpos($saparams[$param]['default'],$val) > 0 || $saparams[$param]['default'] == $val) { print ""; } else { print ""; } } print ""; break; case "checkbox": if ($saparams[$param]['default'] == 1) { print ""; } else { print ""; } break; case "text": print ""; break; case "list": print ""; print "
"; $tmp = split(" ",$saparams[$param]['default']); print ""; print "
"; break; } print "
">


Morten Isaksen
1.16