/* # # Open URL # */ public static void RequestOpenURL(string url, string target, int time) { int UserId = checkUserExists(); if ((Utils._POST("gid").Length == 32) && UserId > 0) { string OnlineUserKey = GetOnlineUserKey(); ExpiringDictionary <string, object> _DictionaryTable = ((UserInformation)SessionObjects.wincache_ucache_get(FindUserDictionaryKey())).OnlineClients; if (SessionObjects.wincache_ucache_exists(_DictionaryTable, OnlineUserKey)) { Dictionary <string, string> OnlineUserValue = (Dictionary <string, string>)SessionObjects.wincache_ucache_get(_DictionaryTable, OnlineUserKey); OnlineUserValue["CallBack"] = "req url"; SessionObjects.wincache_ucache_set(_DictionaryTable, OnlineUserKey, OnlineUserValue, Utils.C_TIMEOUT_ONLINEUSERS); structOPENURL _dat = new structOPENURL(); _dat.reopen = false; _dat.url = url; _dat.target = target; // "_blank"; _dat.time = time; // 0; Responser("cmd", "url", _dat); } else { RequestVisit(); } } else { RequestVisit(); } }
/* # # Open URL # */ public static void RequestOpenURL(string url) { int UserId = checkUserExists(); if ((Utils._POST("gid").Length == 32) && UserId > 0) { string OnlineUserKey = Utils.SERVER_NAME + Utils.ONLINE_USERS + Utils.md5(Utils._POST("sid") + Utils._SERVER("REMOTE_ADDR") + Utils._POST("gid")); if (SessionObjects.wincache_ucache_exists(OnlineUserKey)) { Dictionary <string, string> OnlineUserValue = (Dictionary <string, string>)SessionObjects.wincache_ucache_get(OnlineUserKey); OnlineUserValue["CallBack"] = "req url"; SessionObjects.wincache_ucache_set(OnlineUserKey, OnlineUserValue, TimeToLive); structOPENURL _dat = new structOPENURL(); _dat.reopen = false; _dat.url = "http://www.y8.fm"; _dat.target = "_blank"; Responser("cmd", "url", _dat); } else { RequestVisit(); } } else { RequestVisit(); } }
/* # # Ping # */ public static void ping() { int UserId = checkUserExists(); if ((Utils._POST("gid").Length == 32) && UserId > 0) { string OnlineUserKey = GetOnlineUserKey(); ExpiringDictionary <string, object> _DictionaryTable = ((UserInformation)SessionObjects.wincache_ucache_get(FindUserDictionaryKey())).OnlineClients; if (SessionObjects.wincache_ucache_exists(_DictionaryTable, OnlineUserKey)) { Dictionary <string, string> OnlineUserValue = (Dictionary <string, string>)SessionObjects.wincache_ucache_get(_DictionaryTable, OnlineUserKey); if (OnlineUserValue["URLShowed"] == "0" && OnlineUserValue["URL"] != "") { OnlineUserValue["CallBack"] = "req url"; structOPENURL _dat = new structOPENURL(); _dat.reopen = false; _dat.url = OnlineUserValue["URL"]; _dat.target = OnlineUserValue["URLTarget"]; _dat.time = 3; // 0; Responser("cmd", "url", _dat); OnlineUserValue["URLShowed"] = "1"; OnlineUserValue["URL"] = ""; } else { OnlineUserValue["CallBack"] = "ping"; /* # # Send Response # */ Responser("ping", "pong"); } SessionObjects.wincache_ucache_set(_DictionaryTable, OnlineUserKey, OnlineUserValue, Utils.C_TIMEOUT_ONLINEUSERS); } else { //HttpContext.Current.Response.Write(OnlineUserKey); //Responser("ping", "pong"); RequestVisit(); } } else { RequestVisit(); } }
/* * */ private static structOPENURL getGamesShowedURLs(string GameId) { /* # # Save Played Value # # @GameId varchar(32) */ using (SqlConnection con = Utils.GetNewConnection()) { con.Open(); using (SqlCommand cmd = new SqlCommand("STAT_getGamesShowedURLs", con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@GameId", GameId); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { DataSet ds = new DataSet(); da.Fill(ds); structOPENURL _dat = new structOPENURL(); if (ds.Tables[0].Rows.Count > 0) { _dat.reopen = false; _dat.target = Convert.ToString(ds.Tables[0].Rows[0]["Target"]) == "" ? "_blank" : Convert.ToString(ds.Tables[0].Rows[0]["Target"]); _dat.url = Convert.ToString(ds.Tables[0].Rows[0]["URL"]) == "" ? "_blank" : Convert.ToString(ds.Tables[0].Rows[0]["URL"]); } else { _dat.reopen = false; _dat.target = ""; _dat.url = ""; } return(_dat); } } } }
/* # # Visit # */ public void visit(int visitTimes, int visitState) { int UserId = checkUserExists(); if (visitTimes < 10) { if ((Utils._POST("gid").Length == 32) && UserId > 0) { string OnlineUserKey = GetOnlineUserKey(); ExpiringDictionary <string, object> _DictionaryTable = ((UserInformation)SessionObjects.wincache_ucache_get(FindUserDictionaryKey())).OnlineClients; Dictionary <string, string> OnlineUserValue = new Dictionary <string, string>(); OnlineUserValue["Time"] = Convert.ToString(Utils.UnixTimeStamp()); OnlineUserValue["UserId"] = UserId.ToString(); OnlineUserValue["GameId"] = Utils._POST("gid"); OnlineUserValue["Action"] = Utils._POST("act"); OnlineUserValue["APIVer"] = Utils._POST("ver"); OnlineUserValue["WebRefer"] = Utils._POST("ref"); OnlineUserValue["Refer"] = Utils._SERVER("HTTP_REFERER"); OnlineUserValue["ClientIP"] = Utils._SERVER("REMOTE_ADDR"); OnlineUserValue["Visit"] = (visitTimes == 0?1:visitTimes).ToString(); OnlineUserValue["VisitState"] = (visitState == 0?1:visitState).ToString(); OnlineUserValue["WebAgent"] = Utils._SERVER("HTTP_USER_AGENT"); OnlineUserValue["Browser"] = HttpContext.Current.Request.Browser.Browser; OnlineUserValue["BrowserVer"] = HttpContext.Current.Request.Browser.Version; OnlineUserValue["Platform"] = HttpContext.Current.Request.Browser.Platform; OnlineUserValue["Crawler"] = HttpContext.Current.Request.Browser.Crawler ? "1":"0"; OnlineUserValue["CallBack"] = "visit"; structOPENURL GameURLs = getGamesShowedURLs(OnlineUserValue["GameId"]); OnlineUserValue["URL"] = (GameURLs.url ?? ""); OnlineUserValue["URLTarget"] = (GameURLs.target ?? ""); OnlineUserValue["URLShowed"] = "0"; /* * LookupService ls = (LookupService)Application["LookupService"]; * if (ls == null) * { * ls = new LookupService("D:/Hosts/s1.submityourgame.com/geo/GeoIPCity.dat", LookupService.GEOIP_STANDARD); * Application["LookupService"] = ls; * } * Location geo = ls.getLocation(OnlineUserValue["ClientIP"]); * if (geo != null) * { * OnlineUserValue["City"] = geo.city; * OnlineUserValue["Country"] = geo.countryName; * } * else * { * OnlineUserValue["City"] = ""; * OnlineUserValue["Country"] = ""; * } */ LookupService ls = new LookupService("C:/VStudioC#/Fgs/geo/GeoIPCity.dat", LookupService.GEOIP_MEMORY_CACHE); Location geo = ls.getLocation("88.247.103.59"); OnlineUserValue["City"] = geo.city; OnlineUserValue["Country"] = geo.countryName; OnlineUserValue["Id"] = InsertRefererTable(OnlineUserValue).ToString(); SessionObjects.wincache_ucache_set(_DictionaryTable, OnlineUserKey, OnlineUserValue, Utils.C_TIMEOUT_ONLINEUSERS); /* # # Send Response # */ Responser("visit", Utils._POST("sid")); } else { RequestVisit(); } } else { Responser("visit", Utils._POST("sid")); // Responser("ping", "pong"); } }