Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Configuration config = new Configuration();

            conn    = config.getConnectionString();
            connect = new SqlConnection(conn);
            getSession();
            //Get from and to pages:
            string current_page = "", previous_page = "";

            if (HttpContext.Current.Request.Url.AbsoluteUri != null)
            {
                current_page = HttpContext.Current.Request.Url.AbsoluteUri;
            }
            if (Request.UrlReferrer != null)
            {
                previous_page = Request.UrlReferrer.ToString();
            }
            //Get current time:
            DateTime currentTime = DateTime.Now;
            //Get user's IP:
            string            userIP  = GetIPAddress();
            CheckAdminSession session = new CheckAdminSession();
            bool correctSession       = session.sessionIsCorrect(username, roleId, token, current_page, previous_page, currentTime, userIP);

            if (!correctSession)
            {
                clearSession();
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Configuration config = new Configuration();

            conn    = config.getConnectionString();
            connect = new SqlConnection(conn);
            getSession();
            CheckAdminSession session = new CheckAdminSession();
            bool correctSession       = session.sessionIsCorrect(username, roleId, token);

            if (!correctSession)
            {
                clearSession();
            }
            if (!IsPostBack)
            {
                fillDropLists();
                focusOnStoredQuestions();
                if (Request.UrlReferrer != null)
                {
                    previousPage = Request.UrlReferrer.ToString();
                }
                else
                {
                    previousPage = "Home.aspx";
                }
            }
        }
Пример #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     getSession();
     if (!IsPostBack)
     {
         //Get from and to pages:
         string current_page = "", previous_page = "";
         if (HttpContext.Current.Request.Url.AbsoluteUri != null)
         {
             current_page = HttpContext.Current.Request.Url.AbsoluteUri;
         }
         if (Request.UrlReferrer != null)
         {
             previous_page = Request.UrlReferrer.ToString();
         }
         //Get current time:
         DateTime currentTime = DateTime.Now;
         //Get user's IP:
         string            userIP  = GetIPAddress();
         CheckAdminSession session = new CheckAdminSession();
         bool correctSession       = session.sessionIsCorrect(username, roleId, token, current_page, previous_page, currentTime, userIP);
         if (!correctSession)
         {
             clearSession();
         }
         if (Request.UrlReferrer != null)
         {
             previousPage = Request.UrlReferrer.ToString();
         }
         else
         {
             previousPage = "Home.aspx";
         }
     }
 }
Пример #4
0
        protected void initialAccess()
        {
            Configuration config = new Configuration();

            conn    = config.getConnectionString();
            connect = new SqlConnection(conn);
            getSession();
            //Get from and to pages:
            string currentPage = "", previousPage = "";

            if (HttpContext.Current.Request.Url.AbsoluteUri != null)
            {
                currentPage = HttpContext.Current.Request.Url.AbsoluteUri;
            }
            if (Request.UrlReferrer != null)
            {
                previousPage = Request.UrlReferrer.ToString();
            }
            //Get current time:
            DateTime currentTime = DateTime.Now;
            //Get user's IP:
            string userIP = GetIPAddress();

            Accounts.Admin.CheckAdminSession session = new Accounts.Admin.CheckAdminSession();
            bool correctSession = session.sessionIsCorrect(username, roleId, token, currentPage, previousPage, currentTime, userIP);

            if (!correctSession)
            {
                clearSession();
            }
            lblAlerts.Text = "Alerts (" + countTotalAlerts() + ")";
            lblName.Text   = getName();
        }
Пример #5
0
        protected void initialPageAccess()
        {
            Configuration config = new Configuration();

            conn    = config.getConnectionString();
            connect = new SqlConnection(conn);
            getSession();
            CheckAdminSession session = new CheckAdminSession();
            bool correctSession       = session.sessionIsCorrect(username, roleId, token);

            if (!correctSession)
            {
                clearSession();
            }

            if (session.countTotalAlerts() == 0)
            {
                lblError.Visible = true;
                lblError.Text    = "There are no new alerts!";
            }
            else
            {
                lblError.Visible = false;
            }
        }
Пример #6
0
        protected void initialAccess()
        {
            Configuration config = new Configuration();

            conn    = config.getConnectionString();
            connect = new SqlConnection(conn);
            getSession();
            CheckAdminSession session = new CheckAdminSession();
            bool correctSession       = session.sessionIsCorrect(username, roleId, token);

            if (!correctSession)
            {
                clearSession();
            }
        }
