<?

// HEADER
$header = "<html>
<head>
<title>Image Hosting Account</title>
<META HTTP-EQUIV='Pragma' CONTENT='no-cache'>
<link rel='STYLESHEET' type='text/css' href='styles.css'>
<script language='javascript'>
<!--
function goview() { window.location = 'index.php'; }
function gofolder(f_id) { window.location = 'view_folder.php?f_id=' + f_id;}
function gotohome() { window.location = '$admin_info[site_url]'; }
function getcode(user,id) {
var w = 400;
var h = 290;
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
var page='code.php?u=' + user + '&i=' + id;
var features = 'width='+w+',height='+h+',top='+wint+',left='+winl;
win3=window.open(page,\"\",features)
}
function focus() { 
if(document.login.email) {
document.login.email.focus(); 
}}
// -->
</script>
".str_replace("&lt;/textarea>", "</textarea>", $admin_info[user_head1])."
</head>
<body"; if($n == "login.php") { $header .= " onload=\"focus()\""; } $header .= ">
".str_replace("&lt;/textarea>", "</textarea>", $admin_info[user_head2])."





";

if($n == "cancel_success.php" | $n == "change_email.php" | $n == "login.php" | $n == "logout.php" | $n == "signup.php" | $n == "forgot.php" | $n == "paypal.php" | $n == "signup_result.php") {
$header .= "
<table cellpadding='0' cellspacing='0'>
<tr><td>
  <table width='100%' cellpadding='0' cellspacing='0'><tr>
  <td class='corners1'><img src='./icons/c_topleft.gif' border='0'></td>
  <td class='corners1' align='right'><img src='./icons/c_topright.gif' border='0'></td>
  </tr></table>
</td></tr>
<td valign='top' align='right'>



<table cellpadding='0' cellspacing='0'>
<tr><td style='padding: 7px; padding-bottom: 3px; padding-top: 0px; background: #F7F7F7; border: 1px solid #5E5E5E; border-top: none; border-bottom: none;'>
<!-- BEGIN CONTENT -->
";
} else {

// SHOW MENU

if($n != "index.php") {
$menu_index = "<a class='menu' href='index.php' title='Click here to return to your account home.'>Home</a>";
} else {
$menu_index = "<b>Home</b>";
}

if($n != "view_album.php") {
$menu_album = "<a class='menu' href='view_album.php' title='Click here to view or edit your photo album.'>Photo Album</a>";
} else {
$menu_album = "<b>Photo Album</b>";
}

if($n != "prefs.php") {
$menu_prefs = "<a class='menu' href='prefs.php' title='Click here to view or modify your account settings.'>Settings</a>";
} else {
$menu_prefs = "<b>Settings</b>";
}

if($n != "account_info.php") {
$menu_account = "<a class='menu' href='account_info.php' title='Click here to modify your account information.'>Account Info</a>";
} else {
$menu_account = "<b>Account Info</b>";
}

if($n != "support.php") {
$menu_support = "<a class='menu' href='support.php' title='Click here to visit our support area.'>Support Area</a>";
} else {
$menu_support = "<b>Support Area</b>";
}

if($n != "upgrade.php") {
$menu_upgrade = "<a class='menu' href='upgrade.php' title='Click here to upgrade your account.'>Upgrade!</a>";
} else {
$menu_upgrade = "<b>Upgrade!</b>";
}


$header .= "
<table cellpadding='0' cellspacing='0' style='margin-bottom: 8px;'>
<td><img src='./icons/menu-left.gif' border='0'></td>
<td style='background: #F5F5F5; border: 1px solid #5E5E5E; border-left: none; border-right: none; padding-left: 6px; padding-right: 5px; padding-bottom: 2px;'>
  $menu_index <font class='gray'>&nbsp;|&nbsp; </font>
"; 
if($user_info[photo_album] == "yes") {
$header .= "  $menu_album <font class='gray'>&nbsp;|&nbsp; </font>";
}
$header .= "
  $menu_prefs <font class='gray'>&nbsp;|&nbsp; </font>
  $menu_account <font class='gray'>&nbsp;|&nbsp; </font>  
  $menu_support <font class='gray'>&nbsp;|&nbsp; </font>  
  "; if($admin_info[plan_upgrade] == "yes") { $header .= " $menu_upgrade <font class='gray'>&nbsp;|&nbsp; </font>"; } $header .= "
  <a class='menu' href='logout.php' title='Click here to logout of your account.'>Logout</a>
</td>
<td><img src='./icons/menu-right.gif' border='0'></td>
</tr>
</table>

<table cellpadding='0' cellspacing='0'>
<tr>
<td valign='top' align='right' style='padding-right: 8px;'>

<table width='127' cellpadding='0' cellspacing='0'>
<tr><td>
  <table width='100%' cellpadding='0' cellspacing='0'><tr>
  <td class='corners1'><img src='./icons/c_topleft.gif' border='0'></td>
  <td class='corners1' align='right'><img src='./icons/c_topright.gif' border='0'></td>
  </tr></table>
</td></tr>
<tr>
<td class='sidebox' valign='top' style='padding-bottom: 0px;'>
";

$folders = mysql_query("SELECT * FROM ims_folders WHERE u_id='$user_info[u_id]' ORDER BY name");
$rows = mysql_num_rows($folders);

$header .= "
  <table width='100%' cellpadding='0' cellspacing='0'>
  <tr>
  <td valign='bottom' width='10' style='"; if($rows > 0) { $header .= "padding-bottom: 3px; "; } $header .= "padding-left: 5px;'><a href='index.php' title='Return to your Account Home'><img src='./icons/homefolder"; if($n == "index.php" | $n == "create_folder.php" | $n == "modify_folder.php" | $n == "delete_folder.php") { $header .= "2"; } $header .= ".gif' border='0'></a>&nbsp;</td>  <td valign='top' style='"; if($rows > 0) { $header .= "padding-bottom: 4px; "; } $header .= "padding-left: 2px;'><a href='index.php' class='client_menu' title='Open Folder'>Home</a>
  </td>
  </tr>
  </table>
";
if(isset($_GET['f_id'])) { $f_id = $_GET['f_id']; }
$header .= "
<!-- LIST IMAGE FOLDERS -->
";

$counter = 0;
while($folder_info = mysql_fetch_assoc($folders)) {
$counter = $counter + 1;

// SHOW MIDDLE FOLDERS
if($counter != $rows) { 
$header .= "
  <table width='100%' cellpadding='0' cellspacing='0' style='border-top: 1px solid #777777;'>
  <tr>
  <td valign='top' width='10' style='padding-top: 6px; padding-bottom: 4px; padding-left: 5px;'><a href='view_folder.php?f_id=$folder_info[f_id]' title='Open Folder'><img src='./icons/sfolder"; if(($n == "view_folder.php" | $n == "upload_images.php" | $n == "move_images.php" | $n == "modify_images.php" | $n == "delete_images.php") AND $f_id == "$folder_info[f_id]") { $header .= "2"; } $header .= ".gif' border='0'></a>&nbsp;</td>
  <td valign='top' style='padding-bottom: 3px; padding-top: 4px; padding-left: 2px;'><a href='view_folder.php?f_id=$folder_info[f_id]' class='client_menu' title='Open Folder'>$folder_info[name]</a>&nbsp;</td>
  </tr>
  </table>
";
} else {
// SHOW LAST FOLDER
$header .= "
  <table width='100%' cellpadding='0' cellspacing='0' style='border-top: 1px solid #777777;'>
  <tr>
  <td valign='top' width='10' style='padding-top: 6px; padding-left: 5px;'><a href='view_folder.php?f_id=$folder_info[f_id]' title='Open Folder'><img src='./icons/sfolder"; if(($n == "view_folder.php" | $n == "upload_images.php" | $n == "move_images.php" | $n == "modify_images.php" | $n == "delete_images.php") AND $f_id == "$folder_info[f_id]") { $header .= "2"; } $header .= ".gif' border='0'></a>&nbsp;</td>
  <td valign='top' style='padding-top: 4px; padding-left: 2px;'><a href='view_folder.php?f_id=$folder_info[f_id]' class='client_menu' title='Open Folder'>$folder_info[name]</a>&nbsp;</td>
  </tr>
  </table>
";
}

}

$space_used = mysql_fetch_assoc(mysql_query("SELECT sum(size) AS size FROM ims_image WHERE u_id='$user_info[u_id]'"));
if($space_used[size] == NULL) { $space_used[size] = 0; }
$space_used = ($space_used[size]) / (1024 * 1024);
$space_perc = ($space_used / ((int) $user_info[space_avail])) * 100;
$space_perc = round($space_perc, 0);
$space_used = rounder($space_used);
if($space_used > 0 AND $space_perc == 0) { $space_perc = 1; }
if($space_used == 0) { $space_perc = 0; }
$space_perc2 = 100 - $space_perc;

$isset_msg = "no";
if(($space_used/$user_info[space_avail]) >= (3/4)) {
$color = "#FF0000";
$msg = "Need More Space?";
$isset_msg = "yes";
} else {
$color = "#003366";
}

$header .= "

</td></tr>
<tr><td>
  <table width='100%' cellpadding='0' cellspacing='0'><tr>
  <td class='corners2'><img src='./icons/c_bottomleft.gif' border='0'></td>
  <td class='corners2' align='right'><img src='./icons/c_bottomright.gif' border='0'></td>
  </tr></table>
</td></tr>
</table>




<table cellpadding='0' cellspacing='0' style='margin-top: 8px;'>
<tr><td>
  <table width='100%' cellpadding='0' cellspacing='0'><tr>
  <td class='corners1'><img src='./icons/c_topleft.gif' border='0'></td>
  <td class='corners1' align='right'><img src='./icons/c_topright.gif' border='0'></td>
  </tr></table>
</td></tr>
<tr>
<td class='sidebox' valign='top' align='center' width='125'>
<!-- SHOW SPACE INFO -->
<a href='account_info.php'><b>Space Usage</b></a><br>
$space_used MB of $user_info[space_avail] MB<br>
    <table style='border: 1px solid #222222;' cellspacing='0' cellpadding='0' width='100' style='margin-top: 3px;'>
    <tr>
    <td style='background: $color;' width='$space_perc%' height='10'></td>
    <td style='background: #FFFFFF;' width='$space_perc2%' height='10'></td>
    </tr>
    </table>
</td>
</tr>
<tr><td>
  <table width='100%' cellpadding='0' cellspacing='0'><tr>
  <td class='corners2'><img src='./icons/c_bottomleft.gif' border='0'></td>
  <td class='corners2' align='right'><img src='./icons/c_bottomright.gif' border='0'></td>
  </tr></table>
</td></tr>
</table>



";

if($user_info[bandwidth_used] == "") { $user_info[bandwidth_used] = 0; }
$bandwidth_used = ($user_info[bandwidth_used]) / (1024 * 1024);
$band_perc = ($bandwidth_used / ((int) $user_info[bandwidth_allotted])) * 100;
$band_perc = round($band_perc, 0);
$bandwidth_used = rounder($bandwidth_used);
if($bandwidth_used > 0 AND $band_perc == 0) { $band_perc = 1; }
if($bandwidth_used == 0) { $band_perc = 0; }
$band_perc2 = 100 - $band_perc;

if(($bandwidth_used/$user_info[bandwidth_allotted]) >= (3/4)) {
$color = "#FF0000";
if($isset_msg == "yes") { $isset_msg = "no"; } else { $isset_msg = "yes"; }
$msg = "Need More Bandwidth?";
} else {
$color = "#003366";
}

if($isset_msg == "no") {
$num = rand(0,1);
if($num == 0) { $msg = "Need More Space?"; }
if($num == 1) { $msg = "Need More Bandwidth?"; }
}


$header .= "


<table cellpadding='0' cellspacing='0' style='margin-top: 8px;'>
<tr><td>
  <table width='100%' cellpadding='0' cellspacing='0'><tr>
  <td class='corners1'><img src='./icons/c_topleft.gif' border='0'></td>
  <td class='corners1' align='right'><img src='./icons/c_topright.gif' border='0'></td>
  </tr></table>
</td></tr>
<tr>
<td class='sidebox' valign='top' align='center' width='125'>
<!-- SHOW BANDWIDTH INFO -->
<a href='account_info.php'><b>Bandwidth Usage</b></a><br>
$bandwidth_used MB of $user_info[bandwidth_allotted] MB<br>
    <table style='border: 1px solid #222222;' cellspacing='0' cellpadding='0' width='100' style='margin-top: 3px;'>
    <tr>
    <td style='background: $color;' width='$band_perc%' height='10'></td>
    <td style='background: #FFFFFF;' width='$band_perc2%' height='10'></td>
    </tr>
    </table>
</td>
</tr>
<tr><td>
  <table width='100%' cellpadding='0' cellspacing='0'><tr>
  <td class='corners2'><img src='./icons/c_bottomleft.gif' border='0'></td>
  <td class='corners2' align='right'><img src='./icons/c_bottomright.gif' border='0'></td>
  </tr></table>
</td></tr>
</table>

";

if($admin_info[plan_upgrade] == "yes") {

$header .= "

<table cellpadding='0' cellspacing='0' style='margin-top: 8px;'>
<tr><td>
  <table width='100%' cellpadding='0' cellspacing='0'><tr>
  <td class='corners1'><img src='./icons/c_topleft.gif' border='0'></td>
  <td class='corners1' align='right'><img src='./icons/c_topright.gif' border='0'></td>
  </tr></table>
</td></tr>
<tr><form action='upgrade.php' method='POST'>
<td class='sidebox' valign='top' align='center' width='125'>
<!-- SHOW UPGRADE INFO -->
<b>$msg</b><br>
<input type='submit' class='button' value='Upgrade!' style='margin-top: 7px;'>
</td>
</form>
</tr>
<tr><td>
  <table width='100%' cellpadding='0' cellspacing='0'><tr>
  <td class='corners2'><img src='./icons/c_bottomleft.gif' border='0'></td>
  <td class='corners2' align='right'><img src='./icons/c_bottomright.gif' border='0'></td>
  </tr></table>
</td></tr>
</table>
";

}

$header .= "

</td>
<td valign='top'>

<table cellpadding='0' cellspacing='0'>
<tr><td>
  <table width='100%' cellpadding='0' cellspacing='0'><tr>
  <td class='corners1'><img src='./icons/c_topleft2.gif' border='0'></td>
  <td class='corners1' align='right'><img src='./icons/c_topright2.gif' border='0'></td>
  </tr></table>
</td></tr>
<tr><td style='padding: 7px; padding-bottom: 3px; padding-top: 0px; background: #F7F7F7; border: 1px solid #5E5E5E; border-top: none; border-bottom: none;'>
<!-- BEGIN CONTENT -->
";
}






// FOOTER
$footer = "
<!-- END CONTENT -->
";


$footer .= "
</td></tr>
<tr><td>
  <table width='100%' cellpadding='0' cellspacing='0'><tr>
  <td class='corners2'><img src='./icons/c_bottomleft2.gif' border='0'></td>
  <td class='corners2' align='right'><img src='./icons/c_bottomright2.gif' border='0'></td>
  </tr></table>
</td></tr>
</table>


<table width='530' cellpadding='0' cellspacing='0' style='margin-top: 3px;'>
<tr>
<td style='padding-left: 1px; color: #666666;'>
Driven by Webligo IMS Software
</td>
</tr>
</table>

</td></tr></table>

".str_replace("&lt;/textarea>", "</textarea>", $admin_info[user_foot])."
</body></html>
";
?>