예제 #1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (IsHaveRightByOperCode("Edit"))
     {
         M_PostConfig.Email      = this.txtEmail.Text;
         M_PostConfig.Password   = DesSecurity.DesEncrypt(this.txtPassword.Text, "emailpwd");
         M_PostConfig.SmtpServer = this.txtSmtpServer.Text;
         M_PostConfig.Port       = this.txtPort.Text;
         Post.ConfigInfo         = M_PostConfig;
         bool   b           = Post.SaveConfig(PhyFilePath);
         string memberValue = "0";
         string mailValue   = "0";
         if (chkIsMember.Checked)
         {
             memberValue = "1";
         }
         if (chkIsEmail.Checked)
         {
             mailValue = "1";
         }
         bool b1 = Utils.XmlUpdate(hrFilePath, "HRConfig/IsMember", "", memberValue);
         bool b2 = Utils.XmlUpdate(hrFilePath, "HRConfig/IsSendToEmail", "", mailValue);
         Utils.XmlUpdate(hrFilePath, "HRConfig/EMailTitle", "", txtEMailTitle.Text);
         Utils.XmlCDATAUpdate(hrFilePath, "HRConfig/EMailContent", txtEMailContent.Content);
         if (!b)
         {
             Utils.RunJavaScript(this, "alert({msg:'设置失败," + PhyFilePath.Replace("\\", "\\\\") + "文件没有修改权限!',status: '2', title: '提示信息', time: 10000, width: 400})");
             return;
         }
         if (!b1)
         {
             Utils.RunJavaScript(this, "alert({msg:'设置失败," + hrFilePath.Replace("\\", "\\\\") + "文件没有修改权限!',status: '2', title: '提示信息', time: 10000, width: 400})");
             return;
         }
         WriteLog("人力资源参数设置成功!", "", 2);
         Utils.RunJavaScript(this, "alert({msg:'设置成功!',title:'提示信息'})");
     }
     else
     {
         Utils.RunJavaScript(this, "alert({msg:'你没有设置的权限,请联系站点管理员!',title:'提示信息'})");
     }
 }
예제 #2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (IsHaveRightByOperCode("Edit"))
     {
         M_PostConfig.Email      = this.txtEmail.Text;
         M_PostConfig.Password   = DesSecurity.DesEncrypt(this.txtPassword.Text, "emailpwd");
         M_PostConfig.SmtpServer = this.txtSmtpServer.Text;
         M_PostConfig.Port       = this.txtPort.Text;
         Post.ConfigInfo         = M_PostConfig;
         bool b = Post.SaveConfig(PhyFilePath);
         if (!b)
         {
             Utils.RunJavaScript(this, "alert({msg:'站点信息设置失败," + PhyFilePath.Replace("\\", "\\\\") + "文件没有修改权限!',status: '2', title: '提示信息', time: 10000, width: 400})");
             return;
         }
         WriteLog("邮件参数设置成功!", "", 2);
         Utils.RunJavaScript(this, "alert({msg:'邮件参数设置成功!',title:'提示信息'})");
     }
     else
     {
         Utils.RunJavaScript(this, "alert({msg:'你没有修改邮箱设置的权限,请联系站点管理员!',title:'提示信息'})");
     }
 }
    public IEnumerator send()
    {
        string jsonContent = _data.toJson();

        string encodedJson = jsonContent;

        if (_formKey == "data")
        {
            encodedJson = DesSecurity.DesEncrypt(jsonContent, encoded_key);
        }

        WWWForm form = new WWWForm();

        form.AddField("deviceId", getDeviceID());
        form.AddField("openId", getOpenID());
        form.AddField(_formKey, encodedJson);

        if (_formKey == "data" && _data != null && _data.ContainsKey("cmd"))
        {
            form.AddField("cmd", _data["cmd"].ToString());
        }
        else
        {
            form.AddField("cmd", "bi");
        }

        //form.AddField("debug", "1");
        form.AddField("auth", _authCode.ToString());

        int userID = getUserID();

        if (userID != -1)
        {
            form.AddField("userId", userID.ToString());
        }

        string serverUrl = _formKey == "data" ? AppSettings.gameServerUrl : AppSettings.biServerUrl;

        WWW getData = new WWW(serverUrl, form);

        yield return(getData);

        if (getData.error == null)
        {
            //string result = getData.text;
            string result = DesSecurity.DesDecrypt(getData.text, encoded_key);

            // Cache UID
            Dictionary <string, object> dataDict = result.dictionaryFromJson();
            if (dataDict != null && dataDict.ContainsKey("userId"))
            {
                int uid = Convert.ToInt32(dataDict["userId"]);
                Debug.Log("Cache User ID: " + uid.ToString());
                setUserID(uid);
            }

            // verify auth code
            bool verifyOK = true;
            if (dataDict.ContainsKey("auth"))
            {
                int returnAuthCode = Convert.ToInt32(dataDict["auth"]);
                if (returnAuthCode != _authCode)
                {
                    verifyOK = false;
                }
            }

            if (dataDict.ContainsKey("cheat"))
            {
                int cheat = Convert.ToInt32(dataDict["cheat"]);
                PlayerPrefs.SetInt("cheat", cheat);
            }

            if (verifyOK && _successDelegate != null && dataDict.ContainsKey("data"))
            {
                Dictionary <string, object> dict = dataDict["data"] as Dictionary <string, object>;
                _successDelegate(dict.toJson());
            }
            else if (!verifyOK && _failDelgate != null)
            {
                _failDelgate();
            }

            Destroy(this.gameObject);
        }
        else
        {
            if (_failDelgate != null)
            {
                _failDelgate();
            }
            Debug.Log(getData.error);

            Destroy(this.gameObject);
        }
    }
