View Source: /source/prefs.php
Click here for the source, OR
Other files that you may wish to view the source of:
<?
if (isset($_POST['template'])){
setcookie("template",$_POST['template'],strtotime("+45 days"));
$_COOKIE['template']=$_POST['template'];
}
require_once "common.php";
page_header("Preferences");
checkday();
if ($session[user][alive]){
addnav("Return to the village","village.php");
}else{
addnav("Return to the news","news.php");
}
if (count($_POST)==0){
$form=array(
"Preferences,title"
,"emailonmail"=>"Send you an email when you get new Ye Olde Mail?,bool"
,"systemmail"=>"Include system generated messages (such as victorious when attacked)?,bool"
,"dirtyemail"=>"Leave Ye Olde Poste messages uncleaned (allow swear words in post to you)?,bool"
,"language"=>"Language (Not Yet Complete),enum,en,English,de,Deutsch,dk,Danish,es,Espaņol"
);
output("
<form action='prefs.php?op=save' method='POST'>",true);
if ($handle = opendir("templates")){
$skins = array();
while (false !== ($file = readdir($handle))){
if (strpos($file,".htm")>0){
array_push($skins,$file);
}
}
if (count($skins)==0){
output("`b`@Aww, your administrator has decided you're not allowed to have any skins. Complain to them, not me.");
}else{
output("<b>Skin:</b><br>",true);
while (list($key,$val)=each($skins)){
output("<input type='radio' name='template' value='$val'".($_COOKIE['template']==""&&$val=="yarbrough.htm" || $_COOKIE['template']==$val?" checked":"").">".substr($val,0,strpos($val,".htm"))."<br>",true);
}
}
}else{
output("`c`b`\$ERROR!!!`b`c`&Unable to open the templates folder! Please notify the administrator!!");
}
output("
New Password: <input name='pass1' type='password'> (leave blank if you don't want to change it)`n
Retype: <input name='pass2' type='password'>`n
Email address: <input name='email' value=\"".HTMLEntities($session[user][emailaddress])."\">`n
",true);
showform($form,$session[user][prefs]);
output("
</form>",true);
addnav("","prefs.php?op=save");
}else{
if ($_POST[pass1]!=$_POST[pass2]){
output("`#Your passwords do not match.`n");
}else{
if ($_POST[pass1]!=""){
if (strlen($_POST[pass1])>3){
$session[user][password]=$_POST[pass1];
output("`#Your password has been changed.`n");
}else{
output("`#Your password is too short. It must be at least 4 characters.`n");
}
}
}
reset($_POST);
$nonsettings = array("pass1"=>1,"pass2"=>1,"email"=>1);
while (list($key,$val)=each($_POST)){
if (!$nonsettings[$key]) $session[user][prefs][$key]=$_POST[$key];
}
if ($_POST[email]!=$session[user][emailaddress]){
if (is_email($_POST[email])){
if (getsetting("requirevalidemail",0)==1){
output("`#Your email cannot be changed, system settings prohibit it. (Emails may only be changed if the server allows more than one account per email). Use the Petition link to ask the server administrator to change your email address if this one is no longer valid.`n");
}else{
output("`#Your email address has been changed.`n");
$session[user][emailaddress]=$_POST[email];
}
}else{
if (getsetting("requireemail",0)==1){
output("`#That is not a valid email address.`n");
}else{
output("`#Your email address has been changed.`n");
$session[user][emailaddress]=$_POST[email];
}
}
}
output("Settings Saved");
}
page_footer();
?>