Photo Gallery Website

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rcollins
    New Member
    • Aug 2006
    • 234

    Photo Gallery Website

    I have a daughter and son in law in iraq. I am taking care of the grandbaby till they get back. There are so many family members and them over seas that I fealt a web site where they all can access them would be a very good idea. I have a domain name already, made my front page. On the main page there is a link to nothing, because this is where I want to control access with passwords. I right most of my code in straight html using css. I have no clue how to do the secure part. Can someone point me in the right direction?
  • eWish
    Recognized Expert Contributor
    • Jul 2007
    • 973

    #2
    This must be done with a server side language or by using your web server. If you would like I can move this post to the fourm of your choice. Sorry, but this is not an HTML/CSS issue.

    --Kevin

    Comment

    • rcollins
      New Member
      • Aug 2006
      • 234

      #3
      I wasn't sure where to put this one, you can move me...I need help

      Comment

      • eWish
        Recognized Expert Contributor
        • Jul 2007
        • 973

        #4
        How do you wish to achieve this? Do you know any server side languages, ie: PHP, Perl, ASP, Ruby? Please advise me of where you would like this post moved to and I will be glad to do that for you. There many pre-made script available online for free. Search for Free Login Scripts.

        --Kevin

        Comment

        • rcollins
          New Member
          • Aug 2006
          • 234

          #5
          I know some php, that is what we learned in my 3rd website class in college,,and I have books, too

          Comment

          • Markus
            Recognized Expert Expert
            • Jun 2007
            • 6092

            #6
            Originally posted by rcollins
            I know some php, that is what we learned in my 3rd website class in college,,and I have books, too
            Read up on php then - check out some phptutorials().

            It's definitely - in my oppinion ;) - the best way to go.

            Shouldn't take you long to brush up on the basics.

            And by the sounds of it, all you'll need is the basics.

            Once you've learnt the basics, you won't want to stop!

            Deadly cycle, trust me!

            Comment

            • hsriat
              Recognized Expert Top Contributor
              • Jan 2008
              • 1653

              #7
              Originally posted by rcollins
              I have a daughter and son in law in iraq. I am taking care of the grandbaby till they get back. There are so many family members and them over seas that I fealt a web site where they all can access them would be a very good idea. I have a domain name already, made my front page. On the main page there is a link to nothing, because this is where I want to control access with passwords. I right most of my code in straight html using css. I have no clue how to do the secure part. Can someone point me in the right direction?
              If this is your only need from PHP, then its not a big task.

              I see your need is just to show your pictures to few of your family members. I'll just give a short script and you can use that.


              index.php (add this somewhere in your main page and name your page as index.php)[html]<form action="picture s.php" method="post">
              Id:<input name="id" type="text" /><br />
              Password:<input name="password" type="password" /><br />
              <input name="login" type="submit" value="Submit" />
              </form>[/html]


              pictures.php[php]<?php

              require ("ids.php");

              if (isset($_COOKIE["viewer_id"]) && isset($_COOKIE["viewer_passwor d"]))
              if ($_COOKIE["viewer_passwor d"] == md5($passwords[array_search($_ COOKIE["viewer_id"], $ids)]))
              {
              show_list_page( );
              exit();
              }

              if (isset($_POST["login"]) && isset($_POST["id"]) && isset($_POST["password"]))
              if (in_array($_POS T["id"], $ids))
              if ($_POST["password"]==$passwords[array_search($_ POST["id"], $ids)])
              {

              $hour = time() + 86400; //FOR 24 HOURS
              setcookie("view er_id", $_POST["id"], $hour);
              setcookie("view er_password", md5($_POST["password"]), $hour);

              show_list_page( );
              exit();
              }

              header ("location:inde x.php");

              function show_list_page( )
              {

              ?>

              <!-- copy here the HTML that contains the list and links to all the pictures -->

              <?php
              }[/php]

              logout.php (Link this somewhere in pictures.php)[php]<?php
              $past = time() - 100;
              setcookie("view er_id", "", $past);
              setcookie("view er_password", "", $past);
              header("locatio n:index.php");
              ?>[/php]

              ids.php[php]<?php
              $ids = array(
              "my_id",
              "your_id",
              "his_id",
              "her_id"
              );
              $passwords = array(
              "my_passwor d",
              "your_password" ,
              "his_passwo rd",
              "her_passwo rd"
              );
              ?>[/php]This ids.php contains the list of all the ids and passwords which you can give your relatives. You can add ids and passwords in it, but you would need to be careful that the serial order remains respective.

              The only limitations are, user can't himself change the password and you may not have TOO many ids and passwords.

              I have not tested it, so if any problem is there, do let me know.

              Regards,
              Harpreet

              Comment

              • rcollins
                New Member
                • Aug 2006
                • 234

                #8
                so, instead of trying to put this in my code, I figured I can add my code to this. The problem I am having, and this is just copying and pasting the info into the three new files, is that when I try to open .php files it prompts me to open or save. This is a continuous circle. Can you test it and see what is wrong? Thanks

                Comment

                • miraan
                  New Member
                  • Apr 2008
                  • 24

                  #9
                  This is because you are trying to access the files from your local computer. First you need to upload these three files to your domain which you said you had, make sure that the webserver that your domain is on supports php though otherwise it will not work. Most webservers have php installed so that is not really an issue. To upload some files just find your FTP details given to you by your webhosting company in a welcome email or in your control panel and use them with an FTP client such as SmartFTP or BitKinex or Ipswitch WS_FTP. Then just copy and paste those three files into the directory on your domain where the public can view those files. This folder on your domain is usually called public_html or www. When you have uploaded them, go to your website and you should be on index.php and the log in form displaying.

                  Remember, PHP is server-side code, it is interpreted by a server that has php installed. HTML and CSS are interpreted by the web browser.

                  Hope this helps,

                  Miraan

                  Comment

                  • Markus
                    Recognized Expert Expert
                    • Jun 2007
                    • 6092

                    #10
                    To develop on your local PC / whatever OS, you need to have a server installed.

                    Google XAMPP

                    Comment

                    • rcollins
                      New Member
                      • Aug 2006
                      • 234

                      #11
                      so if I upload this to the server where I host my website, it will work?

                      Comment

                      • hsriat
                        Recognized Expert Top Contributor
                        • Jan 2008
                        • 1653

                        #12
                        Originally posted by rcollins
                        so if I upload this to the server where I host my website, it will work?
                        Of course... just upload the files, and see if it works or not, and let us know in case it doesn't (along with the error).

                        Comment

                        • rcollins
                          New Member
                          • Aug 2006
                          • 234

                          #13
                          OK So far so good, the .php pages are working. The problem is that if I log in with out a username or password, it still loads the page. did I miss something? I can give you my website address if you would like to see

                          Comment

                          • phpNerd01
                            New Member
                            • Sep 2008
                            • 8

                            #14
                            I tried the sample code and it works fine!

                            If you try to load pictures.php and are not logged in yet, it redirects you to the login page (index.php) in this case.

                            When you successfully log in, you are redirected to pictures.php which will show your page. Adding a logout link to logout.php will clear the cookie settings when the users links to it. The next time the user tries to load pictures.php, he/she will be redirected to the index.php to enter the user/password.

                            regards,
                            phpNerd01

                            Comment

                            • hsriat
                              Recognized Expert Top Contributor
                              • Jan 2008
                              • 1653

                              #15
                              Originally posted by phpNerd01
                              I tried the sample code and it works fine!

                              If you try to load pictures.php and are not logged in yet, it redirects you to the login page (index.php) in this case.

                              When you successfully log in, you are redirected to pictures.php which will show your page. Adding a logout link to logout.php will clear the cookie settings when the users links to it. The next time the user tries to load pictures.php, he/she will be redirected to the index.php to enter the user/password.

                              regards,
                              phpNerd01
                              That is exactly what I expected from the code.

                              Comment

                              Working...