PHP Script to block a page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • resmi318
    New Member
    • Jun 2007
    • 29

    PHP Script to block a page

    Hi,
    I am new to PHP. I had to block some pages from viewing by everyone. How can I do that?
    Thanks
    Resmi318
  • Purple
    Recognized Expert Contributor
    • May 2007
    • 404

    #2
    Hi resmi318 and welcome to TSDN!!

    Could you elaborate on your question - where is the page you want to block being served from - is it a page within a PHP app ? - do you want to block everyone from seeing it or allow a restricted level of access ?

    Purple

    Comment

    • resmi318
      New Member
      • Jun 2007
      • 29

      #3
      Originally posted by Purple
      Hi resmi318 and welcome to TSDN!!

      Could you elaborate on your question - where is the page you want to block being served from - is it a page within a PHP app ? - do you want to block everyone from seeing it or allow a restricted level of access ?

      Purple
      Hi Purple,

      I need to allow a restricted level of access. Actually I am totally new to PHP and website development. I didnt get what you mean by a page within a PHP app.

      Thanks
      Resmi318

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya, resmi318.

        You have a couple of options. If you need to block a page for certain IP addresses or domains, you should have a look at setting up .htaccess files.

        On the other hand, if you want to create a 'members-only' section on your website, you'll want to learn more about creating a PHP login script. The linked article is a little complicated at first glance, but if you take it slow, it should help you get started.

        Comment

        • eragon
          Contributor
          • Mar 2007
          • 431

          #5
          i have a working login script, it uses a session varaible. Basically put, you make a login page that sets a session varaible. Then you just throw this schnazzy little code in the top of your private pages that retreives the session varaible, determines if it it valid, and if it is it will display the page, if it is not valid, it will redirect the browser to a error page, or a login page, or a what the heck are you trying to do page. It is entirely customizeable, and it is really great. It saves the fact that the user is logged in untill the user goes to the logout page, or unless the user closes his/her browser. If you want the script, PM me.

          Comment

          • resmi318
            New Member
            • Jun 2007
            • 29

            #6
            Originally posted by eragon
            i have a working login script, it uses a session varaible. Basically put, you make a login page that sets a session varaible. Then you just throw this schnazzy little code in the top of your private pages that retreives the session varaible, determines if it it valid, and if it is it will display the page, if it is not valid, it will redirect the browser to a error page, or a login page, or a what the heck are you trying to do page. It is entirely customizeable, and it is really great. It saves the fact that the user is logged in untill the user goes to the logout page, or unless the user closes his/her browser. If you want the script, PM me.
            Hi,

            Thanks. I need the script. How can I PM you? What is your mail id?

            Thanks
            Resmi318

            Comment

            • resmi318
              New Member
              • Jun 2007
              • 29

              #7
              Originally posted by pbmods
              Heya, resmi318.

              You have a couple of options. If you need to block a page for certain IP addresses or domains, you should have a look at setting up .htaccess files.

              On the other hand, if you want to create a 'members-only' section on your website, you'll want to learn more about creating a PHP login script. The linked article is a little complicated at first glance, but if you take it slow, it should help you get started.
              Hi pbmods,
              Thanks. I will go through the sites mentioned by you.

              Resmi318

              Comment

              • eragon
                Contributor
                • Mar 2007
                • 431

                #8
                Originally posted by resmi318
                Hi,

                Thanks. I need the script. How can I PM you? What is your mail id?

                Thanks
                Resmi318
                you would click my name, and then click Private Message, but ill just post the code here so everybody can see it and use it...

                watch for my next post

                Comment

                • pbmods
                  Recognized Expert Expert
                  • Apr 2007
                  • 5821

                  #9
                  Originally posted by eragon
                  you would click my name, and then click Private Message, but ill just post the code here so everybody can see it and use it...
                  That sounds like an excellent idea.

                  Comment

                  • eragon
                    Contributor
                    • Mar 2007
                    • 431

                    #10
                    lol

                    :p lol

                    Comment

                    • resmi318
                      New Member
                      • Jun 2007
                      • 29

                      #11
                      Originally posted by eragon
                      you would click my name, and then click Private Message, but ill just post the code here so everybody can see it and use it...

                      watch for my next post
                      Hi eragon,

                      Waiting for the script.
                      Thanks

                      Resmi318

                      Comment

                      • eragon
                        Contributor
                        • Mar 2007
                        • 431

                        #12
                        Originally posted by resmi318
                        Hi eragon,

                        Waiting for the script.
                        Thanks

                        Resmi318
                        oh, terribly sorry, im making it an article... ill post a link when im done

                        Comment

                        • eragon
                          Contributor
                          • Mar 2007
                          • 431

                          #13
                          here you go:

                          Comment

                          • dafodil
                            Contributor
                            • Jul 2007
                            • 389

                            #14
                            There you go.... A session perfect for a secure access

                            Comment

                            • eragon
                              Contributor
                              • Mar 2007
                              • 431

                              #15
                              Originally posted by dafodil
                              There you go.... A session perfect for a secure access
                              so i suppose there are no flaws?

                              Comment

                              Working...