created) { die("fail to create gmailer"); } //$login = ereg_replace("(%40|@).*$", '', $login); // Remove @gmail... if (preg_match("(%40|@)",$login,$matched)) { // if the login has a domain list($login,$domain) = explode($matched[0],$login); // if the domain is valid, set the hosted domain if (preg_match("/yahoo\.|hotmail\.|msn\.com/i",$domain)) { $err = 8; $status = 'D'; } elseif (preg_match("/yourDomain(\.(com|net|org))?/i",$domain)) { $err = 7; $status = 'd'; } else { if (preg_match("/gmail\.com|googlemail\.com/i",$domain)) { $domain = ""; } else { $gm->setDomain($domain); } } } } if (!$err) { // initialize quick_init($gm); $timezone = $tz + $tz2; $gm->setLoginInfo(trim($login), trim($pass), $timezone); // connect to Gmail if (!$gm->connect()) { $login_error = $gm->lastActionStatus('login_error'); if ($login_error == "userpass") { // user/password error $err = 9; $status = 0; } elseif ($login_error == "userpass_suggest") { // user/password error with suggestion from gmail $err = 14; $status = "S"; $login = $gm->lastActionStatus('login_suggest'); } elseif ($login_error == "blank") { // blank username or password // shouldn't actually get this far, but here just in case $err = 11; $status = "x"; } elseif ($login_error == "challenge") { // login challenge $err = 12; $status = -1; $login_token = $gm->lastActionStatus('login_token'); //$_SESSION['gm_login_png'] = $gm->lastActionStatus('login_token_img'); } elseif ($login_error == "invalid_domain") { // invalid hosted domain name (e.g. yahoo.com, hotmail.com, etc) $err = 8; $status = 'D'; } elseif ($login_error == "domain_nonexist") { // hosted domain name does not exist $err = 7; $status = 'd'; } elseif ($login_error == "URL") { // Gmail URL changed $err = 19; $status = "!URL!"; } else { // connection error $err = 15; $status = "-"; } } } if (!$err) { // fetch initial data $q = "search=cat&cat=dummyjusttoretrievesummary&view=tl&start=0&init=1"; $gm->fetch($q); $snapshot = $gm->getSnapshot(GM_STANDARD|GM_LABEL|GM_QUERY|GM_CONVERSATION|GM_PREFERENCE); //print_r($snapshot); //debug_print("signin snapshot: ".print_r($gm,true)); if ($snapshot->created == 0) { // error occurred header("Location: index.php?err=15"); exit; } // Webclips; Added by Neerav; 22 April 2006 if (isset($snapshot->web_clips[0])) { $dis_web_clips = true; } else { $dis_web_clips = false; } // handle persistent information persistently; Neerav; April 2006 $gmail_address = (isset($snapshot->gmail_email)) ? $snapshot->gmail_email : $login."@gmail.com"; // javascript; 17 May 2006 $javascript_on = ((isset($_POST['js_status']) and $_POST['js_status'] == 1) ? 1 : 0); if ($session_method & GM_USE_PHPSESSION) { $_SESSION['signature'] = ""; $_SESSION['gmail_address'] = $gmail_address; $_SESSION['dis_web_clip'] = $dis_web_clips; $_SESSION['display_mboxes'] = $snapshot->setting_mobile['display_boxes']; $_SESSION['web_clips'] = $snapshot->web_clips; $_SESSION['last_mbox'] = "Summary::sum=1"; // javascript; 17 May 2006 $_SESSION['js_status'] = ((isset($_POST['js_status']) and $_POST['js_status'] == 1) ? 1 : 0); $_SESSION['rte_status'] = ($_SESSION['js_status'] and $snapshot->setting_other['rich_text']) ? 1 : 0; // Gmail hosted domains; Added by Neerav; 9 June 2006 $_SESSION['domain'] = (($domain) ? $domain : 0); } else { setcookie("gmail-lite_sign", base64_encode(""), $time); setcookie("gmail-lite_email", base64_encode($gmail_address), $time); setcookie("gmail-lite_webclips", (($dis_web_clips) ? 1 : 0), $time); if ($dis_web_clips) { setcookie("gmail-lite_clips", base64_encode(gzcompress(serialize($snapshot->web_clips)))); } else { setcookie("gmail-lite_clips", base64_encode(gzcompress(serialize(array())))); } setcookie("gmail-lite_mboxes", base64_encode(gzcompress(serialize($snapshot->setting_mobile['display_boxes']))),$time); setcookie("gmail-lite_last_mbox", base64_encode("Summary::sum=1")); // javascript; 17 May 2006 setcookie("gmail-lite_js_status", $javascript_on, $time); // rich text; 17 May 2006 if (!isset($_COOKIE['gmail-lite_rte_status']) or ($javascript_on != $_COOKIE['gmail-lite_rte_status'])) { setcookie("gmail-lite_rte_status", (($javascript_on and $snapshot->setting_other['rich_text']) ? 1 : 0), time()+floor(60*60*24*365.24*5)); } // Gmail hosted domains; Added by Neerav; 9 June 2006 if ($domain) { setcookie("gmail-lite_domain", $domain, $time); } else { setcookie("gmail-lite_domain", "", 1); } } if (isset($gm->raw['p'])) { $pref_count = count($gm->raw['p']); for ($pref = 0; $pref < $pref_count; $pref++) { if ($gm->raw['p'][$pref][0] == "sx_sg" and isset($gm->raw['p'][$pref][1])) { $temp_signature = "\r\n\r\n--\r\n".$gm->raw['p'][$pref][1]; if ($session_method & GM_USE_PHPSESSION) { $_SESSION['signature'] = $temp_signature; } else { setcookie("gmail-lite_sign", base64_encode($temp_signature),$time); } break; } } } // persistent searches; by Neerav; 20 May 2006 $persist_searches = "0"; $gm->fetchBox(GM_CONTACT, "search", "zzqqzzqqzzqqzzqqzzqqzzqqzzqqzzqqzzqqzzqq"); $snapshot2 = $gm->getSnapshot(GM_CONTACT); if ($snapshot2->created == 0) { // error occurred header("Location: index.php?err=15"); exit; } if (isset($snapshot2->contacts[0]) and isset($snapshot2->contacts[0]['notes']) and $snapshot2->contacts[0]['notes'] != "") { $gm->fetchBox(GM_CONTACT, "detail", $snapshot2->contacts[0]['id']); $snapshot2 = $gm->getSnapshot(GM_CONTACT); if ($snapshot2->created == 0) { // error occurred header("Location: index.php?err=15"); exit; } //debug_print(print_r($snapshot2->contacts[0])); if (isset($snapshot2->contacts[0]) and isset($snapshot2->contacts[0]['notes']) and $snapshot2->contacts[0]['notes'] != "") { $persist_searches = $snapshot2->contacts[0]['notes']; } } // persistent searches; by Neerav; 20 May 2006 if ($session_method & GM_USE_PHPSESSION) { $_SESSION['searches'] = $persist_searches; } else { setcookie("gmail-lite_searches", base64_encode(gzcompress($persist_searches)), $time); } // signin done, go to summary header("Location: main.php?sum=1"); exit(); } } elseif (!$err and isset($_COOKIE[GM_COOKIE_KEY]) and $_COOKIE[GM_COOKIE_KEY] != "") { $gm = new GMailer(); if (!$gm->created) { die("fail to create gmailer"); } // initialize quick_init($gm); // support for hosted domains; Added by Neerav; 9 June 2006 $domain = get_domain(); if ($domain !== "") $gm->setDomain($domain); // connect to Gmail if (!$gm->connect()) { header("Location: index.php?err=20"); } else { header("Location: main.php?sum=1"); } exit(); } $erra = array( 0 => "" ,1 => "You have to sign-in first." ,7 => "Gmail for your domain -- Domain does not exist. Remove the @".$domain." from the username." ,8 => "gmail-lite cannot be used to check ".$domain." accounts." ,9 => "Username and password do not match (You provided ".$login.(($domain)?"@".$domain:"").")" ,10 => "Signin failed. Please check your login/password/cookie setting." ,11 => "Required field cannot be left blank" ,12 => "Gmail has requested login verification, which cannot be done through gmail-lite. You must sign in through the Gmail website AND wait for a few hours before you can sign in from here. This MAY be due to:
- too many incorrect signin attempts
- Gmail thinks your password is too easy to guess, so change your password
- other reasons" ,14 => "Username and password do not match. (Did you mean ".$login." ?)" ,15 => "Signin failed. Gmail connection error. Try again after a few minutes." ,17 => "Session expired. Sign in again." ,19 => "Gmail has changed something and broken gmail-lite. Hopefully this can be fixed soon." ,20 => "Cookies expired. Please sign in again." ,21 => "Missing data. Please sign in again. If this occurs often, please contact developer below." ,99 => trim($login)." has been barred. Contact the address below for help." ); $time_zones = array( "-12","-11","-10","-9","-8","-7","-6","-5","-4","-3","-2","-1", "0", // GMT "1","2","3","4","5","6","7","8","9","10","11","12","13","14" ); $time_zones2 = array( "0","00","15","30","45" ); // debugging cookies and signout //print_r($_COOKIE); // set the timezone // make sure the request is valid if (isset($_REQUEST["tz"])) { if (in_array($_REQUEST["tz"],$time_zones)) { $timezone = str_replace(" ","+",$_REQUEST["tz"]); } else { $timezone = "0"; } } elseif (isset($_COOKIE["gmail-lite_timezone"]) and in_array($_COOKIE["gmail-lite_timezone"],$time_zones)) { $timezone = $_COOKIE["gmail-lite_timezone"]; } else { $timezone = "0"; } if (isset($_REQUEST["tz2"])) { if (in_array($_REQUEST["tz2"]*60,$time_zones2)) { $timezone2 = $_REQUEST["tz2"]*60; } else { $timezone2 = "00"; } } elseif (isset($_COOKIE["gmail-lite_timezone2"]) and in_array($_COOKIE["gmail-lite_timezone2"]*60,$time_zones2)) { $timezone2 = $_COOKIE["gmail-lite_timezone2"]*60; } else { $timezone2 = "00"; } // expire cookies if there is an error; Added by Neerav; 14 June 2006 setcookie("gmail-lite_sign", "", 1); setcookie("gmail-lite_email", "", 1); setcookie("gmail-lite_webclips", "", 1); setcookie("gmail-lite_mboxes", "", 1); setcookie("gmail-lite_clips", "", 1); setcookie("gmail-lite_last_mbox", "", 1); setcookie("gmail-lite_js_status", "", 1); setcookie("gmail-lite_searches", "", 1); setcookie("gmail-lite_domain", "", 1); if (strpos($_SERVER["HTTP_HOST"],":")) $cookie_domain = substr($_SERVER["HTTP_HOST"],0,strpos($_SERVER["HTTP_HOST"],":")); else $cookie_domain = $_SERVER["HTTP_HOST"]; setcookie(GM_COOKIE_KEY, "", 1, "", $cookie_domain); setcookie(GM_COOKIE_IK_KEY, "", 1, "", $cookie_domain); print_headers(); ?> gmail-lite

gmail-lite
     Check Gmail with any browser on planet Earth.

This "lite" service is NOT provided by Gmail or Google.

".$erra[$err]."

\n"; if ($err != 19 and $err != 12 and $err != 99) { ?>

Username: add @yourDomain for 'Gmail for your domain' signin

Password:

Time zone: : from UTC (GMT)

 Remember me

'; */ /* } */ ?>

Latest gmail-lite News: