<?
include "header.php";
$results = "";

if(isset($_POST[task]) AND $_POST[task] == "save") {
mysql_query("UPDATE ims SET 
prefs_listby='$_POST[prefs_listby]',
prefs_images_per_page='$_POST[prefs_images_per_page]',
prefs_newwin='$_POST[prefs_newwin]'
WHERE u_id = '$user_info[u_id]'");

header("Location: prefs.php?s=1");
exit;
}

if(isset($_GET['s'])) { if($_GET['s'] == 1) { $results = "&nbsp;&nbsp;Your changes have been saved."; }}

echo $header;

echo "
<table cellpadding='0' cellspacing='0'>
<tr>
<td valign='top'>
<b>Account Settings</b><br>
Use this page to review or adjust your account settings. <br>
Note: These settings will also affect your Photo Album, if you have one.<br>
"; if($admin_info[photo_album] == "yes") { echo "Note: These settings will also effect your Photo Album."; } echo "
</td>
</tr>
</table>

<br>

<table width='520' cellpadding='0' cellspacing='0' style='border: 1px solid #AAAAAA; background: #FFFFFF; margin-bottom: 10px;'>
<form action='prefs.php' method='POST'>
<tr><td style='padding: 5px; padding-bottom: 0px;'>Open a new window when viewing images?</td></tr>
<tr>
<td style='padding: 3px; padding-top: 2px;'>
  <table cellpadding='0' cellspacing='0'>
  <td><input type='radio' name='prefs_newwin' value='yes'"; if($user_info[prefs_newwin] == "yes") { echo " CHECKED"; } echo "></td><td valign='top'><b>Yes</b>&nbsp;&nbsp;&nbsp;</td>
  <td><input type='radio' name='prefs_newwin' value='no'"; if($user_info[prefs_newwin] == "no") { echo " CHECKED"; } echo "></td><td valign='top'><b>No</b></td>
  </tr></table>
</td>
</tr></table>

<table width='520' cellpadding='0' cellspacing='0' style='border: 1px solid #AAAAAA; background: #FFFFFF; margin-bottom: 10px;'>
<tr><td style='padding: 5px; padding-bottom: 0px;'>When viewing folders, list images:</td></tr>
<tr>
<td style='padding: 3px; padding-top: 2px;'>
  <table cellpadding='0' cellspacing='0'>
  <td><input type='radio' name='prefs_listby' value='alpha'"; if($user_info[prefs_listby] == "alpha") { echo " CHECKED"; } echo "></td><td valign='top'><b>Alphabetically</b>&nbsp;&nbsp;&nbsp;</td>
  <td><input type='radio' name='prefs_listby' value='newest'"; if($user_info[prefs_listby] == "newest") { echo " CHECKED"; } echo "></td><td valign='top'><b>Newest First</b>&nbsp;&nbsp;&nbsp;</td>
  <td><input type='radio' name='prefs_listby' value='oldest'"; if($user_info[prefs_listby] == "oldest") { echo " CHECKED"; } echo "></td><td valign='top'><b>Oldest First</b></td>
  </tr></table>
</td>
</tr></table>

<table width='520' cellpadding='0' cellspacing='0' style='border: 1px solid #AAAAAA; background: #FFFFFF; margin-bottom: 9px;'>
<tr><td style='padding: 5px; padding-bottom: 0px;'>When viewing folders, how many images should appear on each page?</td></tr>
<tr>
<td style='padding: 3px; padding-top: 2px;'>
  <table cellpadding='0' cellspacing='0'>
  <td><input type='radio' name='prefs_images_per_page' value='5'"; if($user_info[prefs_images_per_page] == "5") { echo " CHECKED"; } echo "></td><td valign='top'><b>5</b>&nbsp;&nbsp;&nbsp;</td>
  <td><input type='radio' name='prefs_images_per_page' value='10'"; if($user_info[prefs_images_per_page] == "10") { echo " CHECKED"; } echo "></td><td valign='top'><b>10</b>&nbsp;&nbsp;&nbsp;</td>
  <td><input type='radio' name='prefs_images_per_page' value='25'"; if($user_info[prefs_images_per_page] == "25") { echo " CHECKED"; } echo "></td><td valign='top'><b>25</b>&nbsp;&nbsp;&nbsp;</td>
  <td><input type='radio' name='prefs_images_per_page' value='50'"; if($user_info[prefs_images_per_page] == "50") { echo " CHECKED"; } echo "></td><td valign='top'><b>50</b>&nbsp;&nbsp;&nbsp;</td>
  <td><input type='radio' name='prefs_images_per_page' value='100'"; if($user_info[prefs_images_per_page] == "100") { echo " CHECKED"; } echo "></td><td valign='top'><b>100</b></td>
  </tr></table>
</td>
</tr></table>

<table cellpadding='0' cellspacing='0'>
<tr><td>
<input type='submit' class='button' value='Save Changes'"; if($admin_info[demo_feature] == "on" & $user_info[email] == "$admin_info[demo_email]") { echo " DISABLED"; } echo "> <b>$results</b>
<input type='hidden' class='button' name='task' value='save'>
</td>
</tr>
</form>
</table>
";


echo $footer;
?>