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.
  2. Better Analytics for WordPress Get It Free

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
        if (strip_tags(trim($_GET['title']))){$site_name='Download Torrent ' . strip_tags(trim($_GET['title']));}
        if (strip_tags(trim($_GET['category']))){$site_name=strip_tags(trim($_GET['category'])) . ' torrents';}
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <link rel="shortcut icon" href="<?php echo $site_url; ?>/img/favicon.ico" >
    <title><?php echo $site_name; ?></title>
    
    <!-- Include all needed files -->
    <link rel="stylesheet" href="<?php echo $site_url; ?>/style.css" type="text/css">
    <script src="<?php echo $site_url; ?>/js/jquery_1.4.2.js" language="javascript"></script>
    <script src="<?php echo $site_url; ?>/js/cufon.js" language="javascript"></script>
    <script>Cufon.replace('h1, h2:not(.exclude), h3, h4, h5, h6, .menu_item, .fancy_title ', {hover: true});</script>
    <script>
        var togged = true;
        function toggle(){
            if(togged == false){
                $('.descriptions').slideDown(300);
                $('.toggle').html('[-] Hide Details');
                togged = true;
            }else{
                $('.descriptions').slideUp(300);
                $('.toggle').html('[+] Show Details');
                togged = false;
            }
        }
    </script>
    </head><body>
    
    <div class="header">
        <div class="wrapper">
            <div id="search">
            <form action="<?php echo $site_url?>/index.php" method="get" onSubmit="this.submit();return false;"><br><br>
            <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='';">
            <input name="submit" type="submit" class="search_button" value="SEARCH">
            </form>
            </div>
            <a href="<?php echo $site_url?>">
                <img id="logo" src="<?php echo $site_url?>/img/logo.gif" border="0" alt ="<?php echo $site_name?>">
            </a>
            <div class="clr"></div>
        </div>
        <div class="clr"></div>
    </div>
    <div class="wrapper">
        <div class="nav">
            <a href="<?php echo "$site_url/category-movies.html"; ?>"><div class="menu">Movies</div></a>
            <a href="<?php echo "$site_url/category-music.html"; ?>"><div class="menu">Music</div></a>
            <a href="<?php echo "$site_url/category-series.html"; ?>"><div class="menu">Series</div></a>
            <a href="<?php echo "$site_url/category-anime.html"; ?>"><div class="menu">Anime</div></a>
            <a href="<?php echo "$site_url/category-software.html"; ?>"><div class="menu">Software</div></a>
            <a href="<?php echo "$site_url/category-games.html"; ?>"><div class="menu">Games</div></a>
            <a href="<?php echo "$site_url/category-other.html"; ?>"><div class="menu">Other</div></a>
            <div class="clr"></div>
        </ul>
        </div>
    </div>
    PHP:
    INDEX.PHP:

    <?php
    require_once("config.php");
    $category = strip_tags(trim($_GET['category']));
    $keywordx = strip_tags(trim($_GET['keyword']));
    $keyword = str_replace(' ', '+', $keywordx);
    
    require_once("header.php");
    // print "<center><div align=\"center\" class=\"tagcloud\" >".tag_cloud($site_url)."</div></center>";
    if (!$keywordx || empty($keywordx) || $keywordx=="")
    { ?>
    <div class="wrapper">
        <div class="content_left">
            <?php $results=6;
            echo '<div class="space"></div>';
            echo '<div class="space"></div>';
            $url = "http://www.vertor.com/index.php?mod=rss_browse&id=5";
            echo '<div class="toggle" onclick="toggle();">[-] Hide Details</div>';
            echo "<a title=\"Latest Movies Torrents\" href=\"$site_url/category-movies.html\"><h1>Latest Movies Torrents</h1></a>";
            echo '<div class="line"></div>';
            curl_get($url,$results,$site_url);
          
            echo '<div class="space"></div>';echo '<div class="space"></div>';
            $url = "http://www.vertor.com/index.php?mod=rss_browse&id=6";
            echo "<a title=\"Latest Music Torrents\" href=\"$site_url/category-music.html\"><h1>Latest Music Torrents</h1></a>";
            echo '<div class="line"></div>';
            curl_get($url,$results,$site_url);
          
            echo '<div class="space"></div>';echo '<div class="space"></div>';
            $url = "http://www.vertor.com/index.php?mod=rss_browse&id=8";
            echo "<a title=\"Latest Series Torrents\" href=\"$site_url/category-series.html\"><h1>Latest Series Torrents</h1></a>";
            echo '<div class="line"></div>';
            curl_get($url,$results,$site_url);
          
            echo '<div class="space"></div>';echo '<div class="space"></div>';
            $url = "http://www.vertor.com/index.php?mod=rss_browse&id=1";
            echo "<a title=\"Latest Anime Torrents\" href=\"$site_url/category-anime.html\"><h1>Latest Anime Torrents</h1></a>";
            echo '<div class="line"></div>';
            curl_get($url,$results,$site_url);
          
            echo '<div class="space"></div>';echo '<div class="space"></div>';
            $url = "http://www.vertor.com/index.php?mod=rss_browse&id=2";
            echo "<a title=\"Latest Software Torrents\" href=\"$site_url/category-software.html\"><h1>Latest Software Torrents</h1></a>";
            echo '<div class="line"></div>';
            curl_get($url,$results,$site_url);
          
            echo '<div class="space"></div>';echo '<div class="space"></div>';
            $url = "http://www.vertor.com/index.php?mod=rss_browse&id=3";
            echo "<a title=\"Latest Games Torrents\" href=\"$site_url/category-games.html\"><h1>Latest Games Torrents</h1></a>";
            echo '<div class="line"></div>';
            curl_get($url,$results,$site_url);
          
            echo '<div class="space"></div>';echo '<div class="space"></div>';
            $url = "http://www.vertor.com/index.php?mod=rss_browse&id=7";
            echo "<a title=\"Latest Other Torrents\" href=\"$site_url/category-other.html\"><h1>Latest Other Torrents</h1></a>";
            echo '<div class="line"></div>';
            curl_get($url,$results,$site_url);
        ?>
        </div>
        <div class="content_right">
            <?php include("sidebar.php"); ?>
        </div>
      <div class="clr"></div>
    </div>
    <?php } else { ?>
    
    <div class="wrapper">
        <div class="content_left">
            <?php
            $results=31;
            echo '<div class="space"></div>';echo '<div class="space"></div>';
            echo '<div class="toggle" onclick="toggle();">[-] Hide Details</div>';
            echo "<h1>Torrents found for ($keywordx)</h1>";
            echo '<div class="line"></div>';
            $url = "http://www.vertor.com/index.php?mod=rss_search&words=$keyword&cid=$category&search=1";
            curl_get($url,$results,$site_url); ?>
        </div>
        <div class="content_right">
        <?php include("sidebar.php"); ?>
            <!-- Advertisements will go here -->
        </div>
        <div class="clr"></div>
    </div>
    
    <?php
    $keyword2 = clean_output($keyword);
    $keyword2 = str_replace(' ', '+', $keyword2);
    
    if (mysql_affected_rows()){
        mysql_query("UPDATE torrent_tags SET count=count+1 WHERE tag_name=\"".$keyword2."\"");
    } if (!mysql_affected_rows()){
        mysql_query("INSERT INTO torrent_tags  SET tag_name=\"". $keyword2 ."\", count=1, search_date=NOW()");
    }
    
    }
    require_once("footer.php");
    ?>
    PHP:
    Function.php:

    <?php
    function clean_output($value) {
        $value = stripslashes(urldecode($value));
        $value = trim(strip_tags($value));
        $value = html_entity_decode($value);
        $value = str_replace('+', ' ', $value);
        $value = str_replace('amp;', '', $value);
            return $value;
    }
    function tag_info() {
      $result = mysql_query("SELECT * FROM torrent_tags GROUP BY tag_name ORDER BY count DESC LIMIT 50");
      while($row = mysql_fetch_array($result)) {
        $arr[$row['tag_name']] = $row['count'];
      } return $arr;
    }
    // for a Tag Cloud, current not in use in v4.0
    function tag_cloud($site_url) {
    
        $min_size = 16;
        $max_size = 40;
        $tags = tag_info();
        $minimum_count = min(array_values($tags));
        $maximum_count = max(array_values($tags));
        $spread = $maximum_count - $minimum_count;
        if($spread == 0) {
            $spread = 1;
        }
        $cloud_html = '';
        $cloud_tags = array();
        $step = ($max_size - $min_size)/($spread);
        foreach ($tags as $tag => $count) {
            $size = $min_size + ($count - $minimum_count)
                * $step;
            $cloud_tags[] = '<a style="font-size: '. floor($size) . 'px'
                . '"  href="'.$site_url.'/search-' . $tag . '.html" title="(' . stripslashes(urldecode($tag)) . ') has been searched ' . $count . ' times">'
                .stripslashes(urldecode($tag)) . '</a>';
        }
        $cloud_html = join("\n", $cloud_tags) . "\n";
        return $cloud_html;
    }
    function getstring($a,$b,$c){
        $y = explode($b,$a);
        $x = explode($c,$y[1]);
        return $x[0];
    }
    function extract_numbers($string) {
        preg_match_all('/\/([\d]+)\//', $string, $match);
        $match = str_replace('/', '', $match[0][0]);
        return $match;
    }
    function curl_get($url,$results,$site_url){
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        if($use_proxy=="yes") {
            curl_setopt($ch, CURLOPT_PROXY, $proxy_ip);
            curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_user);
        }
        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");
        curl_setopt($ch, CURLOPT_REFERER, $url);
        curl_setopt($ch, CURLOPT_HEADER, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $html = curl_exec($ch);
        curl_close($ch);
       
        // Get the XML from the response, bypassing the header
        if (!($xml = strstr($html, '<?xml'))) {
                    $xml = null; echo "Cant get results...";
                exit;
        }
       
        // Create a SimpleXML object with XML response
        $simple_xml = simplexml_load_string($xml);
       
        // Traverse XML tree and save desired values from child nodes
        $i = 1;
        foreach($simple_xml->channel->item as $result) {
        if ($i<$results){
            $title = $result->title;
            $title = clean_output($title);
            $link = $result->link;
            $link = clean_output($link);
            $description = $result->description;
            //$description = clean_output($description);
            $id = extract_numbers($link);
            $link = str_replace("http://www.vertor.com/torrents", $site_url."/torrent", $link);
            ?>
       
            <a href="<?php echo $link;?>"><div class="torrent_box">
            <h2 class="exclude"><?php echo clear_it($title);?></h2>
            <span class="descriptions" id="description_<?php echo $i; ?>"><?php echo $description;?></span>
            </div></a>
                   
            <?php
            $i++;   
        }
        }
    }
    function clear_it($loc){
        $loc = preg_replace('/[^(\x20-\x7F)]*/','',$loc);
        return $loc;
    }
    function curl_get_torrent($url,$site_url){
    
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        if($use_proxy=="yes") {
        curl_setopt($ch, CURLOPT_PROXY, $proxy_ip);
        curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_user);
        }
        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");
        curl_setopt($ch, CURLOPT_REFERER, $url);
        curl_setopt($ch, CURLOPT_HEADER, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $html = curl_exec($ch);
        curl_close($ch);
    
        //    torrent stats
       
        $tor_stats = getstring($html, '<table>', '</table>');
       
        $tor_stats = '<h2>Torrent Stats</h2><table>'.$tor_stats.'</table>';
       
    
        // remove refresh icon
        $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);
       
       
            // fix categories links
        $tor_stats = str_replace("/browse/5/Movies", "$site_url/category-movies.html", $tor_stats);
        $tor_stats = str_replace("/browse/6/Music", "$site_url/category-music.html", $tor_stats);
        $tor_stats = str_replace("/browse/7/Other", "$site_url/category-other.html", $tor_stats);
        $tor_stats = str_replace("/browse/8/Series-TV-Shows", "$site_url/category-series.html", $tor_stats);
        $tor_stats = str_replace("/browse/1/Anime", "$site_url/category-anime.html", $tor_stats);
        $tor_stats = str_replace("/browse/2/Software", "$site_url/category-software.html", $tor_stats);
        $tor_stats = str_replace("/browse/3/Games", "$site_url/category-games.html", $tor_stats);
    
            echo $tor_stats;                   
    
           
            // torrent details
           
    // <h2 class="h1_style">Torrent's content info</h2>
    // <h2>Recent searches</h2>
    
    //$tor_details = getstring($html, 'h1_style', 'Recent searches');
    $tor_details = getstring($html, 'content info', 'Recent searches');
    
       
        $tor_details = '<br><h2>Torrent Content<br>'.$tor_details.'</h2>';
       
       
                echo $tor_details;                   
       
           
        /*   
        // files block
       
        $tor_stats = str_replace("<caption><img src=\"http://www.vertor.com/images/files.jpg\" alt=\"files\" /><strong>Files</strong></caption>",
        "<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);
       
        $tor_stats = str_replace("<table class=\"data\" width=\"260\" >", "<table width=\"500\" >", $tor_stats);
        $tor_stats = str_replace("height:220px;width:300px;overflow:auto;display: block", "width:100%;overflow:auto;display: block", $tor_stats);
       
        // download link
        $tor_stats = str_replace("http://www.vertor.com/index.php?mod=download&amp;id=", "$site_url/download/", $tor_stats);
       
        // file type images
       
        $tor_stats = str_replace("http://www.vertor.com/images/file_types/", "$site_url/img/", $tor_stats);
        $tor_stats = str_replace('amp;', '', $tor_stats);
    
    //    echo "$tor_stats";   
    */               
    }
    ?>
    PHP:


     
    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 Premium Member

    Messages:
    1,357
    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

    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