Ejemplo n.º 1
0
        public string PasswordStrongMessege(string Password)
        {
            AntiInjection ant = new AntiInjection();

            ant.Password = true;
            if (ant.StringData(Password))
            {
                int  Minmum  = 8;
                int  length  = Password.Length;
                bool Symbol  = false;
                bool Capital = false;
                bool Smaill  = false;
                bool Number  = false;
                for (int i = 0; i < length; i++)
                {
                    if (Password[i] >= 32 && Password[i] <= 46 || Password[i] <= 64)
                    {
                        Symbol = true;
                    }
                    if (Password[i] >= 48 && Password[i] <= 57)
                    {
                        Number = true;
                    }
                    if (Password[i] >= 65 && Password[i] <= 90)
                    {
                        Capital = true;
                    }
                    if (Password[i] >= 97 && Password[i] <= 122)
                    {
                        Smaill = true;
                    }
                }

                if (length >= Minmum)
                {
                    if (Number && Capital && Smaill && Symbol)
                    {
                        PasswordRight = true;
                        return("<strong style='color:green;'>strong</strong>");
                    }
                    else
                    {
                        PasswordRight = false;
                        return("<strong style='color:red;'>week</strong>");
                    }
                }
                else
                {
                    PasswordRight = false;
                    return("<span style='color:red;'>8 to 20 char</span>");
                }
            }
            else
            {
                PasswordRight = false;
                return("<strong style='color:red;'>Harmful</strong>");
            }
        }
Ejemplo n.º 2
0
        private bool _UpdateDetails(UpdateClasses Details)
        {
            AntiInjection a = new AntiInjection();

            a.Url = true; a.FullName = true; a.Address = true;
            if (a.StringData(Details.FirstName) && a.StringData(Details.LastName) && a.StringData(Details.Region) && a.StringData(Details.Website) && a.StringData(Details.Discription))
            {
                bool returnVal = chk.ExcutionNonQuery("update DeveloperRegistation set Active='" + Details.Active + "',FastName='" + Details.FirstName + "',LastName='" + Details.LastName + "',Discription='" + Details.Discription + "', Website='" + Details.Website + "',Region='" + Details.Region + "',EmailShow='" + Details.EmailShow + "',NumberShow='" + Details.MobileShow + "' where Reg_ID=" + Details.RegID);
                Messege_ = chk.Messege;
                return(returnVal);
            }
            else
            {
                Messege_ = "Security Thread.";
                return(false);
            }
        }
