<?php
# Remove leading and trailing spacing.
$keyword = trim( $_POST["keyword"] );
$URL = trim( $_POST["URL"] );
# For security, remove some Unix metacharacters.
$meta = array( ";", ">", ">>", "<", "*", "?", "&", "|" );
$keyword = str_replace( $meta, "", $keyword );
$URL = str_replace( $meta, "", $URL );
# MySQL password hid in $_SERVER['DBPASS']
$password = $_SERVER['DBPASS'];
if ( $_POST['act'] == "Clear system" ) {
header( "Content-type: text/plain" );
system( "/usr/bin/php Clear.php $password" );
}
elseif ( $_POST['act'] == "Index web pages" ) {
header( "Content-type: text/plain" );
system( "/usr/bin/php Spider.php $password $keyword $URL" );
}
elseif ( $_POST["act"] == "List indexes" ) {
header( "Content-type: text/html" );
system( "/usr/bin/php List.php $password $keyword" );
}
elseif ( $_POST["act"] == "Help" ) {
header( "Content-type: text/html" );
$file = fopen( "Help.html", "r" ) or
exit( "Unable to open file!" );
while ( !feof( $file ) )
echo fgets( $file );
fclose( $file );
}
else {
header( "Content-type: text/html" );
echo( "<html><body>" );
echo( "<h3>No such option: " . $_POST["act"] . "</h3>" );
echo( "</body></html>" );
}
?>
|