Пример #1
0
function home_screen($contents, $select_bar, $body, $quick_info, $refresh = 0, $plugin_reference = FALSE)
{
    $home;
    $options;
    $address;
    $peerlist;
    $refresh_header;
    $send;
    $history;
    $queue;
    $script_headers;
    $balance_history;
    $counter;
    $amount;
    $graph_data_range_sent;
    $graph_data_range_recv;
    $graph_data_trans_total;
    $graph_data_amount_total;
    $largest_sent = 10;
    $largest_recv = 10;
    $last = 20;
    $cache_refresh_time = 60;
    // How many seconds for cache to remain valid before refresh is required
    if ($refresh != 0) {
        $refresh_header = '<meta http-equiv="refresh" content="' . $refresh . '" />';
    }
    switch ($_GET["menu"]) {
        case "home":
            $home = 'class="active"';
            $graph_data_range_recv = mysql_result(mysql_query("SELECT * FROM `data_cache` WHERE `field_name` = 'graph_data_range_recv' LIMIT 1"), 0, "field_data");
            $timestamp_cache = intval(find_string("---time=", "---max", $graph_data_range_recv));
            if (time() - $cache_refresh_time > $timestamp_cache) {
                // Old data needs to be refreshed
                $history_data_to = transaction_history_query(1, $last);
                $counter = 1;
                $graph_data_range_recv = NULL;
                while ($counter <= $last) {
                    $amount = find_string("---AMOUNT{$counter}=", "---VERIFY", $history_data_to);
                    if ($amount == "") {
                        // No more data to search
                        break;
                    }
                    $counter++;
                    if ($counter <= $last + 1) {
                        if ($amount > $largest_recv) {
                            $largest_recv = $amount + 2;
                        }
                        $graph_data_range_recv .= ",{$amount}";
                    }
                }
                // Update data cache
                if (empty($graph_data_range_recv) == FALSE) {
                    mysql_query("UPDATE `data_cache` SET `field_data` = '---time=" . time() . "---max={$largest_recv}---data={$graph_data_range_recv}---end' WHERE `data_cache`.`field_name` = 'graph_data_range_recv' LIMIT 1");
                }
            } else {
                // Use cached data
                $largest_recv = find_string("---max=", "---data", $graph_data_range_recv);
                $graph_data_range_recv = find_string("---data=", "---end", $graph_data_range_recv);
            }
            $graph_data_range_sent = mysql_result(mysql_query("SELECT * FROM `data_cache` WHERE `field_name` = 'graph_data_range_sent' LIMIT 1"), 0, "field_data");
            $timestamp_cache = intval(find_string("---time=", "---max", $graph_data_range_sent));
            if (time() - $cache_refresh_time > $timestamp_cache) {
                // Old data needs to be refreshed
                $history_data_to = transaction_history_query(2, $last);
                $counter = 1;
                $graph_data_range_sent = NULL;
                while ($counter <= $last) {
                    $amount = find_string("---AMOUNT{$counter}=", "---VERIFY", $history_data_to);
                    if ($amount == "") {
                        // No more data to search
                        break;
                    }
                    $counter++;
                    if ($counter <= $last + 1) {
                        if ($amount > $largest_sent) {
                            $largest_sent = $amount + 2;
                        }
                        $graph_data_range_sent .= ",{$amount}";
                    }
                }
                // Update data cache
                if (empty($graph_data_range_sent) == FALSE) {
                    mysql_query("UPDATE `data_cache` SET `field_data` = '---time=" . time() . "---max={$largest_sent}---data={$graph_data_range_sent}---end' WHERE `data_cache`.`field_name` = 'graph_data_range_sent' LIMIT 1");
                }
            } else {
                // Use cached data
                $largest_sent = find_string("---max=", "---data", $graph_data_range_sent);
                $graph_data_range_sent = find_string("---data=", "---end", $graph_data_range_sent);
            }
            $graph_data_trans_total = mysql_result(mysql_query("SELECT * FROM `data_cache` WHERE `field_name` = 'graph_data_trans_total' LIMIT 1"), 0, "field_data");
            $graph_data_amount_total = mysql_result(mysql_query("SELECT * FROM `data_cache` WHERE `field_name` = 'graph_data_amount_total' LIMIT 1"), 0, "field_data");
            $timestamp_cache = intval(find_string("---time=", "---max", $graph_data_trans_total));
            if (time() - $cache_refresh_time > $timestamp_cache) {
                // Old data needs to be refreshed
                $total_trans_last = 25;
                $total_network_amounts_last = 20;
                $tk_trans_total_data = tk_trans_total($total_trans_last);
                $counter = 1;
                $graph_data_trans_total = NULL;
                $graph_data_amount_total = NULL;
                $max_amount = 10;
                $max_transactions = 10;
                while ($counter <= $total_trans_last) {
                    $timestamp = find_string("---TIMESTAMP{$counter}=", "---NUM{$counter}", $tk_trans_total_data);
                    $total_transactions = find_string("---NUM{$counter}=", "---AMOUNT{$counter}", $tk_trans_total_data);
                    $total_amount = find_string("---AMOUNT{$counter}=", "---END{$counter}", $tk_trans_total_data);
                    if (empty($timestamp) == TRUE) {
                        // No more data to search
                        break;
                    }
                    $counter++;
                    if ($counter <= $total_trans_last + 1) {
                        if ($total_transactions > $max_transactions) {
                            $max_transactions = $total_transactions + 2;
                        }
                        $graph_data_trans_total .= ",{$total_transactions}";
                    }
                    if ($counter <= $total_network_amounts_last + 1) {
                        if ($total_amount > $max_amount) {
                            $max_amount = $total_amount + 2;
                        }
                        $graph_data_amount_total .= ",{$total_amount}";
                    }
                }
                // Update data cache
                if (empty($graph_data_trans_total) == FALSE && empty($graph_data_amount_total) == FALSE) {
                    mysql_query("UPDATE `data_cache` SET `field_data` = '---time=" . time() . "---max={$max_transactions}---data={$graph_data_trans_total}---end' WHERE `data_cache`.`field_name` = 'graph_data_trans_total' LIMIT 1");
                    mysql_query("UPDATE `data_cache` SET `field_data` = '---time=" . time() . "---max={$max_amount}---data={$graph_data_amount_total}---end' WHERE `data_cache`.`field_name` = 'graph_data_amount_total' LIMIT 1");
                }
            } else {
                // Use cached data
                $max_transactions = find_string("---max=", "---data", $graph_data_trans_total);
                $graph_data_trans_total = find_string("---data=", "---end", $graph_data_trans_total);
                $max_amount = find_string("---max=", "---data", $graph_data_amount_total);
                $graph_data_amount_total = find_string("---data=", "---end", $graph_data_amount_total);
            }
            // Cap largest chart values
            if ($largest_recv > 5999) {
                $largest_recv = 5999;
            }
            if ($largest_sent > 5999) {
                $largest_sent = 5999;
            }
            if ($max_transactions > 999) {
                $max_transactions = 999;
            }
            if ($max_amount > 7999) {
                $max_amount = 7999;
            }
            // Cap ranges
            $largest_recv_grid = $largest_recv * 0.1;
            if ($largest_recv_grid > 300) {
                $largest_recv_grid = 300;
            }
            $largest_sent_grid = $largest_sent * 0.1;
            if ($largest_sent_grid > 300) {
                $largest_sent_grid = 300;
            }
            $max_transactions_grid = $max_transactions * 0.12;
            $max_amount_grid = $max_amount * 0.075;
            if ($max_amount_grid > 300) {
                $max_amount_grid = 300;
            }
            $script_headers = '<script type="text/javascript" src="js/tkgraph.js"></script>
<script type="text/javascript">
window.onload = function() {
	
g_graph = new Graph(
{
\'id\': "recv_graph",
\'strokeStyle\': "#FFA500",
\'fillStyle\': "rgba(0,127,0,0.20)",
\'grid\': [' . $largest_recv_grid . ',10],
\'range\': [0,' . $largest_recv . '],
\'data\': [' . $graph_data_range_recv . ']
});

g_graph = new Graph(
{
\'id\': "sent_graph",
\'strokeStyle\': "#FFA500",
\'fillStyle\': "rgba(0,0,255,0.20)",
\'grid\': [' . $largest_sent_grid . ',10],
\'range\': [0,' . $largest_sent . '],
\'data\': [' . $graph_data_range_sent . ']
});

g_graph = new Graph(
{
\'id\': "trans_total",
\'strokeStyle\': "#FFA500",
\'fillStyle\': "rgba(187,217,238,0.65)",
\'grid\': [' . $max_transactions_grid . ',10],
\'range\': [0,' . $max_transactions . '],
\'data\': [' . $graph_data_trans_total . ']
});

g_graph = new Graph(
{
\'id\': "amount_total",
\'strokeStyle\': "#FFA500",
\'fillStyle\': "rgba(130,127,0,0.20)",
\'grid\': [' . $max_amount_grid . ',10],
\'range\': [0,' . $max_amount . '],
\'data\': [' . $graph_data_amount_total . ']
});

}
</script>';
            break;
        case "address":
            $address = 'class="active"';
            break;
        case "queue":
            $queue = 'class="active"';
            break;
        case "send":
            $send = 'class="active"';
            break;
        case "history":
            $history = 'class="active"';
            break;
        case "options":
            $options = 'class="active"';
            break;
        case "peerlist":
            $peerlist = 'class="active"';
            break;
        case "tools":
            $tools = 'class="active"';
            break;
        case "backup":
            $backup = 'class="active"';
            break;
    }
    $standard_settings_number = intval(mysql_result(mysql_query("SELECT * FROM `options` WHERE `field_name` = 'standard_tabs_settings' LIMIT 1"), 0, "field_data"));
    $sql = "SELECT * FROM `options` WHERE `field_name` LIKE 'installed_plugins%' ORDER BY `options`.`field_name` ASC";
    $sql_result = mysql_query($sql);
    $sql_num_results = mysql_num_rows($sql_result);
    $plugin_output;
    for ($i = 0; $i < $sql_num_results; $i++) {
        $sql_row = mysql_fetch_array($sql_result);
        $plugin_file = find_string("---file=", "---enable", $sql_row["field_data"]);
        $plugin_tab = find_string("---tab=", "---service", $sql_row["field_data"]);
        $plugin_enable = intval(find_string("---enable=", "---show", $sql_row["field_data"]));
        $plugin_show = intval(find_string("---show=", "---name", $sql_row["field_data"]));
        if ($plugin_enable == TRUE && $plugin_show == TRUE) {
            if ($plugin_reference == TRUE) {
                $plugin_output .= '<li><a href="' . $plugin_file . '">' . $plugin_tab . '</a></li>';
            } else {
                $plugin_output .= '<li><a href="plugins/' . $plugin_file . '">' . $plugin_tab . '</a></li>';
            }
        }
    }
    if ($plugin_reference == TRUE) {
        $menu_output = '<li><a href="../index.php?menu=home" ' . $home . ' onclick="showWait()" >Home</a></li>';
        if (check_standard_tab_settings($standard_settings_number, 16) == TRUE) {
            $menu_output .= '<li><a href="../index.php?menu=address" ' . $address . ' onclick="showWait()" >Address Book</a></li>';
        }
        if (check_standard_tab_settings($standard_settings_number, 1) == TRUE) {
            $menu_output .= '<li><a href="../index.php?menu=peerlist" ' . $peerlist . ' onclick="showWait()" >Peerlist</a></li>';
        }
        if (check_standard_tab_settings($standard_settings_number, 2) == TRUE) {
            $menu_output .= '<li><a href="../index.php?menu=queue" ' . $queue . ' onclick="showWait()" >Queue</a></li>';
        }
        if (check_standard_tab_settings($standard_settings_number, 4) == TRUE) {
            $menu_output .= '<li><a href="../index.php?menu=send" ' . $send . ' onclick="showWait()" >Send</a></li>';
        }
        if (check_standard_tab_settings($standard_settings_number, 8) == TRUE) {
            $menu_output .= '<li><a href="../index.php?menu=history" ' . $history . '>History</a></li>';
        }
        $menu_output .= '<li><a href="../index.php?menu=options" ' . $options . ' onclick="showWait()" >Options</a></li>';
        if (check_standard_tab_settings($standard_settings_number, 64) == TRUE) {
            $menu_output .= '<li><a href="../index.php?menu=backup" ' . $backup . ' onclick="showWait()" >Backup</a></li>';
        }
        if (check_standard_tab_settings($standard_settings_number, 128) == TRUE) {
            $menu_output .= '<li><a href="../index.php?menu=tools" ' . $tools . ' onclick="showWait()" >Tools</a></li>';
        }
        $menu_output .= $plugin_output;
        $menu_output .= '<li><a href="../index.php?menu=logoff" onclick="showWait()" >Log Out</a></li>';
    } else {
        $menu_output = '<li><a href="index.php?menu=home" ' . $home . ' onclick="showWait()" >Home</a></li>';
        if (check_standard_tab_settings($standard_settings_number, 16) == TRUE) {
            $menu_output .= '<li><a href="index.php?menu=address" ' . $address . ' onclick="showWait()" >Address Book</a></li>';
        }
        if (check_standard_tab_settings($standard_settings_number, 1) == TRUE) {
            $menu_output .= '<li><a href="index.php?menu=peerlist" ' . $peerlist . ' onclick="showWait()" >Peerlist</a></li>';
        }
        if (check_standard_tab_settings($standard_settings_number, 2) == TRUE) {
            $menu_output .= '<li><a href="index.php?menu=queue" ' . $queue . ' onclick="showWait()" >Queue</a></li>';
        }
        if (check_standard_tab_settings($standard_settings_number, 4) == TRUE) {
            $menu_output .= '<li><a href="index.php?menu=send" ' . $send . ' onclick="showWait()" >Send</a></li>';
        }
        if (check_standard_tab_settings($standard_settings_number, 8) == TRUE) {
            $menu_output .= '<li><a href="index.php?menu=history" ' . $history . ' onclick="showWait()" >History</a></li>';
        }
        $menu_output .= '<li><a href="index.php?menu=options" ' . $options . ' onclick="showWait()" >Options</a></li>';
        if (check_standard_tab_settings($standard_settings_number, 64) == TRUE) {
            $menu_output .= '<li><a href="index.php?menu=backup" ' . $backup . ' onclick="showWait()" >Backup</a></li>';
        }
        if (check_standard_tab_settings($standard_settings_number, 128) == TRUE) {
            $menu_output .= '<li><a href="index.php?menu=tools" ' . $tools . ' onclick="showWait()" >Tools</a></li>';
        }
        $menu_output .= $plugin_output;
        $menu_output .= '<li><a href="index.php?menu=logoff" onclick="showWait()" >Log Out</a></li>';
    }
    ?>
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
    function showWait(val){
    var oDiv = document.getElementById('overlay')
    oDiv.style.display='block'
    oDiv.style.opacity = 10;
    oDiv.style.filter = 'alpha(opacity=' + val*10 + ')';
    document.body.style.cursor = "wait";
    }
</script>
<title>Timekoin Client Billfold</title>

<?php 
    if ($plugin_reference == TRUE) {
        // Redirect File Reference for Plugin
        ?>
<link rel="icon" type="image/x-icon" href="../img/favicon.ico" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link  href="../css/admin.css" rel="stylesheet" type="text/css" />
		<?php 
    } else {
        // No Plugin
        ?>
<link rel="icon" type="image/x-icon" href="img/favicon.ico" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link  href="css/admin.css" rel="stylesheet" type="text/css" />
		<?php 
    }
    ?>

<?php 
    echo $refresh_header;
    echo $script_headers;
    ?>
</head>
<body>
<div id='overlay' style="font-weight:900; background-color:powderblue; position:absolute; text-decoration:blink; top:0; left:0; display:none">
&nbsp;Please Wait...&nbsp;</div>
<div id="main">
<div id="header">
<ul id="top-navigation">
<?php 
    echo $menu_output;
    ?>
</ul>
</div>
<div id="middle">
<div id="left-column">
<?php 
    if ($plugin_reference == TRUE) {
        echo '<img src="../img/timekoin_logo.png" width="80" height="80" alt="" />';
    } else {
        echo '<img src="img/timekoin_logo.png" width="80" height="80" alt="" />';
    }
    ?>
</div>
<div id="center-column">
<div class="top-bar">
<h1><?php 
    echo $contents;
    ?>
</h1>
</div>
<div class="select-bar">
<?php 
    echo $select_bar;
    ?>
</div>
<?php 
    echo $body;
    ?>
</div>
<div id="right-column">
<strong class="h">Quick Info</strong>
<div class="box"><?php 
    echo $quick_info;
    ?>
</div>
</div>
</div>
<div id="footer"><p>Timekoin Crypto Currency Client v<?php 
    echo TIMEKOIN_VERSION;
    ?>
 - <a href="http://timekoin.org">http://timekoin.org</a> &copy; 2010&mdash;<?php 
    echo date('Y');
    ?>
 - ( You are logged in as <strong><?php 
    echo $_SESSION["login_username"];
    ?>
</strong> )</p>
 </div>
</div>
</body>
</html>
<?php 
}
Пример #2
0
						<td class="style2"><p style="font-size: 11px;">' . $amount . '</p></td>
						<td class="style2"><p style="font-size: 11px;">' . $verify . '</p></td>
						<td class="style2"><p style="word-wrap:break-word; width:140px; font-size: 11px;">' . $message . '</p></td></tr>';
                    }
                }
                $counter++;
            }
            $body_string .= '<tr><td colspan="5"><hr></hr></td></tr><tr><td colspan="5"><input type="text" size="5" name="show_more_receive" value="' . $show_last . '" /><input type="submit" name="Submit1" value="Show Last" /></FORM></td></tr>';
            $body_string .= '</table></div>';
        }
        // End hide check for receive
        if ($hide_send == FALSE) {
            $body_string .= '<strong>Showing Last <font color="blue">' . $show_last . '</font> Transactions <font color="blue">Sent From</font> this Billfold' . $name_to . '</strong></br></br>
				<div class="table"><table class="listing" border="0" cellspacing="0" cellpadding="0" ><tr><th>Date</th>
				<th>Sent To</th><th>Amount</th><th>Verification Level</th><th>Message</th></tr>';
            $history_data_to = transaction_history_query(2, $show_last);
            $counter = 1;
            while ($counter <= 100) {
                $timestamp = find_string("---TIMESTAMP{$counter}=", "---TO", $history_data_to);
                $public_key_to = find_string("---TO{$counter}=", "---AMOUNT", $history_data_to);
                $amount = find_string("---AMOUNT{$counter}=", "---VERIFY", $history_data_to);
                $verify = find_string("---VERIFY{$counter}=", "---MESSAGE", $history_data_to);
                $message = find_string("---MESSAGE{$counter}=", "---END{$counter}", $history_data_to);
                if (empty($timestamp) == TRUE && empty($amount) == TRUE) {
                    // No more data to search
                    break;
                }
                if (empty($_GET["name_id"]) == TRUE) {
                    // Check if the key matches anyone in the address book
                    $address_name = mysql_result(mysql_query("SELECT name FROM `address_book` WHERE `full_key` = '{$public_key_to}'"), 0, 0);
                    if (empty($address_name) == TRUE) {
Пример #3
0
function home_screen($contents, $select_bar, $body, $quick_info, $refresh = 0)
{
    $home;
    $options;
    $address;
    $peerlist;
    $refresh_header;
    $send;
    $history;
    $queue;
    $script_headers;
    $balance_history;
    $counter;
    $amount;
    $graph_data_range_sent;
    $graph_data_range_recv;
    $graph_data_trans_total;
    $graph_data_amount_total;
    $largest_sent = 10;
    $largest_recv = 10;
    $last = 20;
    $cache_refresh_time = 60;
    if ($refresh != 0) {
        $refresh_header = '<meta http-equiv="refresh" content="' . $refresh . '" />';
    }
    switch ($_GET["menu"]) {
        case "home":
            $home = 'class="active"';
            $graph_data_range_recv = mysql_result(mysql_query("SELECT * FROM `data_cache` WHERE `field_name` = 'graph_data_range_recv' LIMIT 1"), 0, "field_data");
            $timestamp_cache = intval(find_string("---time=", "---max", $graph_data_range_recv));
            if (time() - $cache_refresh_time > $timestamp_cache) {
                // Old data needs to be refreshed
                $history_data_to = transaction_history_query(1, $last);
                $counter = 1;
                $graph_data_range_recv = NULL;
                while ($counter <= $last) {
                    $amount = find_string("---AMOUNT{$counter}=", "---VERIFY", $history_data_to);
                    if ($amount == "") {
                        // No more data to search
                        break;
                    }
                    $counter++;
                    if ($counter <= $last + 1) {
                        if ($amount > $largest_recv) {
                            $largest_recv = $amount + 2;
                        }
                        $graph_data_range_recv .= ",{$amount}";
                    }
                }
                // Update data cache
                if (empty($graph_data_range_recv) == FALSE) {
                    mysql_query("UPDATE `data_cache` SET `field_data` = '---time=" . time() . "---max={$largest_recv}---data={$graph_data_range_recv}---end' WHERE `data_cache`.`field_name` = 'graph_data_range_recv' LIMIT 1");
                }
            } else {
                // Use cached data
                $largest_recv = find_string("---max=", "---data", $graph_data_range_recv);
                $graph_data_range_recv = find_string("---data=", "---end", $graph_data_range_recv);
            }
            $graph_data_range_sent = mysql_result(mysql_query("SELECT * FROM `data_cache` WHERE `field_name` = 'graph_data_range_sent' LIMIT 1"), 0, "field_data");
            $timestamp_cache = intval(find_string("---time=", "---max", $graph_data_range_sent));
            if (time() - $cache_refresh_time > $timestamp_cache) {
                // Old data needs to be refreshed
                $history_data_to = transaction_history_query(2, $last);
                $counter = 1;
                $graph_data_range_sent = NULL;
                while ($counter <= $last) {
                    $amount = find_string("---AMOUNT{$counter}=", "---VERIFY", $history_data_to);
                    if ($amount == "") {
                        // No more data to search
                        break;
                    }
                    $counter++;
                    if ($counter <= $last + 1) {
                        if ($amount > $largest_sent) {
                            $largest_sent = $amount + 2;
                        }
                        $graph_data_range_sent .= ",{$amount}";
                    }
                }
                // Update data cache
                if (empty($graph_data_range_sent) == FALSE) {
                    mysql_query("UPDATE `data_cache` SET `field_data` = '---time=" . time() . "---max={$largest_sent}---data={$graph_data_range_sent}---end' WHERE `data_cache`.`field_name` = 'graph_data_range_sent' LIMIT 1");
                }
            } else {
                // Use cached data
                $largest_sent = find_string("---max=", "---data", $graph_data_range_sent);
                $graph_data_range_sent = find_string("---data=", "---end", $graph_data_range_sent);
            }
            $graph_data_trans_total = mysql_result(mysql_query("SELECT * FROM `data_cache` WHERE `field_name` = 'graph_data_trans_total' LIMIT 1"), 0, "field_data");
            $graph_data_amount_total = mysql_result(mysql_query("SELECT * FROM `data_cache` WHERE `field_name` = 'graph_data_amount_total' LIMIT 1"), 0, "field_data");
            $timestamp_cache = intval(find_string("---time=", "---max", $graph_data_trans_total));
            if (time() - $cache_refresh_time > $timestamp_cache) {
                // Old data needs to be refreshed
                $total_trans_last = 25;
                $total_network_amounts_last = 20;
                $tk_trans_total_data = tk_trans_total($total_trans_last);
                $counter = 1;
                $graph_data_trans_total = NULL;
                $graph_data_amount_total = NULL;
                $max_amount = 10;
                $max_transactions = 10;
                while ($counter <= $total_trans_last) {
                    $timestamp = find_string("---TIMESTAMP{$counter}=", "---NUM{$counter}", $tk_trans_total_data);
                    $total_transactions = find_string("---NUM{$counter}=", "---AMOUNT{$counter}", $tk_trans_total_data);
                    $total_amount = find_string("---AMOUNT{$counter}=", "---END{$counter}", $tk_trans_total_data);
                    if (empty($timestamp) == TRUE) {
                        // No more data to search
                        break;
                    }
                    $counter++;
                    if ($counter <= $total_trans_last + 1) {
                        if ($total_transactions > $max_transactions) {
                            $max_transactions = $total_transactions + 2;
                        }
                        $graph_data_trans_total .= ",{$total_transactions}";
                    }
                    if ($counter <= $total_network_amounts_last + 1) {
                        if ($total_amount > $max_amount) {
                            $max_amount = $total_amount + 2;
                        }
                        $graph_data_amount_total .= ",{$total_amount}";
                    }
                }
                // Update data cache
                if (empty($graph_data_trans_total) == FALSE && empty($graph_data_amount_total) == FALSE) {
                    mysql_query("UPDATE `data_cache` SET `field_data` = '---time=" . time() . "---max={$max_transactions}---data={$graph_data_trans_total}---end' WHERE `data_cache`.`field_name` = 'graph_data_trans_total' LIMIT 1");
                    mysql_query("UPDATE `data_cache` SET `field_data` = '---time=" . time() . "---max={$max_amount}---data={$graph_data_amount_total}---end' WHERE `data_cache`.`field_name` = 'graph_data_amount_total' LIMIT 1");
                }
            } else {
                // Use cached data
                $max_transactions = find_string("---max=", "---data", $graph_data_trans_total);
                $graph_data_trans_total = find_string("---data=", "---end", $graph_data_trans_total);
                $max_amount = find_string("---max=", "---data", $graph_data_amount_total);
                $graph_data_amount_total = find_string("---data=", "---end", $graph_data_amount_total);
            }
            // Cap largest chart values
            if ($largest_recv > 5999) {
                $largest_recv = 5999;
            }
            if ($largest_sent > 5999) {
                $largest_sent = 5999;
            }
            if ($max_transactions > 999) {
                $max_transactions = 999;
            }
            if ($max_amount > 7999) {
                $max_amount = 7999;
            }
            // Cap ranges
            $largest_recv_grid = $largest_recv * 0.1;
            if ($largest_recv_grid > 300) {
                $largest_recv_grid = 300;
            }
            $largest_sent_grid = $largest_sent * 0.1;
            if ($largest_sent_grid > 300) {
                $largest_sent_grid = 300;
            }
            $max_transactions_grid = $max_transactions * 0.12;
            $max_amount_grid = $max_amount * 0.075;
            if ($max_amount_grid > 300) {
                $max_amount_grid = 300;
            }
            $script_headers = '<script type="text/javascript" src="js/tkgraph.js"></script>
<script type="text/javascript">
window.onload = function() {
	
g_graph = new Graph(
{
\'id\': "recv_graph",
\'strokeStyle\': "#FFA500",
\'fillStyle\': "rgba(0,127,0,0.20)",
\'grid\': [' . $largest_recv_grid . ',10],
\'range\': [0,' . $largest_recv . '],
\'data\': [' . $graph_data_range_recv . ']
});

g_graph = new Graph(
{
\'id\': "sent_graph",
\'strokeStyle\': "#FFA500",
\'fillStyle\': "rgba(0,0,255,0.20)",
\'grid\': [' . $largest_sent_grid . ',10],
\'range\': [0,' . $largest_sent . '],
\'data\': [' . $graph_data_range_sent . ']
});

g_graph = new Graph(
{
\'id\': "trans_total",
\'strokeStyle\': "#FFA500",
\'fillStyle\': "rgba(187,217,238,0.65)",
\'grid\': [' . $max_transactions_grid . ',10],
\'range\': [0,' . $max_transactions . '],
\'data\': [' . $graph_data_trans_total . ']
});

g_graph = new Graph(
{
\'id\': "amount_total",
\'strokeStyle\': "#FFA500",
\'fillStyle\': "rgba(130,127,0,0.20)",
\'grid\': [' . $max_amount_grid . ',10],
\'range\': [0,' . $max_amount . '],
\'data\': [' . $graph_data_amount_total . ']
});

}
</script>';
            break;
        case "address":
            $address = 'class="active"';
            break;
        case "queue":
            $queue = 'class="active"';
            break;
        case "send":
            $send = 'class="active"';
            break;
        case "history":
            $history = 'class="active"';
            break;
        case "options":
            $options = 'class="active"';
            break;
        case "peerlist":
            $peerlist = 'class="active"';
            break;
        case "tools":
            $tools = 'class="active"';
            break;
        case "backup":
            $backup = 'class="active"';
            break;
    }
    ?>
<!DOCTYPE html>
<html>
<head>
<title>Timekoin Client Billfold</title>
<link rel="icon" type="image/x-icon" href="img/favicon.ico" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link  href="css/admin.css" rel="stylesheet" type="text/css" />
<?php 
    echo $refresh_header;
    echo $script_headers;
    ?>
</head>
<body>
<div id="main">
<div id="header">
<ul id="top-navigation">
<li><a href="index.php?menu=home" <?php 
    echo $home;
    ?>
>Home</a></li>
<li><a href="index.php?menu=address" <?php 
    echo $address;
    ?>
>Address Book</a></li>
<li><a href="index.php?menu=peerlist" <?php 
    echo $peerlist;
    ?>
>Peerlist</a></li>
<li><a href="index.php?menu=queue" <?php 
    echo $queue;
    ?>
>Queue</a></li>
<li><a href="index.php?menu=send" <?php 
    echo $send;
    ?>
>Send</a></li>
<li><a href="index.php?menu=history" <?php 
    echo $history;
    ?>
>History</a></li>
<li><a href="index.php?menu=options" <?php 
    echo $options;
    ?>
>Options</a></li>
<li><a href="index.php?menu=backup" <?php 
    echo $backup;
    ?>
>Backup</a></li>
<li><a href="index.php?menu=tools" <?php 
    echo $tools;
    ?>
>Tools</a></li>
<li><a href="index.php?menu=logoff">Log Out</a></li>					 
</ul>
</div>
<div id="middle">
<div id="left-column">
<img src="img/timekoin_logo.png" width="125" height="125" alt="" />
</div>
<div id="center-column">
<div class="top-bar">
<h1><?php 
    echo $contents;
    ?>
</h1>
</div>
<div class="select-bar">
<?php 
    echo $select_bar;
    ?>
</div>
<?php 
    echo $body;
    ?>
</div>
<div id="right-column">
<strong class="h">Quick Info</strong>
<div class="box"><?php 
    echo $quick_info;
    ?>
</div>
</div>
</div>
<div id="footer"><p>Timekoin Crypto Currency Client v<?php 
    echo TIMEKOIN_VERSION;
    ?>
 - <a href="http://timekoin.org">http://timekoin.org</a> &copy; 2010&mdash;<?php 
    echo date('Y');
    ?>
 - ( You are logged in as <strong><?php 
    echo $_SESSION["login_username"];
    ?>
</strong> )</p>
 </div>
</div>
</body>
</html>
<?php 
}