예제 #4
0
        /// <summary>
        /// 保存日志:[email protected]
        /// </summary>
        /// <param Name="Content">日志内容</param>
        /// <param Name="PostContent">提交内容</param>
        /// <param Name="LogType">日志类型,1=登录日志,2=操作日志,3=错误日志</param>
        public void WriteLog(string Content, string PostContent, int LogType)
        {
            string ip         = Utils.GetIP();                                                                                                                  //IP地址
            string ScriptName = HttpContext.Current.Request.ServerVariables["SCRIPT_NAME"] + "?" + HttpContext.Current.Request.ServerVariables["QUERY_STRING"]; //提交的页面地址
            //string ScriptName = HttpContext.Current.Request.Url.ToString (); //提交的页面地址
            //int urlNum = ScriptName.IndexOf(HttpContext.Current.Request.ServerVariables["SCRIPT_NAME"]);
            //if (urlNum > 0)
            //    ScriptName = ScriptName.Substring(urlNum);

            SiteParamConfig pci = SiteParam.GetConfig(GetSiteParamPath);

            if (pci.LogType == "0")  //保存到数据库
            {
                KingTop.Model.SysManage.SysLog objlog    = new KingTop.Model.SysManage.SysLog();
                KingTop.BLL.SysManage.SysLog   objBllLog = new KingTop.BLL.SysManage.SysLog();
                objlog.IP      = ip;
                objlog.Content = Content;
                objlog.LogType = LogType;

                // objlog.NodeId = NodeId;

                objlog.NodeCode = NodeCode;

                objlog.PostContent = PostContent;
                objlog.ScriptName  = ScriptName;
                objlog.SiteID      = SiteID;
                objlog.UserNo      = UserNo;
                objBllLog.Save("NEW", objlog);
            }
            else  //保存到文件
            {
                string       logPath  = pci.LogDir;
                StreamWriter sw       = null;
                DateTime     date     = DateTime.Now;
                string       FileName = date.Year + "-" + date.Month;
                if (logPath.IndexOf(":") == -1)     //相对路径
                {
                    if (logPath.Trim().Length == 0) //路径为空
                    {
                        logPath = "Logs";
                    }
                    logPath = HttpContext.Current.Server.MapPath("~/" + logPath);
                }

                try
                {
                    FileName = logPath + "/" + UserNo + "_" + FileName + "-" + DesSecurity.DesEncrypt(FileName, "hqbonline") + "-s.log";

                    #region 检测日志目录是否存在

                    if (!Directory.Exists(logPath))
                    {
                        Directory.CreateDirectory(logPath);
                    }

                    if (!File.Exists(FileName))
                    {
                        sw = File.CreateText(FileName);
                    }
                    else
                    {
                        sw = File.AppendText(FileName);
                    }
                    #endregion

                    sw.WriteLine("[NodeCode]       :" + NodeCode + "\r");
                    sw.WriteLine("[SiteID]       :" + SiteID + "\r");
                    sw.WriteLine("[Content]      :" + Content);
                    sw.WriteLine("[AddDate]      :" + date.ToString("yyyy-MM-dd hh:mm:ss") + "\r");
                    sw.WriteLine("[UserNo]       :" + UserNo + "\r");
                    sw.WriteLine("[IP]           :" + ip + "\r");
                    sw.WriteLine("[ScriptName]   :" + ScriptName + "\r");
                    sw.WriteLine("[PostContent]  :" + PostContent + "\r");
                    sw.WriteLine("[LogType]      :" + LogType + "\r");
                    sw.WriteLine("≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\r");
                    sw.Flush();
                }
                finally
                {
                    if (sw != null)
                    {
                        sw.Close();
                    }
                }
            }
        }