<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="description" content="_your description goes here_">
<meta name="keywords" content="_your,keywords,goes,here_">
<meta name="author" content="Charles B. Swiger  / Original design: Andreas Viklund - http://andreasviklund.com/">
<link rel="stylesheet" type="text/css" href="andreas01.css" media="screen" title="andreas01 (screen)">
<link rel="stylesheet" type="text/css" href="print.css" media="print">
<title>Database Driven Web Page Demo</title>
</head>

<body><div id="wrap">

<div id="header">
<h1>PHP5 Database Access Demo</h1>
<p><strong>"I can see you fly. You are an angel with wings, high above the ground!"</strong><br />(traditional haiku poem)</p>
</div>

<img id="frontphoto" src="front.jpg" width="760" height="175" alt="" />

<div id="avmenu">
<h2 class="hide">Menu:</h2>

<?php 
require 'menu.php'; print_menu();
?>

<div class="announce">
<h3>Latest news:</h3>
<p><strong>June 25, 2005:</strong><br />
New design and layout finished and uploaded to OSWD. Since it is my first contribution to this site, it has been given the title "andreas01".</p>
<p class="textright"><a href="index.php">Main Page...</a></p>
</div>

</div>

<div id="extras">
<h3>More info:</h3>
<p>This is the third column, which can be used in many different ways. For example, it can be used for comments, site news, external links, ads or for more navigation links. It is all up to you!</p>

<h3>Links:</h3>
<p>- <a href="http://andreasviklund.com/">My website</a><br />
- <a href="http://oswd.org/">OSWD.org</a><br />
- <a href="http://validator.w3.org/check/referer">Valid HTML</a><br />
- <a href="http://jigsaw.w3.org/css-validator/check/referer">Valid CSS</a></p>

<p class="small">Version: 1.0<br />(July 25, 2005)</p>
</div>
<div id="content">
<h2>High Frequency Shortwave Radio Database</h2>
<a href="hfschedule_select_3.php">HF Broadcasting Schedule</a><br />
<a href="hfsites_4.php">Broadcasting Sites</a><br />
<a href="broadcasters_2.php">Broadcasters</a><br />

<br /><br />
<h2>US Historical Financial Data</h2>

<a href="unemployment.php">Unemployment Rate</a><br />
<a href="fedfunds_select.php">Federal Funds Rate</a><br />
<a href="indprod.php">Industrial Production</a><br />

<br /><br />
<h2>Selected Stock Quotes</h2>
<?php 
$stocks[] = 'msft';
$stocks[] = 'rht';
$stocks[] = 'java';

foreach ( $stocks as $lookup ) {

  $req = "http://finance.yahoo.com/d/quotes.csv?s=$lookup&f=sl1d1t1c1n";

  $quote = file_get_contents($req);

  for ( $i=0; $i<strlen($quote); $i++ ) {
    if ( $quote[$i] == ',' ) {
      $comma[] = $i;
      }
    }

  $symbol = substr($quote,1,$comma[0]-2);
  $price = substr($quote,$comma[0]+1,$comma[1]-$comma[0]-1);
  $stock_date = substr($quote,$comma[1]+2,$comma[2]-$comma[1]-3);
  $stock_time = substr($quote,$comma[2]+2,$comma[3]-$comma[2]-3);
  $change = substr($quote,$comma[3]+1,$comma[4]-$comma[3]-1);

  print 'On '.$stock_date.' at '.$stock_time.', '.$symbol.' traded at '.$price.', '.$change."<br />";

  unset($comma);

}
?>

<p><img src="test.jpg" class="right" height="100" width="125"  alt="" /></p>
</div>
<div id="footer">
Copyright &copy; 2005 Charles B. Swiger. Design by <a href="http://andreasviklund.com">Andreas Viklund</a>.

<?php
echo '<br /><a href="show_php.php?showpage='.$_SERVER[PHP_SELF].'" target="phppage">Show PHP</a>';
?>

</div>

</div>
</body>
</html>