PhpDig.net

PhpDig.net (http://www.phpdig.net/forum/index.php)
-   How-to Forum (http://www.phpdig.net/forum/forumdisplay.php?f=33)
-   -   I'm feeling lucky... (http://www.phpdig.net/forum/showthread.php?t=1008)

staura 06-17-2004 03:00 AM

I'm feeling lucky...
 
Hi, and thanks for a well written script :)

I was wondering if it was possible to add a "I'm feeling lucky" botton to the search form, like google uses.

It don't have to be a button, but is there a way to pop-up a window where the user automaticly is taken to the nr 1. search result url?

Thanks for all help...

Charter 06-19-2004 06:05 AM

Hi. One way do it this would be to pass a variable $feeling_lucky to search_function.php and then after the following code:
PHP Code:

if ((is_array($final_result)) && (count($final_result) > 0)) {
    
arsort($final_result); 

add something like the following:
PHP Code:

if ($feeling_lucky == true) {
    
// query database to get number one $lucky_site
    
header("Location: $lucky_site");
    exit();




All times are GMT -8. The time now is 11:11 PM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.