protected void Save_Click(object sender, EventArgs e)
        {
            string keydir = serverpath + "\\Handlers\\bf.pke";

            if (File.Exists(keydir))
            {
                StreamReader streamReader = new StreamReader(keydir, true);
                file_string = streamReader.ReadToEnd();
                streamReader.Close();
                if (file_string != null)
                {
                    string bitStrengthString = file_string.Substring(0, file_string.IndexOf("</BitStrength>") + 14);
                    file_string = file_string.Replace(bitStrengthString, "");
                }
            }
            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
            Odyssey.Odyssey ody  = new Odyssey.Odyssey();
            string          pass = "******";

            this.regID = this.z.a_regadmin(this.xname.Text, this.xrole.SelectedValue, ody.EncryptString(this.xemail.Text, file_len, file_string), this.xtelephone1.Text, this.xtelephone2.Text, "tm", this.pwalletID, ody.EncryptString(pass, file_len, file_string));
            if (this.regID != "0")
            {
                this.x_add_tbl  = 0;
                this.x_add_succ = 1;
            }
        }
        protected void getAdmins_SelectedIndexChanged(object sender, EventArgs e)
        {
            string keydir = serverpath + "Handlers\\bf.kez";

            if (File.Exists(keydir))
            {
                StreamReader streamReader = new StreamReader(keydir, true);
                file_string = streamReader.ReadToEnd();
                streamReader.Close();
                if (file_string != null)
                {
                    string bitStrengthString = file_string.Substring(0, file_string.IndexOf("</BitStrength>") + 14);
                    file_string = file_string.Replace(bitStrengthString, "");
                }
            }
            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
            Odyssey.Odyssey ody = new Odyssey.Odyssey();
            this.ad = this.z.getAdminDetails(this.getAdmins.SelectedValue);
            this.edit_xname.Text           = this.ad.xname;
            this.edit_xpass.Text           = ody.DecryptString(this.ad.xpass, file_len, file_string);
            this.edit_xemail.Text          = ody.DecryptString(this.ad.xemail, file_len, file_string);
            this.edit_telephone1.Text      = this.ad.xtelephone1;
            this.edit_telephone2.Text      = this.ad.xtelephone2;
            this.edit_xrole.SelectedIndex  = Convert.ToInt16(this.ad.xroleID) - 1;
            this.edit_status.SelectedIndex = Convert.ToInt16(this.ad.xvisible);
            this.enable_EditTbl            = "1";
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.serverpath = base.Server.MapPath("~/");
            string keydir = serverpath + "Handlers\\bf.kez";

            if (File.Exists(keydir))
            {
                StreamReader streamReader = new StreamReader(keydir, true);
                file_string = streamReader.ReadToEnd();
                streamReader.Close();
                if (file_string != null)
                {
                    string bitStrengthString = file_string.Substring(0, file_string.IndexOf("</BitStrength>") + 14);
                    file_string = file_string.Replace(bitStrengthString, "");
                }
            }
            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
            Odyssey.Odyssey ody = new Odyssey.Odyssey();

            if (this.Session["pwalletID"] != null)
            {
                if (this.Session["pwalletID"].ToString() != "")
                {
                    this.admin = this.Session["pwalletID"].ToString();
                }
                else
                {
                    base.Response.Redirect("./xcontrol.aspx");
                }
            }
            else
            {
                base.Response.Redirect("./xcontrol.aspx");
            }
            if (!base.IsPostBack)
            {
                this.ad = this.z.getTopAdminDetails2();
                this.edit_xname.Text           = this.ad.xname;
                this.edit_xpass.Text           = ody.DecryptString(this.ad.xpass, file_len, file_string);
                this.edit_xemail.Text          = ody.DecryptString(this.ad.xemail, file_len, file_string);
                this.edit_telephone1.Text      = this.ad.xtelephone1;
                this.edit_telephone2.Text      = this.ad.xtelephone2;
                this.edit_xrole.SelectedIndex  = Convert.ToInt16(this.ad.xroleID) - 1;
                this.edit_status.SelectedIndex = Convert.ToInt16(this.ad.xvisible);
            }
        }
        protected void EditSave_Click(object sender, EventArgs e)
        {
            string keydir = serverpath + "\\Handlers\\bf.pke";

            if (File.Exists(keydir))
            {
                StreamReader streamReader = new StreamReader(keydir, true);
                file_string = streamReader.ReadToEnd();
                streamReader.Close();
                if (file_string != null)
                {
                    string bitStrengthString = file_string.Substring(0, file_string.IndexOf("</BitStrength>") + 14);
                    file_string = file_string.Replace(bitStrengthString, "");
                }
            }
            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
            Odyssey.Odyssey ody = new Odyssey.Odyssey();
            if (this.z.e_regadmin(this.edit_xname.Text, ody.EncryptString(this.edit_xpass.Text, file_len, file_string), this.edit_xrole.SelectedValue, ody.EncryptString(this.edit_xemail.Text, file_len, file_string), this.edit_telephone1.Text, this.edit_telephone2.Text, "tm", this.pwalletID, this.getAdmins.SelectedValue, this.edit_status.SelectedValue) > 0)
            {
                this.x_edit_tbl  = 0;
                this.x_edit_succ = 1;
            }
        }
Exemple #5
0
 public string a_xadminz(string uname, string xpass, string serverpath)
 {
     List<Adminz> list = new List<Adminz>();
     string xmlString = "Xavier";
     int dwKeySize = 0x400;
     string path = serverpath + @"\Handlers\bf.kez";
     if (File.Exists(path))
     {
         StreamReader reader = new StreamReader(path, true);
         xmlString = reader.ReadToEnd();
         reader.Close();
         if (xmlString != null)
         {
             string oldValue = xmlString.Substring(0, xmlString.IndexOf("</BitStrength>") + 14);
             xmlString = xmlString.Replace(oldValue, "");
         }
     }
     Odyssey odyssey = new Odyssey();
     string str4 = this.Connect();
     string str5 = "";
     SqlConnection connection = new SqlConnection(this.Connect());
     SqlCommand command = new SqlCommand("select xID,xemail,xpass from xadminz_tm where xvisible='1' ", connection);
     connection.Open();
     SqlDataReader reader2 = command.ExecuteReader(CommandBehavior.CloseConnection);
     while (reader2.Read())
     {
         Adminz item = new Adminz {
             xID = reader2["xID"].ToString(),
             xemail = reader2["xemail"].ToString(),
             xpass = reader2["xpass"].ToString()
         };
         list.Add(item);
     }
     reader2.Close();
     string str6 = "";
     string str7 = "";
     for (int i = 0; i < list.Count; i++)
     {
         str7 = odyssey.DecryptString(list[i].xemail, dwKeySize, xmlString);
         str6 = odyssey.DecryptString(list[i].xpass, dwKeySize, xmlString);
         if ((uname == str7) && (xpass == str6))
         {
             str5 = list[i].xID.ToString();
         }
     }
     return str5;
 }