1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

I Need Help Fast !!! Please...

Discussion in 'PHP' started by romioaa, Nov 29, 2013.

  1. #1
    I am having an issue with my website BeTorrentz.com everytime I press a category or in a torrent it says NOT FOUND ... I dont know what files are making problems so please guide me....

    HEADER:

    PHP:
    1. <?php
    2.     if (strip_tags(trim($_GET['title']))){$site_name='Download Torrent ' . strip_tags(trim($_GET['title']));}
    3.     if (strip_tags(trim($_GET['category']))){$site_name=strip_tags(trim($_GET['category'])) . ' torrents';}
    4. ?>
    5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    6. <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    7.  
    8. <link rel="shortcut icon" href="<?php echo $site_url; ?>/img/favicon.ico" >
    9. <title><?php echo $site_name; ?></title>
    10.  
    11. <!-- Include all needed files -->
    12. <link rel="stylesheet" href="<?php echo $site_url; ?>/style.css" type="text/css">
    13. <script src="<?php echo $site_url; ?>/js/jquery_1.4.2.js" language="javascript"></script>
    14. <script src="<?php echo $site_url; ?>/js/cufon.js" language="javascript"></script>
    15. <script>Cufon.replace('h1, h2:not(.exclude), h3, h4, h5, h6, .menu_item, .fancy_title ', {hover: true});</script>
    16. <script>
    17.     var togged = true;
    18.     function toggle(){
    19.         if(togged == false){
    20.             $('.descriptions').slideDown(300);
    21.             $('.toggle').html('[-] Hide Details');
    22.             togged = true;
    23.         }else{
    24.             $('.descriptions').slideUp(300);
    25.             $('.toggle').html('[+] Show Details');
    26.             togged = false;
    27.         }
    28.     }
    29. </script>
    30. </head><body>
    31.  
    32. <div class="header">
    33.     <div class="wrapper">
    34.         <div id="search">
    35.         <form action="<?php echo $site_url?>/index.php" method="get" onSubmit="this.submit();return false;"><br><br>
    36.         <input class="search_box" name="keyword" type="text" value="Type and go..." onBlur="if(this.value=='') this.value='Type and go...';" onFocus="if(this.value=='Type and go...') this.value='';">
    37.         <input name="submit" type="submit" class="search_button" value="SEARCH">
    38.         </form>
    39.         </div>
    40.         <a href="<?php echo $site_url?>">
    41.             <img id="logo" src="<?php echo $site_url?>/img/logo.gif" border="0" alt ="<?php echo $site_name?>">
    42.         </a>
    43.         <div class="clr"></div>
    44.     </div>
    45.     <div class="clr"></div>
    46. </div>
    47. <div class="wrapper">
    48.     <div class="nav">
    49.         <a href="<?php echo "$site_url/category-movies.html"; ?>"><div class="menu">Movies</div></a>
    50.         <a href="<?php echo "$site_url/category-music.html"; ?>"><div class="menu">Music</div></a>
    51.         <a href="<?php echo "$site_url/category-series.html"; ?>"><div class="menu">Series</div></a>
    52.         <a href="<?php echo "$site_url/category-anime.html"; ?>"><div class="menu">Anime</div></a>
    53.         <a href="<?php echo "$site_url/category-software.html"; ?>"><div class="menu">Software</div></a>
    54.         <a href="<?php echo "$site_url/category-games.html"; ?>"><div class="menu">Games</div></a>
    55.         <a href="<?php echo "$site_url/category-other.html"; ?>"><div class="menu">Other</div></a>
    56.         <div class="clr"></div>
    57.     </ul>
    58.     </div>
    59. </div>
    INDEX.PHP:

    PHP:
    1. <?php
    2. require_once("config.php");
    3. $category = strip_tags(trim($_GET['category']));
    4. $keywordx = strip_tags(trim($_GET['keyword']));
    5. $keyword = str_replace(' ', '+', $keywordx);
    6.  
    7. require_once("header.php");
    8. // print "<center><div align=\"center\" class=\"tagcloud\" >".tag_cloud($site_url)."</div></center>";
    9. if (!$keywordx || empty($keywordx) || $keywordx=="")
    10. { ?>
    11. <div class="wrapper">
    12.     <div class="content_left">
    13.         <?php $results=6;
    14.         echo '<div class="space"></div>';
    15.         echo '<div class="space"></div>';
    16.         $url = "http://www.vertor.com/index.php?mod=rss_browse&id=5";
    17.         echo '<div class="toggle" onclick="toggle();">[-] Hide Details</div>';
    18.         echo "<a title=\"Latest Movies Torrents\" href=\"$site_url/category-movies.html\"><h1>Latest Movies Torrents</h1></a>";
    19.         echo '<div class="line"></div>';
    20.         curl_get($url,$results,$site_url);
    21.      
    22.         echo '<div class="space"></div>';echo '<div class="space"></div>';
    23.         $url = "http://www.vertor.com/index.php?mod=rss_browse&id=6";
    24.         echo "<a title=\"Latest Music Torrents\" href=\"$site_url/category-music.html\"><h1>Latest Music Torrents</h1></a>";
    25.         echo '<div class="line"></div>';
    26.         curl_get($url,$results,$site_url);
    27.      
    28.         echo '<div class="space"></div>';echo '<div class="space"></div>';
    29.         $url = "http://www.vertor.com/index.php?mod=rss_browse&id=8";
    30.         echo "<a title=\"Latest Series Torrents\" href=\"$site_url/category-series.html\"><h1>Latest Series Torrents</h1></a>";
    31.         echo '<div class="line"></div>';
    32.         curl_get($url,$results,$site_url);
    33.      
    34.         echo '<div class="space"></div>';echo '<div class="space"></div>';
    35.         $url = "http://www.vertor.com/index.php?mod=rss_browse&id=1";
    36.         echo "<a title=\"Latest Anime Torrents\" href=\"$site_url/category-anime.html\"><h1>Latest Anime Torrents</h1></a>";
    37.         echo '<div class="line"></div>';
    38.         curl_get($url,$results,$site_url);
    39.      
    40.         echo '<div class="space"></div>';echo '<div class="space"></div>';
    41.         $url = "http://www.vertor.com/index.php?mod=rss_browse&id=2";
    42.         echo "<a title=\"Latest Software Torrents\" href=\"$site_url/category-software.html\"><h1>Latest Software Torrents</h1></a>";
    43.         echo '<div class="line"></div>';
    44.         curl_get($url,$results,$site_url);
    45.      
    46.         echo '<div class="space"></div>';echo '<div class="space"></div>';
    47.         $url = "http://www.vertor.com/index.php?mod=rss_browse&id=3";
    48.         echo "<a title=\"Latest Games Torrents\" href=\"$site_url/category-games.html\"><h1>Latest Games Torrents</h1></a>";
    49.         echo '<div class="line"></div>';
    50.         curl_get($url,$results,$site_url);
    51.      
    52.         echo '<div class="space"></div>';echo '<div class="space"></div>';
    53.         $url = "http://www.vertor.com/index.php?mod=rss_browse&id=7";
    54.         echo "<a title=\"Latest Other Torrents\" href=\"$site_url/category-other.html\"><h1>Latest Other Torrents</h1></a>";
    55.         echo '<div class="line"></div>';
    56.         curl_get($url,$results,$site_url);
    57.     ?>
    58.     </div>
    59.     <div class="content_right">
    60.         <?php include("sidebar.php"); ?>
    61.     </div>
    62.   <div class="clr"></div>
    63. </div>
    64. <?php } else { ?>
    65.  
    66. <div class="wrapper">
    67.     <div class="content_left">
    68.         <?php
    69.         $results=31;
    70.         echo '<div class="space"></div>';echo '<div class="space"></div>';
    71.         echo '<div class="toggle" onclick="toggle();">[-] Hide Details</div>';
    72.         echo "<h1>Torrents found for ($keywordx)</h1>";
    73.         echo '<div class="line"></div>';
    74.         $url = "http://www.vertor.com/index.php?mod=rss_search&words=$keyword&cid=$category&search=1";
    75.         curl_get($url,$results,$site_url); ?>
    76.     </div>
    77.     <div class="content_right">
    78.     <?php include("sidebar.php"); ?>
    79.         <!-- Advertisements will go here -->
    80.     </div>
    81.     <div class="clr"></div>
    82. </div>
    83.  
    84. <?php
    85. $keyword2 = clean_output($keyword);
    86. $keyword2 = str_replace(' ', '+', $keyword2);
    87.  
    88.     mysql_query("UPDATE torrent_tags SET count=count+1 WHERE tag_name=\"".$keyword2."\"");
    89.     mysql_query("INSERT INTO torrent_tags  SET tag_name=\"". $keyword2 ."\", count=1, search_date=NOW()");
    90. }
    91.  
    92. }
    93. require_once("footer.php");
    94. ?>
    Function.php:

    PHP:
    1. <?php
    2. function clean_output($value) {
    3.     $value = stripslashes(urldecode($value));
    4.     $value = trim(strip_tags($value));
    5.     $value = html_entity_decode($value);
    6.     $value = str_replace('+', ' ', $value);
    7.     $value = str_replace('amp;', '', $value);
    8.         return $value;
    9. }
    10. function tag_info() {
    11.   $result = mysql_query("SELECT * FROM torrent_tags GROUP BY tag_name ORDER BY count DESC LIMIT 50");
    12.   while($row = mysql_fetch_array($result)) {
    13.     $arr[$row['tag_name']] = $row['count'];
    14.   } return $arr;
    15. }
    16. // for a Tag Cloud, current not in use in v4.0
    17. function tag_cloud($site_url) {
    18.  
    19.     $min_size = 16;
    20.     $max_size = 40;
    21.     $tags = tag_info();
    22.     $minimum_count = min(array_values($tags));
    23.     $maximum_count = max(array_values($tags));
    24.     $spread = $maximum_count - $minimum_count;
    25.     if($spread == 0) {
    26.         $spread = 1;
    27.     }
    28.     $cloud_html = '';
    29.     $cloud_tags = array();
    30.     $step = ($max_size - $min_size)/($spread);
    31.     foreach ($tags as $tag => $count) {
    32.         $size = $min_size + ($count - $minimum_count)
    33.             * $step;
    34.         $cloud_tags[] = '<a style="font-size: '. floor($size) . 'px'
    35.             . '"  href="'.$site_url.'/search-' . $tag . '.html" title="(' . stripslashes(urldecode($tag)) . ') has been searched ' . $count . ' times">'
    36.             .stripslashes(urldecode($tag)) . '</a>';
    37.     }
    38.     $cloud_html = join("\n", $cloud_tags) . "\n";
    39.     return $cloud_html;
    40. }
    41. function getstring($a,$b,$c){
    42.     $y = explode($b,$a);
    43.     $x = explode($c,$y[1]);
    44.     return $x[0];
    45. }
    46. function extract_numbers($string) {
    47.     preg_match_all('/\/([\d]+)\//', $string, $match);
    48.     $match = str_replace('/', '', $match[0][0]);
    49.     return $match;
    50. }
    51. function curl_get($url,$results,$site_url){
    52.     $ch = curl_init();
    53.     curl_setopt($ch, CURLOPT_URL, $url);
    54.     if($use_proxy=="yes") {
    55.         curl_setopt($ch, CURLOPT_PROXY, $proxy_ip);
    56.         curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_user);
    57.     }
    58.     curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3");
    59.     curl_setopt($ch, CURLOPT_REFERER, $url);
    60.     curl_setopt($ch, CURLOPT_HEADER, 1);
    61.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    62.     $html = curl_exec($ch);
    63.     curl_close($ch);
    64.    
    65.     // Get the XML from the response, bypassing the header
    66.     if (!($xml = strstr($html, '<?xml'))) {
    67.                 $xml = null; echo "Cant get results...";
    68.             exit;
    69.     }
    70.    
    71.     // Create a SimpleXML object with XML response
    72.     $simple_xml = simplexml_load_string($xml);
    73.    
    74.     // Traverse XML tree and save desired values from child nodes
    75.     $i = 1;
    76.     foreach($simple_xml->channel->item as $result) {
    77.     if ($i<$results){
    78.         $title = $result->title;
    79.         $title = clean_output($title);
    80.         $link = $result->link;
    81.         $link = clean_output($link);
    82.         $description = $result->description;
    83.         //$description = clean_output($description);
    84.         $id = extract_numbers($link);
    85.         $link = str_replace("http://www.vertor.com/torrents", $site_url."/torrent", $link);
    86.         ?>
    87.    
    88.         <a href="<?php echo $link;?>"><div class="torrent_box">
    89.         <h2 class="exclude"><?php echo clear_it($title);?></h2>
    90.         <span class="descriptions" id="description_<?php echo $i; ?>"><?php echo $description;?></span>
    91.         </div></a>
    92.                
    93.         <?php
    94.         $i++;  
    95.     }
    96.     }
    97. }
    98. function clear_it($loc){
    99.     $loc = preg_replace('/[^(\x20-\x7F)]*/','',$loc);
    100.     return $loc;
    101. }
    102. function curl_get_torrent($url,$site_url){
    103.  
    104.     $ch = curl_init();
    105.     curl_setopt($ch, CURLOPT_URL, $url);
    106.     if($use_proxy=="yes") {
    107.     curl_setopt($ch, CURLOPT_PROXY, $proxy_ip);
    108.     curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_user);
    109.     }
    110.     curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3");
    111.     curl_setopt($ch, CURLOPT_REFERER, $url);
    112.     curl_setopt($ch, CURLOPT_HEADER, 1);
    113.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    114.     $html = curl_exec($ch);
    115.     curl_close($ch);
    116.  
    117.     //    torrent stats
    118.    
    119.     $tor_stats = getstring($html, '<table>', '</table>');
    120.    
    121.     $tor_stats = '<h2>Torrent Stats</h2><table>'.$tor_stats.'</table>';
    122.    
    123.  
    124.     // remove refresh icon
    125.     $tor_stats = str_replace("<a href=\"#\"  id=\"do_check\"><img style=\"position:relative;top:+2px\" src=\"http://static.vertor.com/images/but_refresh.gif\" alt=\"refresh\" id=\"refresh\"/></a>", "", $tor_stats);
    126.    
    127.    
    128.         // fix categories links
    129.     $tor_stats = str_replace("/browse/5/Movies", "$site_url/category-movies.html", $tor_stats);
    130.     $tor_stats = str_replace("/browse/6/Music", "$site_url/category-music.html", $tor_stats);
    131.     $tor_stats = str_replace("/browse/7/Other", "$site_url/category-other.html", $tor_stats);
    132.     $tor_stats = str_replace("/browse/8/Series-TV-Shows", "$site_url/category-series.html", $tor_stats);
    133.     $tor_stats = str_replace("/browse/1/Anime", "$site_url/category-anime.html", $tor_stats);
    134.     $tor_stats = str_replace("/browse/2/Software", "$site_url/category-software.html", $tor_stats);
    135.     $tor_stats = str_replace("/browse/3/Games", "$site_url/category-games.html", $tor_stats);
    136.  
    137.         echo $tor_stats;                  
    138.  
    139.        
    140.         // torrent details
    141.        
    142. // <h2 class="h1_style">Torrent's content info</h2>
    143. // <h2>Recent searches</h2>
    144.  
    145. //$tor_details = getstring($html, 'h1_style', 'Recent searches');
    146. $tor_details = getstring($html, 'content info', 'Recent searches');
    147.  
    148.    
    149.     $tor_details = '<br><h2>Torrent Content<br>'.$tor_details.'</h2>';
    150.    
    151.    
    152.             echo $tor_details;                  
    153.    
    154.        
    155.     /*  
    156.     // files block
    157.    
    158.     $tor_stats = str_replace("<caption><img src=\"http://www.vertor.com/images/files.jpg\" alt=\"files\" /><strong>Files</strong></caption>",
    159.     "<center><br><br><a href=\"".$site_url."/download/".strip_tags($_GET['id'])."\"><img src=\"$site_url/img/folder.png\" alt=\"Files\" /></a><br><br><br><br></center>", $tor_stats);
    160.    
    161.     $tor_stats = str_replace("<table class=\"data\" width=\"260\" >", "<table width=\"500\" >", $tor_stats);
    162.     $tor_stats = str_replace("height:220px;width:300px;overflow:auto;display: block", "width:100%;overflow:auto;display: block", $tor_stats);
    163.    
    164.     // download link
    165.     $tor_stats = str_replace("http://www.vertor.com/index.php?mod=download&amp;id=", "$site_url/download/", $tor_stats);
    166.    
    167.     // file type images
    168.    
    169.     $tor_stats = str_replace("http://www.vertor.com/images/file_types/", "$site_url/img/", $tor_stats);
    170.     $tor_stats = str_replace('amp;', '', $tor_stats);
    171.  
    172. //    echo "$tor_stats";  
    173. */              
    174. }
    175. ?>


    romioaa, Nov 29, 2013 IP
  2. shivampaw

    shivampaw Greenhorn

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    6
    #2
    Have you made the files for the category? there is no other reason this won't work. Make sure you have uploaded the files you are linking to.
    shivampaw, Nov 30, 2013 IP
  3. romioaa

    romioaa Well-Known Member

    Messages:
    1,321
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    150
    #3
    I think that the script works with Java Script but I am not able fix it.
    romioaa, Nov 30, 2013 IP
  4. Darkhodge

    Darkhodge Well-Known Member Premium Member

    Messages:
    2,112
    Likes Received:
    76
    Best Answers:
    1
    Trophy Points:
    185
    #4
    It's late so I don't have a huge amount of time to look into this, but the fact it shows a 404 suggests to me that the mod_rewrites haven't been set up properly.

    Have you checked into your .htaccess?
    Darkhodge, Nov 30, 2013 IP
  5. ImgPlanet

    ImgPlanet Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #5
    yes this is .htaccess problem
    ImgPlanet, Dec 1, 2013 IP