0) { $query = "SELECT pagename FROM `category` where `type` = 'link' and `catscript` = '$category'"; $result = mysql_query($query) or die(mysql_error()); while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { foreach ($line as $col_value) { $x++; if ($x == 1) { $pagename = $col_value; } } $x = 0; } $redir = "/links/$pagename/"; if ($page>1) { $redir .= "$page/"; } header("HTTP/1.1 301 Moved Permanently"); header("location:$redir"); exit; } } // ================ Old url checks ================ if (!$show && !$category) { $show="new"; } if (!$page) { $page="1"; } if ($page > 1) { $pbit = " | Page $page"; } if ($show=="new") { $qby="featureid"; $qorder="desc"; $h1title="New Links"; $title="New Funny Links and Hot Links"; if ($SHOW_NSFW==0) { $qex=" and `nsfw` != 'yes'"; } else { $qex=""; } $pagename="links/"; $canonical = "http://www.nearlygood.com/links/"; $desc = "The latest funny links, hot links, links to funny videos, links to free games, hotlinks and more"; $keyw = "new link, hot links, hotlinks, funny video links, funny videos"; } elseif ($show=="search") { if (!$search || strlen($search)<1 || $search=="") { header("location:/links/"); } $sarray=explode("/",$search); if ($sarray[1]) { $search = $sarray[0]; header("HTTP/1.1 301 Moved Permanently"); header("location:/search.php?search=$search"); } if (strlen($search) > strlen(preg_replace("/[^A-Za-z0-9-]/","",$search))) { $search = ereg_replace("[^A-Za-z0-9]", "", $search); header("location:/$search-links/"); } if (strlen($search) > 50) { $search = substr($search,0,50); header("location:/$search-links/"); } if (strlen($search) > 20 && strlen($search) == strlen(str_replace("-","",$search))) { header("location:/links/pages.html"); } if (strlen(str_replace("-links","",$search)) < strlen($search)) { $search = str_replace("-links","",$search); header("HTTP/1.1 301 Moved Permanently"); header("location:/$search-links/"); } if (strlen(str_replace("--","-",$search)) < strlen($search)) { $search = str_replace("--","-",$search); header("HTTP/1.1 301 Moved Permanently"); header("location:/$search-links/"); } // Spelling replace $contents = "links"; include ('/home/ngood/public_html/inc/spelling.php'); $strim = trim(str_replace("-"," ",$search)); if (strlen($strim) < strlen($search)) { $search = str_replace(" ","-",$strim); header("HTTP/1.1 301 Moved Permanently"); header("location:/$search-links/"); } $pagename .= "$search-links/"; $canonical .= "$search-links/"; $surl = $search; $search = str_replace("-"," ",$search); if (strlen($search) > 3) { $vidsquery = "SELECT id, MATCH(filename,name,category1,category2,description,tags,uploader,keydesc) AGAINST ('$search' IN BOOLEAN MODE) AS `searchscore` FROM `files` WHERE MATCH(filename,name,category1,category2,description,tags,uploader,keydesc) AGAINST ('$search' IN BOOLEAN MODE) and `content` = 'video' and `status` = 'live' and `showwhere` != 'nowhere'"; $gamequery = "SELECT id, MATCH(filename,name,category1,category2,description,tags,uploader,keydesc) AGAINST ('$search' IN BOOLEAN MODE) AS `searchscore` FROM `files` WHERE MATCH(filename,name,category1,category2,description,tags,uploader,keydesc) AGAINST ('$search' IN BOOLEAN MODE) and `content` = 'game' and `status` = 'live' and `showwhere` != 'nowhere'"; $pictquery = "SELECT id, MATCH(filename,name,category1,category2,description,tags,uploader,keydesc) AGAINST ('$search' IN BOOLEAN MODE) AS `searchscore` FROM `files` WHERE MATCH(filename,name,category1,category2,description,tags,uploader,keydesc) AGAINST ('$search' IN BOOLEAN MODE) and `content` = 'picture' and `status` = 'live' and `showwhere` != 'nowhere'"; $jokequery = "SELECT id, MATCH(filename,name,category1,category2,description,tags,uploader,keydesc) AGAINST ('$search' IN BOOLEAN MODE) AS `searchscore` FROM `files` WHERE MATCH(filename,name,category1,category2,description,tags,uploader,keydesc) AGAINST ('$search' IN BOOLEAN MODE) and `content` = 'joke' and `status` = 'live' and `showwhere` != 'nowhere'"; $pagequery = "SELECT id,content,folder,filename,name,dateadded,stat_views,stat_rating,uploader,nsfw,keydesc, MATCH(filename,name,category1,category2,description,tags,uploader,keydesc) AGAINST ('$search' IN BOOLEAN MODE) AS `searchscore` FROM `files` WHERE MATCH(filename,name,category1,category2,description,tags,uploader,keydesc) AGAINST ('$search' IN BOOLEAN MODE) and `content` = 'link' and `status` = 'live' and `showwhere` != 'nowhere'"; $qby="searchscore"; } else { $vidsquery = "SELECT id FROM `files` WHERE `content` = 'video' and `name` LIKE '%$search%' and `status` = 'live' and `showwhere` != 'nowhere' or `content` = 'video' and `description` LIKE '%$search%' and `status` = 'live' and `showwhere` != 'nowhere' or `content` = 'video' and `tags` LIKE '%$search%' and `status` = 'live' and `showwhere` != 'nowhere'"; $gamequery = "SELECT id FROM `files` WHERE `content` = 'game' and `name` LIKE '%$search%' and `status` = 'live' and `showwhere` != 'nowhere' or `content` = 'game' and `description` LIKE '%$search%' and `status` = 'live' and `showwhere` != 'nowhere' or `content` = 'game' and `tags` LIKE '%$search%' and `status` = 'live' and `showwhere` != 'nowhere'"; $pictquery = "SELECT id FROM `files` WHERE `content` = 'picture' and `name` LIKE '%$search%' and `status` = 'live' and `showwhere` != 'nowhere' or `content` = 'picture' and `description` LIKE '%$search%' and `status` = 'live' and `showwhere` != 'nowhere' or `content` = 'picture' and `tags` LIKE '%$search%' and `status` = 'live' and `showwhere` != 'nowhere'"; $jokequery = "SELECT id FROM `files` WHERE `content` = 'joke' and `name` LIKE '%$search%' and `status` = 'live' and `showwhere` != 'nowhere' or `content` = 'joke' and `description` LIKE '%$search%' and `status` = 'live' and `showwhere` != 'nowhere' or `content` = 'joke' and `tags` LIKE '%$search%' and `status` = 'live' and `showwhere` != 'nowhere'"; $pagequery = "SELECT id,content,folder,filename,name,dateadded,stat_views,stat_rating,uploader,nsfw,keydesc FROM `files` WHERE `content` = 'link' and `name` LIKE '%$search%' and `status` = 'live' and `showwhere` != 'nowhere' or `content` = 'link' and `description` LIKE '%$search%' and `status` = 'live' and `showwhere` != 'nowhere' or `content` = 'link' and `tags` LIKE '%$search%' and `status` = 'live' and `showwhere` != 'nowhere'"; $qby = "stat_score"; } $qorder="desc"; $h1title=ucwords($search) . " Links"; $title=ucwords($search) . " Links and " . ucwords($search) . " Links"; if ($SHOW_NSFW==0) { $qex=" and `nsfw` != 'yes'"; } else { $qex=""; } $selectresult = mysql_query("$pagequery and `nsfw` != 'yes'"); $sfwres = mysql_num_rows($selectresult); $selectresult = mysql_query("$pagequery and `nsfw` = 'yes'"); $nsfwres = mysql_num_rows($selectresult); $resultcount = $sfwres+$nsfwres; $selectresult = mysql_query("$gamequery"); $gamescount = mysql_num_rows($selectresult); $selectresult = mysql_query("$pictquery"); $picscount = mysql_num_rows($selectresult); $selectresult = mysql_query("$vidsquery"); $videocount = mysql_num_rows($selectresult); $selectresult = mysql_query("$jokequery"); $jokecount = mysql_num_rows($selectresult); if (strlen($search)<30 && strlen($search)>3 && $resultcount > 0) { // save search $timeline = time(); $timein = $searchtime-648000; // 7 days mysql_query("INSERT INTO `tags` VALUES ('','link','$search','$timeline')") or die(mysql_error()); $selectresult = mysql_query("SELECT id from `toptags` where `tag` = '$search' and `content` = 'link'"); $searchfound = mysql_num_rows($selectresult); if ($searchfound > 0) { $selectresult = mysql_query("SELECT * from `tags` where `content` = 'link' and `tag` = '$search' and `timeline` > '$timein'"); $tagres = mysql_num_rows($selectresult); mysql_query("UPDATE `toptags` SET `searchs` = '$tagres',`timeline` = '$timeline',`results` = '$resultcount',`sfwres` = '$sfwres',`nsfwres` = '$nsfwres' WHERE `tag` = '$search' and `content` = 'link'") or die(mysql_error()); } elseif ($resultcount > 0) { mysql_query("INSERT INTO `toptags` VALUES ('','link','$search','1','$timeline','$resultcount','$sfwres','$nsfwres')") or die(mysql_error()); } mysql_query("DELETE FROM `toptags` WHERE `tag` LIKE '%http://%' or `tag` LIKE '%.html%' or `tag` LIKE '%[url]%' or `tag` LIKE '%/%' or `tag` LIKE '%<%' or `tag` LIKE '%>%' or `tag` LIKE '%.%'") or die(mysql_error()); mysql_query("DELETE FROM `tags` WHERE `timeline` < '$timein'") or die(mysql_error()); } $pagequery .= "$qex"; $desc = "We have $search links and funny links every day along with thousands of new links, free links, hotlinks and hot links."; $keyw = "$search links, new links, funny links, funny video links, hot links, hotlinks"; } elseif ($category) { $query = "SELECT cat,catname,descrip,nsfw FROM `category` where `pagename` = '$category'"; $result = mysql_query($query) or die(mysql_error()); while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { foreach ($line as $col_value) { $x++; if ($x == 1) { $catref = $col_value; } if ($x == 2) { $catname = $col_value; } if ($x == 3) { $catdesc = $col_value; } if ($x == 4) { $catnsfw = $col_value; } } $x = 0; } $altcatname = str_replace(" Links","",$catname); $pagename="links/$category/"; $canonical = "http://www.nearlygood.com/links/$category/"; if ($show=="top") { $qby="stat_score"; $h1title="Top $catname"; $title = "Top " . ucwords($catdesc); $pagename .= "top/"; $canonical .= "top/"; $desc = "We have top $catname and hot $catname every day along with thousands of new links, free links, funny video links and hot links."; $keyw = "top " . strtolower($catname) . ", hot " . strtolower($catname) . ", new jokes, funny links, funny video links, free links, hotlinks"; } else { $qby="id"; $h1title="$catname"; $title = ucwords($catdesc); $desc = "We have $catname and funny links every day along with thousands of new links, free links, funny video links and hot links."; $keyw = strtolower($catname) . ", new links, funny links, free links, hotlinks, hot links, funny video links"; } $qorder="desc"; if ($SHOW_NSFW==0) { $qex=" and `nsfw` != 'yes'"; } else { $qex=""; } $pagequery = "`files` where `content` = 'link' and `category1` = '$catref' and `showwhere` = 'everywhere' and `status` = 'live' or `content` = 'link' and `category2` = '$catref' and `showwhere` = 'everywhere' and `status` = 'live'"; } elseif ($show=="top") { $qby="stat_score"; $qorder="desc"; $h1title="Top Links"; $title="Popular Links and Funny Links"; if ($SHOW_NSFW==0) { $qex=" and `nsfw` != 'yes'"; } else { $qex=""; } $pagename="links/top/"; $canonical = "http://www.nearlygood.com/links/top/"; $desc = "We have top links and hot links every day along with thousands of new links, free links, funny video links, funny picture links and hot links."; $keyw = "top links, hot links, new links, new links, funny links, free links, funny video links, funny picture links, hotlinks"; } if ($page!=1) { $canonical .= "$page/"; } if (!$pagequery) { $pagequery = "`files` where `content` = 'link' and `showwhere` = 'everywhere' and `status` = 'live'$qex"; } $st = 0; $listshow = 24; if (!$search) { $selectresult = mysql_query("SELECT id FROM $pagequery"); } else { $selectresult = mysql_query("$pagequery"); } $filecount = mysql_num_rows($selectresult); $listshow2 = $listshow - 1; if ($page == 1) { $st = 0; } else { $st = ($page * $listshow) - $listshow; } $first = ($page * $listshow) - $listshow2; $last = ($page * $listshow); if ($last > $filecount) { $last = $filecount; } $pages = ceil($filecount/$listshow); if ($pbit) { $desc .= str_replace(" | "," ",$pbit); $keyw .= strtolower(str_replace(" | ",", ",$pbit)); } $ogtitle = "$title"; $title = $title . $pbit . " | NearlyGood.com"; $desc = ""; $keyw = ""; $ogurl = "http://www.nearlygood.com/$pagename"; if ($page!=1) { $ogurl = "http://www.nearlygood.com/$pagename" . "$page/"; } $tab = "link"; include ('/home/ngood/public_html/inc/header.php'); ?>

0) { print "
There are $nsfwres nsfw links which match your search - Click here to include them
\n"; } if ($search && $filecount==0) { ?>

Sorry, we couldn't find any links to match what you were looking for. Try these instead:

Popular Link Tags