<?php
require_once("config.php");
$login = (isset($_REQUEST["login"]))? $_REQUEST["login"]: "";
$pass = (isset($_REQUEST["pass"]))? $_REQUEST["pass"]: "";
$tz = (isset($_REQUEST["tz"]))? 0+$_REQUEST["tz"] : 8;
$tz2 = (isset($_REQUEST["tz2"]))? 0+$_REQUEST["tz2"] : 0;
if (!(strlen($login) == 0 || strlen($pass) == 0)) {
setcookie("TZ", $tz);
setcookie("TZ2",$tz2);
}
$gm = new GMailer();
if (!$gm->created) {
header("Content-type: text/xml; charset=utf-8"); // must use text/xml for ajax/xmlhttp to work :(
header("Pragma: no-cache"); // stop caching
echo "<root><status>fail to create gmailer</status></root>";
exit;
}
quick_init($gm);
$tz = $tz + $tz2;
$gm->setLoginInfo($login, $pass, $tz);
if (!$gm->connect()) {
header("Content-type: text/xml; charset=utf-8"); // must use text/xml for ajax/xmlhttp to work :(
header("Pragma: no-cache"); // stop caching
echo "<root><status>Action Failed</status></root>";
exit;
}
$url = isset($_REQUEST["url"])? $_REQUEST["url"] : '';
header("Content-type: image/gif");
header("Pragma: no-cache");
$url = preg_replace('/&/', '&', $url);
print $gm->dump($url);
?>