GingerBatMan, Kyatric
Yeah I also had a look at strpos function
Came up with this, But it doesn't feel right:
<?php
// read variables from POST data.
$username = $HTTP_GET_VARS[name]; <-- DEFINE THE USER??
$log = $HTTP_GET_VARS[log]; // <-- MODIFY THIS TO SEND THE REPLAY??
$mystring = $HTTP_GET_VARS[CurrentUser];
$pos = strpos($mystring, $username);
// verify the username is set and not empty
if (!isset($username) || $username == "") {
echo "failure";
exit;
}
// verify the log is set and a number
if (!isset($log) || $log == "") {
echo "failure";
exit;
}
if ($pos === false) {
echo "The string '$username' was not found in the string '$mystring'";
} else {
echo "The string '$username' was found in the string '$mystring'";
echo " and exists at position $pos";
}
?>
Then the read.php
<?php
/** Return a list of top logs. */
// read variables from GET data
$num_logs = $HTTP_GET_VARS[num_logs];
// read each line in logs.csv as a string into an array
$logs = file("logs.csv");
// define a comparator to sort items by log
function compare($s1, $s2) {
// split the strings by their delimiter
$a1 = explode("#", $s1);
$a2 = explode("#", $s2);
// compare the logs
return $a2[1] - $a1[1];
}
// sort the array of logs
usort($logs, "compare");
// output the requested number of top logs
for ($i = 0; $i < $num_logs && $i < count($logs); $i++) {
echo $logs[$i];
}
?>
Im not sure what im supposed to do the the read php to return the replay you need when you want it <img src="smileys/smiley5.gif" border="0" align="middle" />