Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!AccessControl.IsLoggedIn(this))
     {
         Response.Redirect("Homepage.aspx");
     }
 }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!AccessControl.IsLoggedIn(this))
        {
            Response.Redirect("Homepage.aspx");
            return;
        }
        DataTable user = DataLink.GetUser(AccessControl.GetLoggedUser(this));

        formInputs = ContructInputs(
            GetFirstFromTable(user, "FirstName"),
            GetFirstFromTable(user, "LastName"),
            GetFirstFromTable(user, "ID"),
            GetFirstFromTable(user, "Email"));

        if (Request["submit"] != null)
        {
            string firstName = Request["firstName"];
            string lastName  = Request["lastName"];
            string password  = Request["userPassword"];
            string email     = Request["email"];
            string id        = Request["id"];

            if (email != GetFirstFromTable(user, "Email") && DataLink.IsEmailRegistered(email))
            {
                serverResponse = string.Format("'{0}' is already registered", email);
            }
            else if (id != GetFirstFromTable(user, "ID") && DataLink.IsIDRegistered(id))
            {
                serverResponse = string.Format("'{0}' is already registered", id);
            }
            else
            {
                DataLink.UpdateUser(GetFirstFromTable(user, "Email"), email, firstName, lastName, password, id);
                AccessControl.LogIn(this, email, DataLink.IsAdmin(email));
                WriteScript("alert('Data Updated')");
                // If we would have used Response.Redirect, it wouldn't have loaded the alert
                WriteScript("window.location = 'Homepage.aspx'");
            }
        }
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (AccessControl.IsLoggedIn(this.Page))
        {
            user = "******" + AccessControl.GetLoggedUser(this.Page);
            // all the buttons are invisible at first
            logoutButton.Visible  = true;
            updateButton.Visible  = true;
            galleryButton.Visible = true;
        }
        else
        {
            loginButton.Visible        = true;
            registrationButton.Visible = true;
        }

        if (AccessControl.IsAdmin(this.Page))
        {
            adminButton.Visible = true;
        }

        VisitorCounter.LogPageLoad(this.Page);
    }