Ejemplo n.º 3
0
        private bool _Reg()
        {
            AntiInjection ant = new AntiInjection();

            ant.Email    = true;
            ant.Password = true;
            ant.Url      = true;
            //------------------------------------------
            // anti injection for security purpass
            // it will secure the boolien methord
            //------------------------------------------
            if (ant.StringData(FirstName) &&
                ant.StringData(SureName) &&
                ant.StringData(Email) &&
                ant.StringData(UserName) &&
                ant.StringData(Password) &&
                ant.StringData(Mobile))
            {
                Security_ = true;

                /*---------------------------------
                 *   security is done now the insert and encript process
                 * ----------------------------------*/
                if (UserName_Avaiable(UserName) && Mobile_Avaiable(Mobile) && Email_Avaiable(Email))
                {
                    try
                    {
                        int  Max_App      = 2;/// Comming from main db settings
                        bool EmailVerify  = false;
                        bool MobileVerify = false;
                        //----------------------------------------------
                        Bind();
                        //-----------------------------------------------
                        //-----------------------------------------------
                        StringGenarator __ran = new StringGenarator();
                        __ran.TotalString = 10;/// setting update
                        //-------------------------------------------
                        __ran.Hexadecimal = true;
                        string Encrypt_Key = __ran.RandomStringNumber("DeveloperRegistation", 2, '-');
                        __ran.TotalString   = 5;
                        __ran.Number        = true;
                        __ran.Hexadecimal   = false;
                        __ran.DatabaseEntry = false;
                        string OTP = __ran.RandomStringNumber("OPT");
                        this.OTP            = OTP;
                        __ran.TotalString   = 20;
                        __ran.Number        = true;
                        __ran.ApperCase     = true;
                        __ran.DatabaseEntry = false;
                        string EmailCode = __ran.RandomStringNumber("EmailCode");
                        this.EmailCode = EmailCode;
                        //------------------------------------------------
                        //------------------------------------------------
                        Check    __Chk       = new Check();
                        IPFinder _IPLocation = new IPFinder();
                        //_IPLocation.IPDetails();
                        var          Offset = __Chk.stringCheck("select Offset from TimeZone where Time_Zone='" + _IPLocation.TimeZone + "' ");
                        DateTimeZone __Dt   = new DateTimeZone(Offset);
                        this.Offset = Offset;
                        Settings __Settings = new Settings();
                        var      MaxStorage = __Settings.Get_InValue_Settings(2);//Max Storage in Settings
                        this.MaxStorage = MaxStorage;
                        bool f1 = __Chk.ExcutionNonQuery(string.Format(@"insert into DeveloperRegistation (FastName,LastName,UserName,Email,Mobile,Country,Country_ID,Max_Apps,EmailVerify,MobileVerify,Profileimage,imagebyte,Active,EmailShow,NumberShow,JoinDate,AccountAbility,MaxStorage)
                        values('{0}','{1}','{2}','{3}','{4}','{5}',{6},{7},'{8}','{9}','{10}',{11},'{12}','{13}','{14}','{15}','{16}',{17})",
                                                                       FirstName, SureName, UserName, Email, Mobile, Country, __Chk.stringCheck("select Country_ID from Country where Country_Name='" + Country + "'"), Max_App, EmailCode, OTP, "image/Profile/noimage.jpg", 24576, "Online", "true", "true", __Dt.DateTimes(), "true", MaxStorage));
                        string _Registation_id = __Chk.stringCheck("select Reg_ID from DeveloperRegistation where UserName='******'");

                        //randomly add the encrypt key it unique
                        Encrypt __Enc = new Encrypt();
                        __Enc.EncryptCode = Encrypt_Key;
                        Key = Encrypt_Key;
                        // set the encript key to add database
                        string _UserName = __Enc.HashCode(UserName);
                        string _Password = __Enc.HashCode(Password);
                        bool   f2        = __Chk.ExcutionNonQuery(string.Format(@"insert into Login (Reg_ID,UserName,Password,Encrypt_Code) values({0},'{1}','{2}','{3}')", _Registation_id, _UserName, _Password, Encrypt_Key));
                        Messege_      = string.Format(@"<div class='alert alert-icon-success' role='alert'>
                                <i data-feather='alert-circle'></i>
                                   {0}
                             </div> ", "Registation Complete.");
                        _EmailVerify  = EmailVerify;
                        _MobileVerify = MobileVerify;

                        RegID   = __Chk.stringCheck("select Reg_ID from DeveloperRegistation where UserName='******' ");
                        LoginID = __Chk.stringCheck("select Login_ID from Login where UserName='******' ");
                        if (f1 && f2)
                        {
                            return(true);
                        }
                        else
                        {
                            Messege_ = string.Format(@"<div class='alert alert-icon-danger' role='alert'>
                                <i data-feather='alert-circle'></i>
                                   {0}
                             </div> ", __Chk.Messege);
                            return(false);
                        }
                    }
                    catch (Exception er)
                    {
                        Messege_ = string.Format(@"<div class='alert alert-icon-danger' role='alert'>
                                <i data-feather='alert-circle'></i>
                                   {0}
                             </div> ", er.Message);
                        return(false);
                    }
                }
                else
                {
                    Messege_ = @"<div class='alert alert-icon-danger' role='alert'>
                                <i data-feather='alert-circle'></i>
                                   (Verify your Email, UserName, Moble)
                                   If All are not Avaiable. Try again!
                             </div> ";
                    return(false);
                }
            }
            else
            {
                Messege_ = @"<div class='alert alert-icon-danger' role='alert'>
                                <i data-feather='alert-circle'></i>
                                   Security Threat.
                             </div> ";
                return(false);
            }
        }