Location: PHPKode > projects > Mummi (Multi-user MOD_MP3 Interface) > mummi.0.6/htroot/admin/dbviewer.php
<?
// Setting the title of the page
$GLOBALS[page_title] = "Database Viewer";

// Include files
include "common.php";
include "$GLOBALS[lib_path]/design.inc";

// 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='$result_array[user_name]' AND user_type='1'")) $nav_array = array(user_main, user_admin);
else $nav_array = array(user_main);


// Check to see which action was passed on which table then redirect when done
if($HTTP_GET_VARS[op]){
	switch($HTTP_GET_VARS[op]){
		case backup:
			// do the files
			while(list($keyf, $valf)=@each($fold[0])){
				$keyf = stripslashes(rawurldecode($keyf));
				$valf = stripslashes(rawurldecode($valf));
				$fold_tree = array(0=>array(),1=>array());
				$fold_tree[1][$keyf] = "$GLOBALS[audio_folder]/$GLOBALS[user_name]/$valf";
				//$lucifer = $this->walk_tree($fold_tree, mp3_to_sql);
				echo "backup val: $valf<br>";
			}
		break;

		case restore:
			while(list($key,$val) = @each($HTTP_GET_VARS[fold][0])){
				//exec("rm -R ".$ap->create_path($p_path, rawurldecode($val)));

			}
		break;


		case view:
			// This section will display contents on the selected table dependent on the options specified.



		break;
	}//eo switch
}else{





// Get the list of tables from the database.
$table_result_array = $os->list_tables();

// Get the number of entries for each table
$table_info_result_array = $os->get_table_info($table_result_array);


// Starting page..
$GLOBALS[contents01] = <<<ENDcontents01
	Below is a list of current tables available in the database <b>$GLOBALS[dbname]</b>.  Click table name to
	view its contents.<hr>
	<table width="100%" border="0" cellpadding="1" cellspacing="1"><tr bgcolor="#aaaaaa">
		<td align="left"><b>Table Name</b></td><td align="middle"><b>Entries</b></td><td align="middle"><b>Size</b></td>
	</tr>

	<form method="get" action="$PHP_SELF">

ENDcontents01;


// Set the counter to 0 for array counting.. used by $entries_result_array[]
$array_counter = 0;
// cycle through the array and set all the table fields
while(list($key_1 , $val_1) = each($table_result_array)){

	// array data will contain associative values of all variables in that array
	$array_data = $table_info_result_array[$array_counter];

	//create the multi-colored rows
	if(($clr & 1)==1) $bgc = "#cccccc";
	elseif(($clr & 1)!=1) $bgc = "#eeeeee";

	// Counter for the other arrays that diaply entries, status and such
	$counter++;

	// Starting the buffer of the table data
	$GLOBALS[contents01] .= "<tr bgcolor=\"$bgc\" align=\"left\">\n";
	$GLOBALS[contents01] .= "\t<td width=\"100%\"><input type=\"checkbox\" name=\"fold[0][$key_1]\" value=\"$val_1\"><a href=\"$GLOBALS[url_admin_path]/dbviewer.php?op=view&table=$val_1\">$val_1</td><td align=\"middle\">$array_data[Rows]</td><td align=\"right\">$array_data[Data_length]</td>";
	$GLOBALS[contents01] .= "</tr>";

	// add to the coloring
	$clr++;
	$array_counter++;
}// eo while

// Finishing the rest of the page buffer
$GLOBALS[contents01] .= <<<ENDcontents01
	</table>

	<hr>

	<input type="hidden" name="op" value="backup">
	<input type="hidden" name="table" value="$val_1">
	<input type="submit" value="Backup">

	</form>

ENDcontents01;

}//eo else no op




// an array for the draw_page function.
$contents = array("$GLOBALS[page_title]"=>"$GLOBALS[contents01]");
draw_header("$GLOBALS[page_title]");
draw_nav($nav_array);
draw_sect($contents);
draw_footer();



?>
Return current item: Mummi (Multi-user MOD_MP3 Interface)