get rid of getenv-calls

There's no point in explicitly loading these, when they can be
looked up in $_SERVER instead.
This commit is contained in:
Erik Faye-Lund 2013-05-13 23:04:17 +02:00
parent b6bbd54dfb
commit c2e0b40695
2 changed files with 3 additions and 3 deletions

View File

@ -6,8 +6,8 @@ $query.="WHERE id=".$which;
$result = mysql_query($query);
$prod = mysql_fetch_array($result);
$currentip=getenv("REMOTE_ADDR");
$referer=getenv("HTTP_REFERER");
$currentip = $_SERVER['REMOTE_ADDR'];
$referer = $_SERVER['HTTP_REFERER'];
if(basename($referer)=="prod.php?which=".$which && $prod["downloads_ip"]!=$currentip)
{
mysql_query("UPDATE prods SET downloads=downloads+1,downloads_ip='".$currentip."' WHERE id=".$prod["id"]);

View File

@ -135,7 +135,7 @@ function CheckReferrer($ref) {
return true;
}
$currentip=getenv("REMOTE_ADDR");
$currentip=$_SERVER['REMOTE_ADDR'];
if($prod["latestip"]!=$currentip && CheckReferrer($HTTP_REFERER) ) {
//print("im about to add another view because my ref is ".$HTTP_REFERER." have a nice day!!");
mysql_query("UPDATE prods SET views=views+1,latestip='".$currentip."' WHERE id=".$prod["id"]);