I have a very basic search script which takes an input from a visitor and searches the database and outputs the result - it is located here http://www.webzila.com/?wz=dll
Everything was working fine until the person who I share the server with turned off register_globals for security reasons. Now every time you try to search it states that no search parameter was typed into the search field.
I wrote this script with a friend several years ago - I have not been working with PHP at all lately and therefore have no clue how to fix it. I know I need to re-learn this so that I can correct it myself but for now can someone take a look at this script and help out please. Your help is greatly appreciated. (I removed the personal info from the script such as un, pass, db name)
<?php //Proceed with the script after the security check
$starttime = microtime();
$startarray = explode(" ", $starttime);
$starttime = $startarray[1] + $startarray[0];
?>
<?php
$dbh=mysql_connect ("localhost", "username", "password")
or die('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("db_name");
$query = mysql_query("SELECT COUNT(*) FROM dll");
$total = mysql_result($query,0);
?>
<div id="results"><strong><font color="#0066FF"><tt>Top 5 Search Results</font></strong> out of about
<?php echo '<font color="FF0000">'.$total.'</font> records.</tt></div>' ?>
<br><ol start="1">
<?php
$return=mysql_query("SELECT * FROM dll WHERE file_name='$search'");
$dir = $_SERVER['DOCUMENT_ROOT'] . '/dll/'; //
$url = 'http://webzila.com/dll/';
$file_name=$list["file_name"];
while($list=mysql_fetch_array($return))
{
$file_name=$list["file_name"];
$file_name_zip=$list["file_name_zip"];
$file_dir=$list["file_dir"];
$file_size=$list["file_size"];
$file_ver=$list["file_ver"];
echo ' - <tt><img src="http://www.webzila.com/img/download_icon.jpg" width="27" height="23"><font size="+1"><a href="'.$url.$file_dir.'/'.$file_name_zip.'">'.$file_name.'</a></font></tt><br>'."\n";
echo '<tt><font size="-1">Size: ' .$file_size. 'KB - </tt>' . '<tt>Version: ' .$file_ver.'</font></tt><br><br>'."\n";
}
if($search == "") {
echo '<tt><strong><font size="+1" color="#0066FF">No search specified</font></strong></tt><br><br>';
}
elseif($file_name == "") {
echo '<tt><strong><font size="+1" color="#0066FF">File not found.</font></strong></tt><br><br>';
}
$endtime = microtime();
$endarray = explode(" ", $endtime);
$endtime = $endarray[1] + $endarray[0];
$totaltime = $endtime - $starttime;
$totaltime = round($totaltime,5);
echo '<tt><font size="-1"><a href="http://webzila.com/?wz=forum" target="_blank">Forum</a> | <a href="http://www.webzila.com/?wz=livesupport" target="_blank">
Live Support</a> | <a href="https://www.paypal.com/xclick/business=aeroman10%40yahoo.com&item_name=Webzila.com%2BDLL%2BDownloads%2BAppreciation&item_number=dll-files&no_note=1&tax=0¤cy_code=USD&lc=US" target="_blank">Donate</a></font></tt></ol>
<hr noshade>';
echo '<tt>Search took <strong><font color="#FF0000">'.$totaltime. ' seconds</font></strong></tt>.';
?>