"); print(build_links($category, $page)); print(build_navigation($category, $page)); } //----------------------------------------------- function build_categories() { global $categories; $result = "
web developers emblem perl programmers title
Custom perl/cgi & php programming, web design, web solutions, 3D publishing
  | Home | News | Services | Portfolio | Rates | Quote Me! | Download | Forum | Contact

Link Exchange

alyakWEB.com Link Exchange



  [ Home ] [ News ] [ Services ] [ Portfolio ] [ Rates ]
[ Download ] [ Forum ] [ Contact Us ] [ Links ] [ Links2 ]
 
Powered by 010SOFT LinksEx
"; for($i = 0; $i < count( $categories ); $i++ ) { if(($i % 3) == 0 ) { $result .= ""; } $result .= sprintf("", build_href($i+1, 1), $categories[$i] ); if(($i % 3) == 2) { $result .= ""; } } if(($i % 3) != 2 ) { $result .=""; } $result .= "
%s
"; return $result; } //----------------------------------------------- function build_href($category, $page) { global $mod_rewrite; if($mod_rewrite == 'on') { if($category > 0 ) { return "/cat$category/links$page.html"; } else { return "/links$page.html"; } } else { return "links.php?cat=$category&page=$page"; } } //----------------------------------------------- function build_links($category, $page) { global $links_per_page, $categories, $max_check_attempts; $query = "select * from exchange_links "; if($category > 0 ) { $query .= "where category = $category "; } $query .= " order by id "; $limit_a = ($page - 1) * $links_per_page; $limit_b = $links_per_page; $query .= " LIMIT $limit_a, $limit_b"; $result = ""; if($category > 0 ) { $result .= sprintf("", $categories[$category-1]); } $res = @mysql_query($query); $i = ($page - 1) * $links_per_page; while (($row = mysql_fetch_array($res) )) { $i++; if( $row['state'] == 'A' and $row['attempts'] < $max_check_attempts ) { $result .= sprintf("", $i, $row['code']); } else { $result .= sprintf("", $i ); } } $result .= "

%s

%s.%s
%s.Suspended
"; return $result; } //----------------------------------------------- function build_navigation($category, $page) { global $links_per_page; $query = "select count(*) from exchange_links "; if($category > 0 ) { $query .= "where category = $category "; } $res = @mysql_query($query); $row = mysql_fetch_array($res); $total = $row[0]; $pages = floor($total/ $links_per_page) + 1; if( $total % $links_per_page > 0) { $pages ++; } $result = "Pages : "; for($i = 1; $i < $pages; $i++ ) { if($page == $i) { $result .= " [$i] "; } else { $result .= sprintf(" [$i] ", build_href($category, $i)); } } return $result; } //----------------------------------------------- ?>