Web/Tools/addPhoto.ashx.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.SessionState;
using System.Data;
using Common;
using System.Text;
using System.Drawing;
using System.IO;
namespace Web.Tools
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    public class addPhoto : IHttpHandler, IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            //context.Response.Write(password);如果使用加密,则写入数据库要加密后的字段,然后登陆的时候就用加密后的字符串匹配
            //此处连接数据库查看是否有此用户,此处为了方便起见,直接判断
            BLL.Member bll = new BLL.Member();
            Model.Member model = new Model.Member();
            if (context.Request.ServerVariables["REQUEST_METHOD"] == "POST")
            {
                 Model.MembersSet MembersConfig = new BLL.MembersSet().loadConfig(Utils.GetXmlMapPath("MembersConfigpath"));
                //文件类型
                string imageType = context.Request.Form["image_type"].Trim() ;
                //大头像内容
                string bigAvatarContent = context.Request.Form["big_avatar"].Trim();
                //string bigAvatarName = context.Request.Form["big_avatar_name"].Trim();
                //string bigAvatarName = "avatar_big";
                byte[] imgbyte = Convert.FromBase64String(bigAvatarContent);
                System.IO.MemoryStream ms = new System.IO.MemoryStream(imgbyte);
                System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
                int id=int.Parse(HttpContext.Current.Session["MemberLogin_Id"].ToString());
                string fileUrl = id+ "180180" + DateTime.Now.ToString("yyyyMMddHHmmssff") + imageType; //随机文件名
                //大头像名称
                string fileName = "/UpLoadFiles/member/"+fileUrl;
                //保存大头像
                img.Save(Utils.GetMapPath(fileName), System.Drawing.Imaging.ImageFormat.Jpeg);
                img.Dispose();
                model = bll.GetModel(id);
                if (model.IsTou==0)
                {
                    bll.UpdateField(id,"istou=1");
                    bll.UpdateField(id, "ImgUrl='" + fileName + "'");
                    bll.UpdateField(id, "Ubuy=Ubuy+" + MembersConfig.TouUbuy + "");
                    bll.UpdateField(id, "Integral=" + MembersConfig.TouIntegral + "");
                    model = bll.GetModel(id);
                    ActionLabel.Contents.InsertData(id, "上传头像", "赚取", model.Ubuy, MembersConfig.TouUbuy);
                }
                else
                {
                    bll.UpdateField(id, "ImgUrl='" + fileName + "'");
                }
                ////中头像内容
                //string middleAvatarContent = context.Request.Form["middle_avatar"].Trim(); ;
                ////中头像名称
                ////middleAvatarName = Trim(Request.form("middle_avatar_name"))
后面还有 22 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。