For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > March 2007 > search a offline website









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author search a offline website
Krustov

2007-03-28, 7:00 pm

I wrote this a while ago and found it comes in very handy at times .

For example , If you want to know what webpages use a certain stylesheet
its just a matter of typing in the stylesheet name and searching for it
..

If found , It will display the *****.php filename and the line number
the stylesheet was found on .

Obviously you can search for any string or variable etc .

aaasearch.php so its always at the top of the folder .

<?php
$skunk=$_SERVER['REMOTE_ADDR']; $rambo=str_replace(".","_",$skunk);
$pass=1;
if ($rambo<>"127_0_0_1") {$pass=0;}
if ($pass==0) {print "       online search not allowed
online"; exit;}
?>

Personally i dont upload the file to the webspace - but if you do then
you could add something like the above if wanted .








<html>
<head>

<title>null</title>

</head>
<body text="#FF0000" link="#FF0000" vlink="#FF0000" alink="#FF0000"
class="ta_background">

<br>

<table width="950" border="0" cellspacing="0" cellpadding="0"
align="center">
<tr>
<td>
<a href="aaasearch.php" class="bbb">Search</a>
</td>
</tr>
</table>

<br>

<?php
$zentry=$_REQUEST['entry'];
if ($zentry=="") {$zentry="nowt";}
?>

<?php

$batman=0;

$dir=".";
$joker=opendir($dir);
while (false!==($boywonder=readdir($joker)))
{
$files[]=$boywonder;
$batman=$batman+1;
}

$temp=0; $loopy=1;
while ($temp<$batman)
{
$demo=$files[$temp];
$pace=strlen($demo);
$junk=substr($demo,$pace-4,4);
if ($junk==".php") {$kk[$loopy]=$demo; $loopy=$loopy+1;}
$temp=$temp+1;
}

?>

<br>

<table border="0" cellspacing="2" cellpadding="0" align="center">

<form action="aaasearch.php" method="post">

<tr>
<td><input type="text" name="entry" value="<?php print $zentry; ?>"
size="77" class="ta_delivery_form_06"></td>
<td class="bba">   </td>
<td><input type="submit" name="Submit" value="SEARCH PHP FILES"
class="ta_form_button"></td>
</tr>

<input type="hidden" name="user" value="<?php print $uzi; ?>">

</form>

</table>

<br>

<table width="950" border="0" cellspacing="1" cellpadding="0"
align="center">

<tr>
<td>
<?php

$jazz=1;
while ($jazz<$loopy)
{

$rocky=0;

$demo=$kk[$jazz];

$filename="$demo"; $fp=fopen($filename,"r");

while (!feof($fp))
{
$qaz=fgets($fp); $wsx=trim($qaz); $edc=stripslashes($wsx);
$hod[$rocky]=$edc;
$rocky=$rocky+1;
}

fclose($fp);

$rocky=$rocky-1;

$zentry=strtolower($zentry);

$lainey=1;
while ($lainey<$rocky)
{

$hod[$lainey]=strtolower($hod[$lainey]);

$rip=" $hod[$lainey] ";
$witt=strpos($rip,$zentry);
$grab=$lainey+1;
if ($witt==true) {print "<span class=bbb><b>$demo ... $grab <br></b>
</span>";}

$lainey=$lainey+1;
}

$jazz=$jazz+1;
}

?>
</td>
</tr>

</table>

<br><br>

</BODY>
</HTML>


Rami Elomaa

2007-03-28, 7:00 pm

Krustov kirjoitti:
> I wrote this a while ago and found it comes in very handy at times .


I just love your wacky variable names, like $batman and $boywonder,
$rambo and $rocky. Who needs descriptive variable names, anyway? It's
not like someone is supposed to understand the code that you post to
usenet, obfuscating source code is the new Web 2.0!

On a sidenote, I can't make head or tails out of your code... Basicly it
seems that if someone enters the page using the server as a desktop (ie.
if user's ip is 127.0.0.1, aka. localhost) then for some reason the page
is denied and an error message is displayed, but I'm having serious
trouble understanding why and also WHY?

All in all, I think this post deserves the title of most worthless and
useless post of the month, unless you're counting my reply. Kudos for
both of us, we sure know how to waste other peoples time!

--
Rami.Elomaa@gmail.com
"Olemme apinoiden planeetalla."
Krustov

2007-03-28, 7:00 pm

<comp.lang.php>
<Rami Elomaa>
<Wed, 28 Mar 2007 22:13:58 +0300>
<eueepn$qb7$1@nyytiset.pp.htv.fi>

> I just love your wacky variable names, like $batman and $boywonder,
> $rambo and $rocky.
>


A while ago when i posted some similar code - a user posted to say he
knew a bird who only ever used disney characters as variable names .

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com