session_start ();
include "main_header.php";
$l_connection = @mysql_connect ( $c_db_hostname, $c_db_username, $c_db_password ) or
die ( "Unable to connect to database." );
$l_db = @mysql_select_db ( $c_db_database, $l_connection ) or
die ( "Unable to select database." );
//
// Default image directory.
//
$l_image_dir = "user_aircraft_thumb600";
$l_image_columns = 2;
if ( !isset ( $p_image_category ) )
{
$p_image_category = $_SESSION [ 'g_image_category' ];
}
else
{
$_SESSION [ 'g_image_category' ] = $p_image_category;
}
if ( !isset ( $p_image_category ) )
{
$p_image_category = 0;
}
//
// If there is a session existing, get the image size from there.
//
if ( !isset ( $p_image_size ) )
{
$p_image_size = $_SESSION [ 'g_image_size'];
}
if ( isset ( $p_image_size ) )
{
if ( $p_image_size == 0)
{
$l_image_dir = "user_aircraft_thumb100";
$l_image_columns = 6;
}
elseif ( $p_image_size == 1)
{
$l_image_dir = "user_aircraft_thumb600";
$l_image_columns = 2;
}
else
{
$l_image_dir = "user_aircraft_images";
$l_image_columns = 1;
}
$_SESSION [ 'g_image_size' ] = $p_image_size;
}
if ( isset ( $p_user_id ) && isset ( $p_aircraft_id ) )
{
$l_sql = "select u.username, u.firstname, u.surname " .
"from user u ".
"where u.id = $p_user_id ";
$l_result = @mysql_query ( $l_sql, $l_connection ) or
die ( "Unble to read user information." );
$l_row = mysql_fetch_array ( $l_result );
$l_username = $l_row [ 'username' ];
$l_firstname = $l_row [ 'firstname' ];
$l_surname = $l_row [ 'surname' ];
?>
| Images for user : =$l_username?> |
|
$l_sql = "select i.id, i.comment, DATE_FORMAT(i.date_added, '%d %b %y' ) as date_added, DATE_FORMAT(i.image_date, '%d %b %y' ) as image_date " .
"from user_aircraft_images i, user_aircraft ua, user u " .
"where ua.aircraft_id = $p_aircraft_id " .
"and ua.user_id = $p_user_id " .
"and i.user_aircraft_id = ua.id " .
"and u.id = ua.user_id " .
"and i.status = 1 " .
"and ((i.image_category_id= $p_image_category) or $p_image_category=0) " .
"order by i.image_date DESC, i.date_added DESC";
$l_result = @mysql_query ( $l_sql, $l_connection ) or
die ( "Unble to read user information." );
$l_image_counter = 1;
while ( $l_row = mysql_fetch_array ( $l_result ) )
{
$l_image_id = $l_row [ 'id' ];
$l_image_comment = $l_row [ 'comment' ];
$l_date_added = $l_row [ 'date_added' ];
$l_image_date = $l_row [ 'image_date' ];
echo ( "" );
echo ( " \n" );
if ( isset ( $l_image_date ) || isset ( $l_image_comment ) || isset ( $l_date_added ) )
{
echo ( ' ' );
if ( strlen ( $l_image_comment ) > 0 )
{
echo ( $l_image_comment . " " );
}
if ( isset ( $l_image_date ) )
{
echo ( "Image Date : $l_image_date" );
}
if ( isset ( $l_date_added ) )
{
echo ( ", Date Added : $l_date_added" );
}
}
echo ( " | \n" );
if ( $l_image_counter >= $l_image_columns )
{
echo ( '
' );
$l_image_counter = 0;
}
$l_image_counter = $l_image_counter + 1;
}
echo ( "" );
?>
}
elseif ( isset ( $p_aircraft_id ) )
{
//
// No user has been clicked on yet, so show default page for this
// aircraft model.
//
$l_sql = "select a.name aircraft_name, a.wingspan, m.name manufacturer_name, " .
" d.name designer_name, a.image_id, a.website, a.description aircraft_description " .
"from aircraft a, manufacturer m, designer d " .
"where a.id = $p_aircraft_id " .
"and m.id = a.manufacturer_id " .
"and d.id = a.designer_id";
$l_result = @mysql_query ( $l_sql, $l_connection ) or
die ( "Unable to read aircraft information." );
?>
Aircraft Models
Please select a user from the list on the left to view aircraft images.
| Selected Aircraft Information |
if ( $l_row = mysql_fetch_array ( $l_result ) )
{
$l_aircraft_name = $l_row [ 'aircraft_name' ];
$l_manufacturer_name = $l_row [ 'manufacturer_name' ];
$l_designer_name = $l_row [ 'designer_name' ];
$l_image_id = $l_row [ 'image_id' ];
$l_website = $l_row [ 'website' ];
$l_wingspan = $l_row [ 'wingspan' ];
$l_description = $l_row [ 'aircraft_description' ];
}
$l_sql = "select count(*) aircraft_count " .
"from user_aircraft " .
"where aircraft_id = $p_aircraft_id " .
"and status = 1";
$l_result = @mysql_query ( $l_sql, $l_connection ) or
die ( "Unble to read aircraft count." );
if ( $l_row = mysql_fetch_array ( $l_result ) )
{
$l_aircraft_count = $l_row [ 'aircraft_count' ];
}
echo ( "" );
echo ( " " );
echo ( " | Aircraft type | $l_aircraft_name | \n" );
if ( $l_designer_name != 'Unknown' )
{
echo ( " | Designer | $l_designer_name | \n" );
}
echo ( " | Manufacturer | $l_manufacturer_name | \n" );
echo ( " | Wing span | $l_wingspan \" | \n" );
echo ( " | # of type in system | $l_aircraft_count | \n" );
echo ( " | Manufacturers website | Click to view | \n" );
echo ( " | $l_description | \n" );
echo ( " " );
echo ( " | " );
if ( isset ( $l_image_id ) ) echo ( " " );
echo ( " |
" );
?>
}
else
{
echo ( 'Please click on one of the aircraft shown on the left.
' );
}
include "main_footer.php";
?>