simple site search script required

April 3, 2011 at 12:14:48
Specs: N/A
hii. i just created a site http://fileguru.tk for file upload / download. now , i want a search box to allow my visitors search n download files by entering keywords. my site does't use any darabase. So can you please suggest me some search script for the site. Thanx. i tried google but it doesn't work . i want script which will show even the files uploaded only a few sec ago to the search results.

See More: simple site search script required

Report •

#1
April 3, 2011 at 14:09:02
You might try glob... something like below *should* list files & directories within "path_to_uploads" You can then use the various functions for finding file size, date stamp, file or directory, etc. Note: it may throw an error if the directory is empty.

foreach(glob("path_to_uploads/*") as $list) {
   ... // do something with $list
}


Report •

#2
April 3, 2011 at 21:04:07
i don't know how to put it in my site. sorry for the late reply.

Report •

#3
April 3, 2011 at 21:06:16
can you please provide me a link to it so that i can download this script. also will it show the results on my site or its own site

Report •

Related Solutions

#4
April 3, 2011 at 23:36:23
does your host support php? if it does, you can modify your home page to include a search form. as a really basic example, maybe something like

<?php

if(isset($_POST["cmd"]) && $_POST["cmd"] === "Search") {

foreach(glob("upload_path/*") as $item) {
if(is_readable($item) && !is_dir($item)) { // just process files
// $_POST["src_txt"] can be used to further include/exclude $item
echo "<a href='" . $item . "'>" . $item . "</a><br />";
}
}
}

// other bits of code
?>
<form action="<?php echo $_SERVER["PHP_SELF"];?>" method="post">
Search: <input name="src_txt" type="text" maxlength="50"><br />
<input name="cmd" value="Search" type="submit">
</form>

Sorry about the format - this board seems to mangle code when hyperlinks are embedded within. It's late for me, but hopefully the snippit is valid and will help you out in some way.

Good luck.


Report •

#5
April 4, 2011 at 03:11:24
thank you for this script. do i have to post it as such in my file or with some modification? also, i faced a new problem while searching files using some search engine that whenever i search a file n open the link it always gets to the root folder instead of downloading the file. do you have a sol 4 it or if you could tell me a script that will create a separate html file for each uploaded file so it gets opened in search result. thanx

Report •

#6
April 4, 2011 at 03:29:31
i tried it but it shows error.
http://fileguru.tk/i.php

do you have a facebook account so you can help me with these scripts over there??


Report •

#7
April 4, 2011 at 21:37:19
I don't use facebook or anything like that. I put together a script, but I'm not sure if it's entirely what your after. There's no real formatting nor did I test it to any great length.

I also don't know what sort of security issues using it may cause, so whether or not to use it is up to you. I posted a link on my page test script.

Good luck.


Report •

Ask Question