5ub51ded wrote:what does strpos do? im not familiar with that function
http://uk2.php.net/strpos
Sorry if the descriptiopn was a bit technical, maybe something like a code example would be more useful:
<?php
$FileContentsArr = file('http://phpbuilder.com/board/index.php');
# ^ The files location.
$SearchString = 'PHP';
# ^ String too search for, this can be easily modified to use $_GET, $_POST or anything else!
#### Functional code now #################
for ($i = 0; $i < count($FileContentsArr); $i++){
if (strpos($FileContentsArr[$i], $SearchString) != 0){
echo $FileContentsArr[$i] . "\n";
}
}
?>
First lines are confg lines.
The for loop goes through the array containing the contents of the file split up into an array (the array uses the new line as a dilimiter).
It then check for the presence ofthe search string in each line of the file (From the array) and then if found it outputs the line otherwise it continues untill the end of the file :-)
Cheers,
Ryan Jones