Page 1 of 1

How can I link directly to a search result?

Posted: Tue Dec 02, 2008 10:07 am
by Denver40
My site sends searches from my main page to another torrent site in frames.
What I'm trying to do is enable the user to link directly to a torrent while staying in my frames, the only way to do this right now is to display a list of results on the external site. They cant link directly to a torrent and stay in frames http://www.plentyoftorrents.com/results ... untu+linux

Can anyone tell me how I could get this working?

Here is the search.php page that handles the form .

Code: Select all

<?php
// grab the search query and request site from the url
 
if($_POST["q"]){
$q = $_POST["q"];
}else{
$q = $_GET['q'];
 
}
$q = htmlentities(stripslashes(trim($q)));
if($_POST['site']){
$site = $_POST["site"];
}else{
$site = $_GET['site'];
 
}
include('switch.php');
 
?>
and here is the switch.php page that handles the sites search strings.

Code: Select all

<?php
// here we use a switch statement to define our url
switch ($site) {
 
 
case "Mininova":
 
$url = "http://www.mininova.org/search/?search=". $q;
 
 break;
 
 
case "Btjunkie":
 
$url = "http://btjunkie.org/search?q=". $q;
 
 break;
 
case "Btleech":
 
$url = "http://btleech.com/search.php?q=". $q ."&cat=&min=min&max=max&submit=Torrents&adv=&br="; 
 
 
 break;
and the search form from the main page.

Code: Select all

 
 
<center><form name="search" action="search.php" method="get">
 
<input type="text" style="width: 155px" name="q">
 
<select name="site" style="width: 140px">
    <option>Mininova</option>
    <option>Btjunkie</option>
     <option>The Pirate Bay</option>
     <option>Bitenova</option>
      <option>Btmon</option>
       <option>btscene</option>
        <option>Isohunt</option>
       <option>Torrentportal</option>
        <option>Torrentvalley</option>
        <option>Fenopy</option>
        <option>Fulldls</option>
       <option>EZTV</option>
       <option>Torrentbox</option>
     <option>Torrentz</option>
     <option>Sumotorrents</option>
     <option>Nutorrent</option>
  </select>
<input type="submit" id="button" style="cursor: pointer;" value="Go...">
</form>
</center>
 

Re: How can I link directly to a search result?

Posted: Tue Dec 02, 2008 3:16 pm
by Denver40
Would this be better solved using javascript?

Re: How can I link directly to a search result?

Posted: Wed Dec 03, 2008 5:23 pm
by Denver40
bump* :oops:

Re: How can I link directly to a search result?

Posted: Wed Dec 03, 2008 10:12 pm
by airy
Use $_GET instead of $_POST
then, u can use url like http://www.example.com/search.php?q=keywords
keywords = whatever you want

Re: How can I link directly to a search result?

Posted: Thu Dec 04, 2008 8:51 am
by Denver40
airy wrote:Use $_GET instead of $_POST
then, u can use url like http://www.example.com/search.php?q=keywords
keywords = whatever you want
Ya I did that but that just shows the results in the same way.

I want the user to be able to send a link to a specific result to a friend and still be in my frames.
like this but in my sited frames http://www.mininova.org/tor/2060561

the way it is now they can only send someone this link which shows numurous torrents and not one specific one.
http://www.plentyoftorrents.com/search. ... a&q=Ubuntu

So I guess it would look like this. http://www.plentyoftorrents.com/search. ... or/2060561

Re: How can I link directly to a search result?

Posted: Thu Dec 04, 2008 9:15 am
by RobertGonzalez
You are going to have to be able to capture the search string and when the page is called, run the search inside the frame. On a side note, do you have to use frames for this?

Re: How can I link directly to a search result?

Posted: Thu Dec 04, 2008 9:47 am
by Denver40
Everah wrote:You are going to have to be able to capture the search string and when the page is called, run the search inside the frame. On a side note, do you have to use frames for this?
Does anyone here know how to do that? Yup the frames are the whole way the site works, making it easier for the user to check multiple sites for their torrent. Like if one site doesnt have the torrent all you have to do is go to the top menu and click on another site and it sends the same search query to that site.

Re: How can I link directly to a search result?

Posted: Thu Dec 04, 2008 10:19 am
by RobertGonzalez
When you build the frames in the HTML you tell the frames what their source is right? Use the query string to tell the frame what to load.

Re: How can I link directly to a search result?

Posted: Thu Dec 04, 2008 10:25 am
by Denver40
Everah wrote:When you build the frames in the HTML you tell the frames what their source is right? Use the query string to tell the frame what to load.
I wouldnt know how to do that I'm a php noob :oops: . Someone else put most of this php together for me.

Re: How can I link directly to a search result?

Posted: Thu Dec 04, 2008 10:40 am
by RobertGonzalez
What you want to do is capture the entire requested URI and send that to the src attribute of the frame you want to load. Frames require a src attribute so they know where their content if coming from. So basically if you take a request like:

http://mysite.com/?q=This+is+a+search

You would want to capture that entire URI and then pass that to the src attribute in the frames HTML of the frame you want to load that into.