$curr_chpt = 7; $curr_pg = 16; $chpt = $_REQUEST['chpt']; $page = $_REQUEST['page']; ?>
![]() |
![]() ![]() ![]() ![]() |
// ---- Prepare values ---- // $currday = date("d"); $currmon = date("m"); $curryear = date("Y"); $cmstart = mktime (0, 0, 0, 1, 1, 2007); $cmtoday = mktime (0, 0, 0, $currmon, $currday, $curryear); $cmdiff = $cmtoday - $cmstart; $cmrem = $cmdiff % (60 * 60 * 24); $cmdiff = ($cmdiff - $cmrem) / (60 * 60 * 24); $cmrem = $cmdiff % 7; $cmdiff = (($cmdiff - $cmrem) / 7) * 3; $nudays = 1 - $cmrem; if ($cmrem > 3) { $cmdiff = $cmdiff + 2; $nudays = 6 - $cmrem; } else if ($cmrem > 1) { $cmdiff = $cmdiff + 1; $nudays = 3 - $cmrem; } //$cmdiff = $cmdiff - 2; $currpage = $cmdiff % 25; $issue = ($cmdiff - $currpage) / 25 + 1; if ($currpage > 24) { $currpage = $currpage - 25; $issue = $issue + 1; } $currdate = date("Y-m-d"); $currhour = date(H); $currmin = date(i); $nuhours = 23 - $currhour; $numins = 60 - $currmin; $issue = $curr_chpt; $currpage = $curr_pg; //$issue = $issue + 7; if ($chpt == "") // $chpt = 1; $chpt = $issue; if ($page == "") { $firstin = 1; $page = 0; $page = $currpage; } else $firstin = 0; $issue = 7; // ----- Write the chapter heading ----- // echo 'Chapter: '; for ($i= 1; $i <= $issue; $i++) { if ($i == $chpt) { echo ''.$i.' '; } else { echo ''.$i.' '; } } echo ' '; // ----- Write the direct page links ----- // if ($chpt > 6 ) $pg_end = 16; else $pg_end = 24; if ($chpt == $issue) { $pg_end = $currpage; } for ($i=0; $i<=$pg_end; $i++) { if ($i == $page) { echo ''.$i.' '; } else { echo ''.$i.' '; } } echo ' '; // ----- Format the page address ----- // if ($chpt < 10) $chpt_formatted = "0".$chpt; else $chpt_formatted = $chpt; if ($page < 10) $pg_formatted = "0".$page; else $pg_formatted = $page; if ($chpt == 7 and $page == 15) $pg_formatted = 16; if ($chpt == 7 and $page == 16) $pg_formatted = 18; $next_page = $page + 1; $next_chpt = $chpt; $prev_page = $page - 1; $prev_chpt = $chpt; if ($prev_page < 0) { $prev_chpt = $prev_chpt - 1; $prev_page = 16; if ($prev_chpt < 7) { $prev_page = 24; if ($prev_chpt == 0) { $prev_chpt = 1; $prev_page = 0; } } } if ($next_chpt < 7) { if ($next_page > 24) { $next_chpt = $next_chpt + 1; $next_page = 0; } } else { if ($next_page > 16) { $next_chpt = $next_chpt + 1; $next_page = 0; } } if ($next_chpt == $issue) { if ($next_page > $currpage) { $next_chpt = $issue; $next_page = $currpage; } } if ($next_chpt > $issue) { $next_chpt = $issue; $next_page = $currpage; } echo '
Home"; ?> |