|
/***************************************************************************
file: includes/getvars.php
functionality: Gets environment variables and other core data
begin 11.08.2003
last edited 11.08.2003
copyright (C) 2003 Rinalds Uzkalns
email dev@rinalds.com
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
function getIP() {
$ip;
if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP");
else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR");
else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
else $ip = "UNKNOWN";
return $ip;
}
$date = date("y-m-d"); //complies with mySQL DATE field standart,e.g 2001-12-31
$time = date("H:i:s"); //24h format
$ip = getIP();
$browser = getenv("HTTP_USER_AGENT");
$host = getenv ("HTTP_X_FORWARDED_FOR");
$referer = getenv("HTTP_REFERER");
if (getenv("REQUEST_METHOD")=="POST")
{$en["method"] = "POST";
$vars = $_POST;
}else {
$en["method"] = "GET";
$vars = $_GET;
}
while (list ($key, $value) = each ($vars)) {
$key = chop($key);
$value = urldecode($value);
$en[$key] = $en[$key].chop($value);
//echo "$key = $value ";
}
//main variables
$req = $en["req"];
$id = $en["id"];
$offs= $en["offs"];
$what= $en["what"];
$en["ip"] = $ip; //to avoid faked IP's
$adm_user=$en["adm_user"];
$adm_pass=$en["adm_pass"];
$db_prefix = $en['db_prefix'];
if (file_exists('password.php')) include 'password.php';
$configtable = $db_prefix.'conf';
$galstable = $db_prefix.'gals';
$picstable = $db_prefix.'pics';
$commtable = $db_prefix.'comm';
include "includes/config_vars.php";
include "includes/functions.php";
?>
| |