Search Script for Wapbuddy like scripts?
Started on the old forum in July 2009 · view the original in the archive · old links redirect here
$wtlf is needed to put in a html form send the value using $_REQUEST.
<?php
//==========
// Configuration
//==========
$directory = '/var/www/'; //trailing slash
$wtlf = 'signature'; //what to look for
//======
// Snippet
//======
$flag = false;
$ext = array( '.jpg' , '.gif' , '.png' );
for( $i = 0; count( $ext ) > $i; $i++ )
{
if( file_exists( $directory . $wtlf . $ext[$i] ) )
{
$flag = true;
$name = $wtlf . $ext[$i];
}
}
if( $flag == true )
{
echo 'found file!';
//echo $name;
}
?>
im a little lost.
<html>
<body>
<?php
//==========
// Configuration
//==========
$directory = '/localhost/wapsite/games/nokia_s60/folder-a/'; //trailing slash
$wtlf = 'i'; //what to look for
//======
// Snippet
//======
$flag = false;
$ext = array( '.jpg' , '.gif' , '.png' );
for( $i = 0; count( $ext ) > $i; $i++ )
{
if( file_exists( $directory . $wtlf . $ext[$i] ) )
{
$flag = true;
$name = $wtlf . $ext[$i];
}
}
if( $flag == true )
{
echo 'found file!';
echo $name;
}
?>
</body>
</html>
Its working.
<?php
$directory = '/home/wapfuns/public_html/';
$wtlf = 'index'; //what to look for
$flag = false;
$ext = array( '.jpg' , '.gif' , '.png', '.php', '.html' );
for( $i = 0; count( $ext ) > $i; $i++ )
{
if( file_exists( $directory . $wtlf . $ext[$i] ) )
{
$flag = true;
$name .= $wtlf . $ext[$i];
}
}
if($flag == true)
{
echo 'found file!<br/>';
echo $name;
}
else
{
echo "file not found.";
}
?>
result is
found file! index.phpindex.html
Use
<?
echo __FILE__;
?>
to get file's path.
How to use this script?
LESS TALK. LESS MISTAKE.
HTTP://APPSROB.COM - LIST OF MY FACEBOOK APPS!
koizumi wrote: ok its working. bot how can I add a function to fetch the link of the searched file?
I have already told to fetch link, now what remains is to add again a copy and paste code for you.
hmmm i dont know if how to use this script... hehehehe.. lol..
LESS TALK. LESS MISTAKE.
HTTP://APPSROB.COM - LIST OF MY FACEBOOK APPS!