hi there i'm using a text file as a database the contents of my text file are as follows....
SRC ---> M ---> 11/22/1995 ---> myPassword ---> 11/29/2013
what i want to do is write a php code that searches for src and returns the password i am using the following code to search the text file..
<?php
$file = 'Database.txt';
$searchfor = 'src';
// the following line prevents the browser from parsing this as HTML.
header('Content-Type: text/plain');
// get the file contents, assuming the file to be readable (and exist)
$contents = file_get_contents($file);
// escape special characters in the query
$pattern = preg_quote($searchfor, '/');
// finalise the regular expression, matching the whole line
$pattern = "/^.*$pattern.*\$/m";
// search, and store all matching occurences in $matches
if(preg_match_all($pattern, $contents, $matches)){
echo implode("\n", $matches[0]);
}
else{
echo "No matches found";
}
?>
how can i make it echo the password.... any help would be appreciated... thanks in advance... :) i know using text file as a database isn't secure but still...