// set the URI of your archives; this might not need to be changed (currently, it's http://yoursite.com/archives/)
$archive_uri = get_settings('home')."/archives/";
$now = gmdate('Y-m-d H:i:s'); // get the current GMT date
$year = date('Y');
$qy = mysql_query("SELECT distinct year(post_date) as year, post_status FROM $tableposts WHERE post_status='publish' AND post_date <= CURDATE() ORDER BY year desc");

$year = date('Y'); // reset the year
$qy = mysql_query("SELECT distinct year(post_date) as year, post_status FROM $tableposts WHERE post_status='publish' AND post_date <= CURDATE() ORDER BY year desc");