ok here is what i m tring to do .
i have a log of all the players on my server .
log(log.txt) is setup like this :
[2006.03.28 15:30:17] 8ff254ece4e6fc234764f346d4c9f772 "{BLOODLINES}" "65.189.199.46" PBB
[2006.03.28 15:30:18] 3cb8a488c3a6fa40945bd8b602ba1af8 "Hitch123" "69.215.245.26" ACI
[2006.03.28 15:30:18] 0cd7d651358be15a4ff48d76967c34ea "killer_dutch" "60.225.54.20" PBS
[2006.03.28 15:30:18] acd1c95414693448e42053206d6eb83f "killerkostya" "67.189.74.18" PBB
there are over 50 entrys .
i want to use this form :
<div align="center">Name or GUID Here:</FONT><br>
<input name="search" type="text" size="15" />
<input name="submit" type="submit" value="Search" />
to echo a complete line.
the only information that i will be able to look for is the (guid) the 32 number string after the date stamp.
example :
using the log.txt in this post
If i entered this in my search form (8ff254ece4e6fc234764f346d4c9f772).
it would echo that whole line as :[2006.03.28 15:30:17] 8ff254ece4e6fc234764f346d4c9f772 "{BLOODLINES}" "65.189.199.46" PBB
if anyone can help me out i would much appreciate it .
THIS IS WHAT I HAVE SO FAR BUT IT WILL NOT WORK!
<html>
<head>
</head>
<body>
<?php
if( isset($_POST["submit"]) && !empty($_POST["submit"]) ){
if(isset($_POST["search_string"]) && !empty($_POST["search_string"]) ) {
$form_str = $_POST["search_string"];
$file_contents = file_get_contents('log.txt');
$file_contents_str = explode("\n", $file_contents);
for($i=1; $i<count($file_contents_str);$i++) {
if($file_contents_str[$i] == $form_str) {
// echo $file_contents_str[$i];
echo $file_contents;
}
}
}
else {
echo "<b>Please enter a guid.</b><br><br>";
}
}
?>
<form name="myform" method="POST" action="<? echo 'test.php'?>">
Search String : <input type="text" name="search_string" value="<?=isset($_POST['search_string'])?$_POST['search_string']:''?>"/>
<input type="submit" name="submit" value="Find guide then print whole line">
</form>
</body>
</html>