Location: PHPKode > projects > Mummi (Multi-user MOD_MP3 Interface) > mummi.0.6/htroot/prefs.php
<?
//prefs.php


// Setting the title of the page
$GLOBALS[page_title] = "Account Prefrences";

// Include files
include "common.php";
include "$lib_path/design.inc";
include "$lib_path/user_db.inc";

$udb = new USER_DB;
$udb->connect("$GLOBALS[dbhost]","$GLOBALS[dbusername]","$GLOBALS[dbuserpassword]","$GLOBALS[dbname]");


// Set the user navbars.
if(!$HTTP_COOKIE_VARS[login_active]) $nav_array = array(main);
elseif($os->num_rows("SELECT user_name FROM users WHERE user_name='$session_array[user_name]' AND user_type='1'")) $nav_array = array_merge($GLOBALS[admin_navbox_array], $os->get_navbox_array($session_array[user_name]));
else $nav_array = array_merge($GLOBALS[basic_navbox_array], $os->get_navbox_array($session_array[user_name]));

// Need to build an array of available navboxes by reading the /nav directory and not using
// the default main ones like user_main, admin_main and such..  then figure out what to check by cycling the
// navarray and if a match hits, then use it. or something like that.





// Need to update the checkboxes for navbox display
while(list($key,$val) = @each($nav_array)){
	//echo "key=$key  | val=$val <br>";
	if($val == 'music_stats'){
		$music_checked = 'checked';
		//echo "key=$key  | val=$val <br>";
	}

	if($val == 'mummi_stats'){
		$mummi_checked = 'checked';
		//echo "key=$key  | val=$val <br>";
	}

	if($val == 'server_stats'){
		$server_checked = 'checked';
		//echo "key=$key  | val=$val <br>";
	}
}//eo WHILE

//$music_checked = 'unchecked';
//$mummi_checked = 'checked';
//$server_checked = 'unchecked';

// Update Navbox button clicked.. don't need to update the checkboxes here.. will do that
// when this page first loads using the function i'll make to return
$i=0;
if($HTTP_POST_VARS[update_navbox]){
			while(list($key,$val) = @each($HTTP_POST_VARS[nav])){
				//exec("rm -R ".$ap->create_path($p_path, rawurldecode($val)));
				//echo "key=$key  | val=$val <br>";
				//'$' + $key = $val;
				if($val == 'music_stats'){
					$music_checked = 'checked';
					//echo "key=$key  | val=$val <br>";
				}

				if($val == 'mummi_stats'){
					$mummi_checked = 'checked';
					//echo "key=$key  | val=$val <br>";
				}

				if($val == 'server_stats'){
					$server_checked = 'checked';
					//echo "key=$key  | val=$val <br>";
				}
			$navbox[$i] = $key;

			$i++;
			}
			echo serialize($navbox);




			//now update the user_prefrences table
			if(!$udb->update_navbox_array($session_array[user_name], $navbox));
			// refresh the page because the nav won't be displyed until the page view
			// after setting the option. since the nav hits first, then it's set,
			// then loaded again. kinda rought, but problem ONLY with THIS page.
			// all other pages are find and dandy :)
			header("Location: $GLOBALS[url_path]$PHP_SELF");

}//eo IF





$GLOBALS[contents00] = <<<ENDcontents00
	<font size="$GLOBALS[body_font_size]">

	Here is where you can customize things such which navboxes appear in the navigation area,
	how many entries per page you wish to see on returned information, ability to
	change your peronal information and much more...<hr><br>

	<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center"><tr>
		<td width="50%" align="left" valign="top">


			<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr>
				<td align="left" valign="top">

					<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr>
						<td bgcolor="#aaaaaa">&nbsp;<font COLOR="$GLOBALS[body_head_font_clr]">Navbox Selection</font></td>
					</tr></table>

					<table cellpadding="1" cellspacing="1" border="0"><tr>
						<td>
							Select which navboxes you wish to see in the navbar area<br>

							<form action="$PHP_SELF" method="post">
								<table cellpadding="1" cellspacing="1" border="0" width="100%"><tr>
									<td align="left" valign="top" width="50%">
										<input type="checkbox" name="nav[music_stats]" value="music_stats" $music_checked >Music Stats<br>
										<input type="checkbox" name="nav[mummi_stats]" value="mummi_stats" $mummi_checked >Mummi Stats<br>
										<input type="checkbox" name="nav[server_stats]" value="server_stats" $server_checked >Server Stats<br>
									</td></tr><tr><td align="left" valign="bottom">
										<br>
										&nbsp;<input type="submit" name="update_navbox" value="Update">
									</td>
								</tr></table>
							</form>
						</td>
					</tr></table>
				</td>
			</tr></table>
		</td><td width="50%" align="right" valign="top">
		</td>
	</tr></table>
	</font>

ENDcontents00;

$contents = array("$GLOBALS[page_title]"=>"$GLOBALS[contents00]");

draw_header("$GLOBALS[page_title]");
draw_nav($nav_array);
draw_sect($contents);
draw_footer();
ob_end_flush();
?>
Return current item: Mummi (Multi-user MOD_MP3 Interface)