Esempio n. 1
0
 protected void btnTemplate_Click(object sender, EventArgs e)
 {
     if (txtTitle.Text != "" && txtDiscription.Text != "" && FileUpload1.HasFile)
     {
         string FileName  = FileUpload1.FileName.ToLower();
         string Extension = Path.GetExtension(FileName);
         if (Extension == ".jpg" || Extension == ".jpeg" || Extension == ".png")
         {
             double fileSize = FileUpload1.PostedFile.ContentLength;
             if (fileSize <= 2097152)
             {
                 if (de.AppsPermision(((CMSmaster)this.Master).RegID))
                 {
                     fileSize = fileSize / 1024;//bytes to kilobytes
                     var                   localPath = "image/" + ((CMSmaster)this.Master).RegID + "/";
                     var                   Path      = Server.MapPath("~/" + localPath);
                     StringGenarator       random    = new StringGenarator();
                     ECMS.WebPage.Settings settings  = new ECMS.WebPage.Settings();
                     random.Number      = true;
                     random.ApperCase   = true;
                     random.LowerCase   = true;
                     random.TotalString = settings.Get_InValue_Settings(10003);
                     string ImageName = random.RandomStringNumber("trmplateImage");
                     if (Directory.Exists(Path))
                     {
                         //-------- output
                         Output(localPath + ImageName + Extension, fileSize);
                     }
                     else
                     {
                         Directory.CreateDirectory(Path);
                         //---------- output
                         Output(localPath + ImageName + Extension, fileSize);
                     }
                 }
                 else
                 {
                     lblResult.Text = "<div class='alert alert-danger'>You are already insert Maximum Appication you can not add more applicaion. Add more Application<a href='#'> Click here </a> </div>";
                 }
             }
             else
             {
                 lblResult.Text = "<div class='alert alert-danger'>Upload Maximum 2MB image file.</div>";
             }
         }
         else
         {
             lblResult.Text = "<div class='alert alert-danger'>Upload your template image in *jpg *jpeg .png formate.</div>";
         }
     }
     else
     {
         lblResult.Text = "<div class='alert alert-danger'>Must be need title and discription to tenplate.</div>";
     }
 }
Esempio n. 2
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);
            }
        }