BLL/User.cs

(开头部分) 2KB

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

using System;
using UAP;

namespace BLL
{
    public class User : UAP.User
    {
        public override bool onCheckLegal()
        {
            if (Current.HOST == "localhost")
            {
                //using (var db = UAP.DataBase.Get())
                //{
                //    db.Connect();
                //    UAP.User.LoginByData(db.getJson("select * from ec_users where id=1", 0));
                //}
            }
            return base.onCheckLegal();
        }

        public override void onForbidden(string loginUrl, string homeUrl)
        {
            UAP.Session.Set("redirectUrl", Current.Request.Url.PathAndQuery);
            Current.Response.Redirect("/Login");
        }


        public static string Login(string mobile, string pass)
        {
            using (var db = UAP.DataBase.Get())
            {
                db.Connect();
                try
                {
                    JSON users = db.getJson(string.Format("select * from  ec_users where mobile='{0}' and pass='{1}'", mobile.Replace("'", ""), pass.Replace("'", "")), 0);
                    if (users == null) throw new Exception("手机或密码有误");
                    UAP.User.LoginByData(users); 
                }
                catch (Exception ex)
                {
                    return ex.Message;
                }
            }
            return "ok";
        }


        public static string register(string mobile, string pass)
        {
            using (var db = UAP.DataBase.Get())
            {
                db.Connect();
                try
                {
                    JSON users = db.getJson(string.Format("select * from  ec_users where mobile='{0}'", mobile.Replace("'", "")), 0);
                    if (users != null) throw new Exception("手机[" + mobile + "]已被注册");
                    db.Insert("ec_users", true, new
                    {
                        mobile = mobile,
                        pass = pass,
后面还有 11 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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