require('inc/db.inc.php');
	
	
	
	$query_string = "SELECT * FROM diyhomepage WHERE customer_id = '$customer_id' ";
	$result = mysql_db_query("$dbName",$query_string);
		while($row = mysql_fetch_object($result)) { 
				$title = $row->title;
				$title_font = $row->title_font;
				$page_description = $row->description;
				$keywords = $row->keywords;
				$bgcolor = $row->bgcolor;
				$sidebgcolor = $row->sidebgcolor;
				$topbanner = $row->topbanner;
				$copyright_name = $row->copyright_name;
				$content_font = $row->content_font;
				$image_path = $row->image_path;
		}
	
	
	if(empty($bgcolor)) $bgcolor = 'ffffff';
	if(empty($sidebgcolor)) $sidebgcolor = 'ccccff';
	
	
	if($action == 'REMOVE'){
	
		// validate user and password
		$go = "no";
		
		$query_string = "SELECT customer_id FROM customer WHERE customer_id = '$customer_id' AND password = '$password' ";
		$result = mysql_db_query("$dbName",$query_string);
	
			while($row = mysql_fetch_object($result)) { 
				$go = "yes";
			}
			
		if($go == 'yes'){
	
			$query = "DELETE FROM diygallery WHERE customer_id = '$customer_id' AND unique_id = '$unique_id' ";
			$result = mysql_db_query("$dbName",$query);
	
			$action_message = "Image Removed from Collection  Image is still uploaded however
";
		
	
		} else {
		
			$action_message = "Error: Username or Password not recognized.  Image NOT modified
";
		
		}
			
	
	} // end action is REMOVE
	
	
	if($action == 'MODIFY'){
	
		// validate user and password
		$go = "no";
		
		$query_string = "SELECT customer_id FROM customer WHERE customer_id = '$customer_id' AND password = '$password' ";
		$result = mysql_db_query("$dbName",$query_string);
	
			while($row = mysql_fetch_object($result)) { 
				$go = "yes";
			}
			
		if($go == 'yes'){
				if(!empty($collection_alt)) $collection = $collection_alt;
				if(empty($collection)) $collection = date("m-d-Y");
				
				$caption = str_replace('\'', '', $caption);
				$caption = str_replace('\"', '', $caption);
	
				$collection = str_replace('\'', '', $collection);
				$collection = str_replace('\"', '', $collection);
				$collection = str_replace('\&', ' ', $collection);
	
				$technical_details = str_replace('\'', '', $technical_details);
				$technical_details = str_replace('\"', '', $technical_details);
				$technical_details = str_replace('\&', ' ', $technical_details);
	
				$photographer = str_replace('\'', '', $photographer);
				$photographer = str_replace('\"', '', $photographer);
				$photographer = str_replace('\&', ' ', $photographer);
				
				$description = str_replace('\'', '', $description);
				$description = str_replace('\"', '', $description);
				$description = str_replace('\&', ' ', $description);
	
				//$ip = getenv("REMOTE_HOST");
				// should creation and ip be updated? used as last modified
				
				$query = "UPDATE diygallery SET
							collection = '$collection',
							caption = '$caption',
							description = '$description',
							technical_details = '$technical_details',
							photographer = '$photographer',
							date = '$date'
						WHERE customer_id = '$customer_id' AND unique_id = '$unique_id' ";
	
				$result = mysql_db_query("$dbName",$query);
				
			$action_message = "Image modified
";	
		} else {
		
			$action_message = "Error: Username or Password not recognized.  Image NOT modified
";
		
		}
			
	
	} // end action is MODIFY
PRINT "
| "; if($customer_id != '' AND $password != ''){ PRINT " (".$customer_id." Logged In) Manage Gallery Logout"; if(empty($action_message)) $action_message = $customer_id." you can modify picture details below."; } else { PRINT "Login / Manage Gallery"; } PRINT " | ||||||||||||||||||||||
| 
					 | 
				
			||||||||||||||||||||||
| 
				
				 Available Collections 
				";
	
					$query_string = "SELECT distinct collection, count(collection) as count 
								FROM diygallery 
								WHERE customer_id = '$customer_id' AND collection != ''
								GROUP BY collection"; 
								
					$result = mysql_db_query("$dbName",$query_string);
			
						while($row = mysql_fetch_object($result)) { 
			
							$collection_space = str_replace(' ', '+', $row->collection);
							
							if($customer_id != '' AND $password != ''){
								PRINT " ";
							} else {
								PRINT " ";
							}
							
							
						}
	
	
				PRINT 
				" ";
				
						if($customer_id != '' AND $password != ''){
							PRINT "".$customer_id." Homepage ";
							PRINT "ALL GALLERIES";
						} else {
							PRINT "".$customer_id." Homepage ";
							PRINT "ALL GALLERIES";
						}
				
						
						
					PRINT "
					 
  | 
		
			
			
				 ".$title." "; if($customer_id != '' AND $password != ''){ $query_string = "SELECT collection FROM diygallery WHERE customer_id = '$customer_id' ORDER BY collection"; $result = mysql_db_query("$dbName",$query_string); while($row = mysql_fetch_object($result)) { $collection_count[$row->collection]++; $collections_exist = "yes"; } if(!empty($collections_exist)){ $select_collection = " OR "; } } PRINT " ".$action_message." 
 
 All Rights Reserved  | 
		|||||||||||||||||||||