How do I?

Discussion in 'Programming' started by konko, Jun 23, 2008.

  1. #1
    I want to start a search platform which only searches eight websites. The searcher would enter their search, and then check boxes for the websites they want to search. The corresponding websites would then open up with the search term already entered.

    Somewhat like "bookingbuddy.com" except my search engine has nothing to do with airfare.

    Anybody know how to?
     
    konko, Jun 23, 2008 IP
  2. derrick98324

    derrick98324 Active Member

    Messages:
    55
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    93
    #2
    what language do you want to do this in? I know it can be done in PHP but im just making sure before i waste my post
     
    derrick98324, Jun 23, 2008 IP
  3. krdzal

    krdzal Peon

    Messages:
    105
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If you want ready scripts, go to hotscripts.com, i have seen scripts like that on that site. I m sure you will find something
     
    krdzal, Jun 23, 2008 IP
  4. konko

    konko Active Member

    Messages:
    64
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Yes, I want it done in PHP!
     
    konko, Jun 24, 2008 IP
  5. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #5
    I was wondering why reinvent hte wheel, why not get it searched by google and display resuls in custom manner?

    Please check this out.
    "http://www.google.com/coop/cse/"

    regards
     
    Vooler, Jun 24, 2008 IP
  6. konko

    konko Active Member

    Messages:
    64
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    58
    #6
    I tried that, yet it doesn't really fit my needs!

    Thanks though!
     
    konko, Jun 24, 2008 IP
  7. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #7
    So what exactly you are willing to develope?

    A search service ?
    if yes, then, do you already have data of the sites you are willing to search?
    if no, then do you want to query them once to make ready for search?

    I did not quite follow what exactly you want.

    regards
     
    Vooler, Jun 24, 2008 IP
  8. konko

    konko Active Member

    Messages:
    64
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    58
    #8
    Here's what I want to develop:

    Somebody looking for a product goes to my search engine. They type in the name of their product, and then check boxes for the sites they want to search. They than click "ok", and all the sites open up with the search term already searched for them.
     
    konko, Jun 24, 2008 IP
  9. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #9
    So I should Assume, that you already have sufficient databank to search the said 4 sites ?

    regards
     
    Vooler, Jun 24, 2008 IP
  10. konko

    konko Active Member

    Messages:
    64
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    58
    #10
    Yes I Do! :)
     
    konko, Jun 24, 2008 IP
  11. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #11
    oho, man that is very easy then ;), that means you need exact code

    search_sites.html
    <form method="post" action="search_sites.php">
        Search for <input type=text name=keyword>
        <br>
        <input type=checkbox name="sites[]" value="site_1"> Site 1<br>
        <input type=checkbox name="sites[]" value="site_2"> Site 2<br>
        <input type=checkbox name="sites[]" value="site_3"> Site 3<br>
        <input type=checkbox name="sites[]" value="site_4"> Site 4<br>
    </form>
    HTML:
    search_sites.php
    <?
       if(empty($_POST))
           ;#no data came in, handle error   
       else
       if(empty($_POST['sites']))
           ;#handle error - no sites checked
       
        
       $keyword_size_limit = 100; //100 characters
    
       $keyword = substr(trim($_POST['keyword']),0,$keyword_size_limit); 
    
       $sites = $_POST['sites'];
      
       if(get_magic_quotes_gpc())
            $keyword = stripslashes($keyword);
       $keyword = addslashes($keyword);
    
       $qantize = Array();
    
       foreach($sites as $site)
         $quantize []= "(table_field_to_search_in  LIKE \"%$keyword%\" AND site_id=\"$site\")";
    
       
       $res = mysql_query("SELECT * FROM `your_table_name` WHERE ".implode(" OR ",$quantize) ) or die('Debug:'.mysql_error());
       
    ?>
    PHP:

    I did not check the code by running it anywhere, I hope you will be able to fix the little erros yourself.

    regards
     
    Vooler, Jun 24, 2008 IP
  12. C.Whyte

    C.Whyte Peon

    Messages:
    802
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Thanks Vooler, I might use that myself for something I've been working on!
     
    C.Whyte, Jun 24, 2008 IP
  13. konko

    konko Active Member

    Messages:
    64
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    58
    #13
    WOW! Thanks!
     
    konko, Jun 24, 2008 IP
  14. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #14
    Please copy it again, I changed few things, that were really necessary to make it work.

    regards
     
    Vooler, Jun 24, 2008 IP