..modules you must have seen the iframes used for realtime result display. In this tutorial I'm going to show you how to insert them into your module and how they function. what we..
Discovers interesting locations, paths and data of a website
<?php
/* Default log template functions */
/*
Turns the template to an array.
PARAMETERS:
$sSearch: string to search for
$sResult: result of the search when the conditions match scan setup
$iTime: timestamp
RETURNS:
STRING: the log format
*/
function TemplateLog($sSearch,$sResult,$iTime){
$_TBODY = "[log]\n";
$_TBODY .= "[date]".$iTime."[/date]\n";
$_TBODY .= "[keyword]".$sSearch."[/keyword]\n";
$_TBODY .= "[result]".$sResult."[/result]\n";
$_TBODY .= "[/log]\n";
return($_TBODY);
}
/*
Turns the template to an array.
PARAMETERS:
$sTemplate: template output for TemplateLog function
RETURNS:
ARRAY: return an array with names depending on the bbcode typed tag names you are using, this template returns this format:
$aLog[x]['date']: timestamp
$aLog[x]['keyword']: keyword you used as a trigger for the execution of events
$aLog[x]['result']: the result string
..where x is the number of the log
FALSE: invalid data
*/
function Template2Array($sTemplate){
$aResults = array();
@preg_match_all('/(\[log\].*?\[\\/log\])+/s',$sTemplate,$aMatches);
for($x=0;$x<count($aMatches[1]);$x++){
$aResults[$x] = array();
@preg_match_all('/\[date\](.*)\[\\/date\]+/s',$aMatches[1][$x],$aDate);
$aResults[$x]['date'] = date($_CONTEXT['time_pattern'].' H:i:s',$aDate[1][0]);
@preg_match_all('/\[keyword\](.*)\[\\/keyword\]+/s',$aMatches[1][$x],$aKeyword);
$aResults[$x]['keyword'] = $aKeyword[1][0];
@preg_match_all('/\[result\](.*)\[\\/result\]+/s',$aMatches[1][$x],$aResult);
$aResults[$x]['result'] = $aResult[1][0];
}
return((count($aResults)==0 ? false : $aResults));
}
/*
Turns the array to the output used in screen files, basically it adds some html and makes the log readable.
PARAMETERS:
$aTemplates: contains each log in an array based upon Template2Array's results
RETURNS:
STRING: structured table output for the end user :p
*/
function Array2Output($aTemplates){
// LIFO
if(false==($iTemplates = @count($aTemplates))){
$sOut = "No records available\n";
}
else{
$aTemplates = @array_reverse($aTemplates);
$sOut = "<table border=\"1\" cellspacing=\"1\" cellpadding=\"1\">\n";
$sOut .= "<tr><th>time</th><th>pattern</th><th>result</th></tr>\n";
for($x=0;$x<$iTemplates;$x++){
$sOut .= "<tr><td>".$aTemplates[$x]['date']."</td><td>".$aTemplates[$x]['keyword']."</td><td>".$aTemplates[$x]['result']."</td></tr>\n";
}
$sOut .= "</table>\n";
}
return($sOut);
}
?>