Location: PHPKode > projects > Internet Task Management System > itms_mysql_build_0111/myprefs.php
<?php

/*
 * ITMS ValleyData source file version 1.0 May 11, 2001
 *
 * Allows the user to edit his or her email preferences, password, and the days that user will recieve reminders
 *
 *
 * Internet Task Management System: An online system used for recording information about and assigning tasks and processes.
 * Copyright (C) 2001  ValleyData Programming Group
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * See file named "gpl.txt" included with source code or
 * visit http://www.gnu.org/copyleft/gpl.txt on the internet.
 */
$title="My Prefs";

include("header.php");

print("<IMG SRC=\"images/my_preferences.jpg\" WIDTH=\"400\" HEIGHT=\"41\" BORDER=\"0\" ALT=\"My Preferences\">");

$email = trim($email);

db_open();
db_use();

if(isset($general)) //if they are making a email and reminder preference change
{

	($html == "html") ? $html = 1 : $html = 0;
	$sun ? $remindS = 1 : $remindS = 0;
	$mon ? $remindM = 1 : $remindM = 0;
	$tue ? $remindT = 1 : $remindT = 0;
	$wed ? $remindW = 1 : $remindW = 0;
	$thr ? $remindR = 1 : $remindR = 0;
	$fri ? $remindF = 1 : $remindF = 0;
	$sat ? $remindA = 1 : $remindA = 0;

	$query = "UPDATE users SET email = '$email', ".
							  "html = '$html', ".
							  "remindS = '$remindS', ".
							  "remindM = '$remindM', ".
							  "remindT = '$remindT', ".
							  "remindW = '$remindW', ".
							  "remindR = '$remindR', ".
							  "remindF = '$remindF', ".
							  "remindA = '$remindA' ".
							  "WHERE uid = '$uid'";
	if(db_query($query)) //update the email and reminder preferences
	{
		message_box("Your preferences have been successfully changed");
	}
	//warn the user if they haven't checked any reminder days
	if($remindS == 0 && $remindM == 0 && $remindT == 0 && $remindR == 0 && $renindF == 0 && $remindA == 0)
	{
		message_box("You will not recieve email reminders from ITMS since no reminder days were checked", "warning");
	}
}

$query = "SELECT * FROM users WHERE uid = '$uid'";
$result = db_query($query); //get user's preferences info
$row = db_fetch_row($result);

db_close();

?>

<form METHOD=POST action="myprefs.php">
<table>
<tr>
<td>Email:</td>
<td><INPUT TYPE="text" NAME="email" VALUE="<?php print($row["email"]); ?>" size="49"></td>
</tr>
<tr>
<td><INPUT TYPE="radio" NAME="html" value="plain" <?php print($row["html"] ? "" : "checked"); ?>></td><td>Plain Text Email</td>
</tr>
<tr>
<td><INPUT TYPE="radio" NAME="html" value="html" <?php print($row["html"] ? "checked" : ""); ?>></td><td>HTML Email</td>
</tr>
<tr>
<td colspan="2">Days to get ToDo list reminders:</td>
</tr>
<tr>
<td><INPUT TYPE="checkbox" NAME="sun" <?php print($row["remindS"] ? "checked" : ""); ?>></td><td>Sunday</td>
</tr>
<tr>
<td><INPUT TYPE="checkbox" NAME="mon" <?php print($row["remindM"] ? "checked" : ""); ?>></td><td>Monday</td>
</tr>
<tr>
<td><INPUT TYPE="checkbox" NAME="tue" <?php print($row["remindT"] ? "checked" : ""); ?>></td><td>Tuesday</td>
</tr>
<tr>
<td><INPUT TYPE="checkbox" NAME="wed" <?php print($row["remindW"] ? "checked" : ""); ?>></td><td>Wednesday</td>
</tr>
<tr>
<td><INPUT TYPE="checkbox" NAME="thr" <?php print($row["remindR"] ? "checked" : ""); ?>></td><td>Thursday</td>
</tr>
<tr>
<td><INPUT TYPE="checkbox" NAME="fri" <?php print($row["remindF"] ? "checked" : ""); ?>></td><td>Friday</td>
</tr>
<tr>
<td><INPUT TYPE="checkbox" NAME="sat" <?php print($row["remindA"] ? "checked" : ""); ?>></td><td>Saturday</td>
</tr>
<tr>
<td colspan="2">
<INPUT TYPE="hidden" name="general" value="true">
<INPUT TYPE="submit" value="Update My Preferences">
<INPUT TYPE="button" value="Cancel" onClick="location='index.php'">
</td>
</tr>
<tr>
 <td>&nbsp;</td>
</tr>
</table>
</form>

<FORM METHOD=POST ACTION="myprefs.php">
<table>
<tr>
 <td>Change Password:</td>
</tr>
<tr>
<td>Old Password:</td>
<td><INPUT TYPE="password" NAME="oldpassword" size="10"></td>
</tr>
<tr>
<td>New Password:</td>
<td><INPUT TYPE="password" NAME="newpassword" size="10"></td>
</tr>
<tr>
<td>Confirm Password:</td>
<td><INPUT TYPE="password" NAME="newconfirm_password" size="10"></td>
</tr>
<tr>
<td colspan="2">
<INPUT TYPE="hidden" name="password_change" value="true">
<INPUT TYPE="submit" value="Save Password">
<INPUT TYPE="button" value="Cancel" onClick="location='index.php'">
</td>
</tr>
</table>
</form>
<?php include("footer.php"); ?>
Return current item: Internet Task Management System