I'm new to php and I'm having problems with date and datetime. My code works but the database of the hosting site i use is three hours advanced. I tried to set the time as a variable at -3 hours but that didn't work. Am I going about it the wrong way?
Any help will be appreciated.
Here is a snippet of my code:
Code: Select all
header("Content-type: image/png");
$im = imagecreatefrompng("test.png");
imagecolortransparent ( $im,imagecolorallocate($im, 255, 255, 255));
$hostname=gethostbyaddr($_SERVER['REMOTE_ADDR']);
$os=find_os();
$browser=$_SERVER['HTTP_USER_AGENT']; //find_browser();
imagepng($im);
imagedestroy($im);
include 'config.php';
include 'opendb.php';
$query = 'CREATE TABLE hitlog( '.
'cid INT NOT NULL AUTO_INCREMENT, '.
'hostname TEXT, '.
'ip TEXT, '.
'os TEXT, '.
'browser TEXT, '.
'city TEXT, '.
'referer TEXT, '.
'date DATETIME, '.
'PRIMARY KEY(cid))';
$result = mysql_query($query);
$query = "INSERT INTO hitlog(hostname, ip, os, browser, city, referer, date) VALUES ('".
$hostname . "', '".
$_SERVER['REMOTE_ADDR'] . "', '".
$os . "', '".
$browser. "', '".
whois_info() . "', '".
$_SERVER['HTTP_REFERER']. "', ".
" now() )";
$result = mysql_query($query);
include 'closedb.php';