-1) {$slashType = "/";} else {$slashType = "\\";};
$shortURLStarts = explode($slashType,$_SERVER['DOCUMENT_ROOT']);
// Then clear item at the end if there is one, plus trailing slash
// We end up with the directory name of the server root
if ($shortURLStarts[count($shortURLStarts)-1]!="") {$trimArray=1;} else {$trimArray=2;}
$shortURLStarts = $shortURLStarts[count($shortURLStarts)-$trimArray];
// If we're due to show the settings screen
if ($accountPassword == "" && isset($_GET['settings'])) {
?>
ICE Coder - :: Settings
0) {
// If we're setting a password
if (isset($_POST['accountPassword'])) {
$password = generateHash($_POST['accountPassword']);
$settingsFile = 'lib/settings.php';
$settingsContents = file_get_contents($settingsFile);
// Replace our empty password with the one submitted by user
$settingsContents = str_replace('$accountPassword = "";','$accountPassword = "'.$password.'";',$settingsContents);
// Now update this file
$fh = fopen($settingsFile, 'w') or die("can't update settings file");
fwrite($fh, $settingsContents);
fclose($fh);
// Finally, load again as now this file has changed and auto login
header('Location: index.php?login='.$_POST['accountPassword']);
} else {
// We need to set the password
header('Location: lib/settings.php?settings=set');
}
}
}
?>