Пример #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Configuration config = new Configuration();

            conn    = config.getConnectionString();
            connect = new SqlConnection(conn);
            getSession();
            CheckAdminSession session = new CheckAdminSession();
            bool correctSession       = session.sessionIsCorrect(username, roleId, token);

            if (!correctSession)
            {
                clearSession();
            }
        }
Пример #8
0
        protected void initialPageAccess()
        {
            Configuration config = new Configuration();

            conn    = config.getConnectionString();
            connect = new SqlConnection(conn);
            getSession();
            CheckAdminSession session = new CheckAdminSession();
            bool correctSession       = session.sessionIsCorrect(username, roleId, token);

            if (!correctSession)
            {
                clearSession();
            }
            //lblAlerts.Text = "(" + session.countTotalAlerts() + ")";
        }
Пример #9
0
        protected void initialPageAccess()
        {
            Configuration config = new Configuration();

            conn    = config.getConnectionString();
            connect = new SqlConnection(conn);
            getSession();
            //Get from and to pages:
            string current_page = "", previous_page = "";

            if (HttpContext.Current.Request.Url.AbsoluteUri != null)
            {
                current_page = HttpContext.Current.Request.Url.AbsoluteUri;
            }
            if (Request.UrlReferrer != null)
            {
                previous_page = Request.UrlReferrer.ToString();
            }
            //Get current time:
            DateTime currentTime = DateTime.Now;
            //Get user's IP:
            string            userIP  = GetIPAddress();
            CheckAdminSession session = new CheckAdminSession();
            bool correctSession       = session.sessionIsCorrect(username, roleId, token, current_page, previous_page, currentTime, userIP);

            if (!correctSession)
            {
                clearSession();
            }

            if (session.countTotalAlerts() == 0)
            {
                lblError.Visible = true;
                lblError.Text    = "There are no new alerts!";
            }
            else
            {
                lblError.Visible = false;
            }
        }
Пример #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Configuration config = new Configuration();

            conn    = config.getConnectionString();
            connect = new SqlConnection(conn);
            getSession();
            CheckAdminSession session = new CheckAdminSession();
            bool correctSession       = session.sessionIsCorrect(username, roleId, token);

            if (!correctSession)
            {
                clearSession();
            }
            //if (IsPostBack && FileUpload1.PostedFile != null)
            //{
            //    if (FileUpload1.PostedFile.FileName.Length > 0)
            //    {
            //        showFileNames();
            //    }
            //}
        }
Пример #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Configuration config = new Configuration();

            conn    = config.getConnectionString();
            connect = new SqlConnection(conn);
            getSession();
            //Get from and to pages:
            string current_page = "", previous_page = "";

            if (HttpContext.Current.Request.Url.AbsoluteUri != null)
            {
                current_page = HttpContext.Current.Request.Url.AbsoluteUri;
            }
            if (Request.UrlReferrer != null)
            {
                previous_page = Request.UrlReferrer.ToString();
            }
            //Get current time:
            DateTime currentTime = DateTime.Now;
            //Get user's IP:
            string            userIP  = GetIPAddress();
            CheckAdminSession session = new CheckAdminSession();
            bool correctSession       = session.sessionIsCorrect(username, roleId, token, current_page, previous_page, currentTime, userIP);

            if (!correctSession)
            {
                clearSession();
            }
            topicId = Request.QueryString["id"];
            CheckErrors check = new CheckErrors();

            if (!check.isDigit(topicId))
            {
                goBack();
            }
            int  pageNum       = Convert.ToInt32(Request.QueryString["page"]);
            bool topicApproved = isTopicApproved();

            if (!topicApproved)
            {
                topicNotApproved();
            }
            bool authorized = isUserAuthorizedToView();

            if (!authorized)
            {
                unauthorized();
            }
            showInformation(pageNum);
            checkIfTerminated();
            checkIfDeleted();
            if (!IsPostBack)
            {
                if (!requestedRemoveTopic && !requestedRemoveMessage && !requestedReportMessage)
                {
                    if (HttpContext.Current.Request.Url.AbsoluteUri != null)
                    {
                        currentPage = HttpContext.Current.Request.Url.AbsoluteUri;
                    }
                    else
                    {
                        currentPage = "Home.aspx";
                    }
                    if (Request.UrlReferrer != null)
                    {
                        previousPage = Request.UrlReferrer.ToString();
                    }
                    else
                    {
                        previousPage = "Home.aspx";
                    }
                    if (currentPage.Equals(previousPage))
                    {
                        previousPage = "Home.aspx";
                    }
                }
            }
        }