Gallery with password

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Gallery with password

    Real photo gallery, which will be able to view only if it is known password set by the owner of the gallery ...I did it like this...same file as the gallery I just called it gallery1.php
    Code:
    else if($action=="gallery1")
    {
      addonline(getuid_sid($sid),"<b>Add foto!</b>","");
    
         echo "<card id=\"main\" title=\"HAPPY\">";
      echo "<p align=\"center\">";
    
    echo "Allowed type photos.JPG/.JPEG/.GIF/.PNG !!!<br/>";
    echo "Max. Image size 128x128 px !!!<br/><br/>";
     echo "<small><img src=\"images/point.gif\" alt=\"!\"/><b>Enter your password </small><br/>";
      echo "Password: <input name=\"pass\" format=\"*x\" maxlength=\"10\"/><br/>";
                      
    echo "<small> URL foto:</small> <input name=\"itemurl\" maxlength=\"100\" value=\"http://\"/><br/>";
    echo "<anchor>Add foto";
    echo "<go href=\"gallery1.php?action=addgal&amp;sid=$sid\" method=\"post\">";
    echo "<postfield name=\"itemurl\" value=\"$(itemurl)\"/>";
    echo "<postfield name=\"pass\" value=\"$(pass)\"/>";
    
    echo "</go></anchor>";
    
      echo "<br/><br/>";
    //echo "<a href=\"gallery1.php?action=main&amp;sid=$sid\">Gallery</a><br/>";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "HAPPY</a>";
      echo "</p>";
       echo "</card>";
    
    
    }
    Code:
    else if($action=="addgal")
    {
     
    
      $itemurl = $_POST["itemurl"];
    echo "<card id=\"main\" title=\"HAPPY\">";
    echo "<p align=\"center\">";
    
    $pass = trim($_POST["pass"]);
    
       $uid = getuid_sid($sid);
      $nopl = mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE id='".$uid."'"));
      if($nopl[0]=='M')
      {
        $usex = "M";
      }else if($nopl[0]=='F'){
        $usex = "F";
      }else{
        $usex = "M";
      }
    if(trim($pass)!="")
            {
              
    
                $res = mysql_query("INSERT INTO ibwf_gallery1 SET uid='".$uid."', pass='".$pass."',itemurl='".$itemurl."', sex='".$usex."'");
          if($res)
          {
            echo "<img src=\"images/ok.gif\" alt=\"O\"/>User Photo Added<br/>";
          }
    }else{
            echo "<img src=\"images/notok.gif\" alt=\"X\"/>Database Error<br/>";
          }
          
          //echo "<a href=\"gallery1.php?action=main&amp;sid=$sid\"> Gallery</a><br/>";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
      echo "HAPPY</a>";
      echo "</p>";
    echo "</card>";
    }
    in index.php
    ------------
    Code:
    else if($action=="viewuser")
    ---------------------------------
    $countpics1 = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_gallery1 WHERE uid='".$who."'"));
    
    
    $lnk1 = "<a href=\"index.php?action=pasvord&amp;sid=$sid\">$user($countpics1[0])</a><br/>";
      
    echo "Gallery  $lnk1";
    Code:
    else if($action=="pasvord")
    {
      addonline($uid,"pasword","index.php?action=$action");
    echo "<card id=\"main\" title=\"$nazivsajta\">";
    echo "<p>";
    
    $ouid = getuid_sid($sid);
    
            echo "<b>Please Authenticate Yourself.<br/>Enter Password Below: </b>";
      echo "<b>Pasword:</b><br/><input type=\"pass\" name=\"pass\"  maxlength=\"30\"/><br/>";
      echo "<anchor>Enter<go href=\"genproc.php?action=password&amp;sid=$sid\" method=\"get\">";
        echo "<postfield name=\"pass\" value=\"$(pass)\"/>";
      echo "</go></anchor><br/>";
    
    echo "</p>";
    
      echo "<p align=\"center\">";
         echo "<img src=\"images/home.gif\" alt=\"\"/><a href=\"index.php?action=main&amp;sid=$sid\">HAPPY</a>";
         echo "</p>";
         echo "</card>";
    }
    ------------
    in genproc.php
    ---------------
    Code:
    else if($action=="password")
    
    {
    
        addonline(getuid_sid($sid),"Gallery pasword","");
    echo "<card id=\"main\" title=\"HAPPY Forum\">";
        $pass = $_GET["pass"];
    $gid = $_GET["gid"];
    
    echo "<p align=\"center\">";
    
        $uid = getuid_sid($sid);
    
        $pass1 = mysql_fetch_array(mysql_query("SELECT pass FROM ibwf_gallery1 WHERE id='".$gid."' AND uid='".$uid."'"));
    
    
        
          if(($pass)==($pass1))
    
    
    
              { 
    echo "<b>Authorisation Failed!! <br/> Wrong Password! Try Again!</b>";
    
    
    }
    
    else {
    echo "Success!!<br/><a href=\"gallery1.php?action=viewuser&amp;who=$who&amp;sid=$sid\">Click Here</a> To Continue to User Gallery<br/>"; 
    
      }
    
    
    
        
     echo "</p>";
    echo "<p align=\"center\">";
    
    echo "<br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "HAPPY</a>";
      echo "</p></card>";
    }
    Sql
    ---------
    Code:
    CREATE TABLE `ibwf_gallery1` (
      `id` int(100) NOT NULL auto_increment,
      `uid` int(100) NOT NULL,
      `pass` varchar(100) NOT NULL default '',
      `sex` varchar(255) NOT NULL,
      `itemurl` varchar(255) NOT NULL,
      `file` varchar(250) NOT NULL,
      PRIMARY KEY  (`id`),
      UNIQUE KEY `name` (`itemurl`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
    nice work, code is inserted into the database.... but when user write password to see the gallery, then the problem .. does not work ... I think this code in genproc.php not good ... help me a little that I do
    sigpichttp://happy.srecnica.com/web

    #2
    if(($pass)==($pass1)) is wrong it should be:
    if($pass!=$pass1[0])

    Comment


      #3
      Originally posted by something else View Post
      if(($pass)==($pass1)) is wrong it should be:
      if($pass!=$pass1[0])
      nop....
      Authorisation Failed!!
      Wrong Password! Try Again!.....
      does not matter whether it is completely valid registrations or wrong password .. always gives this info
      Last edited by srecnica; 16.09.09, 08:07.
      sigpichttp://happy.srecnica.com/web

      Comment


        #4
        try

        Code:
        if($pass!=$pass1[0]){
        Editied the first way was correct sorry its the != operater
        Last edited by wap2k; 16.09.09, 12:18.

        Comment


          #5
          is password in database?

          Comment


            #6
            Originally posted by something else View Post
            is password in database?
            Yes! Password is inserted into the base...And when you do not enter anything in the password field, but just click the enter, then join the gallery!?!
            Last edited by srecnica; 16.09.09, 12:07.
            sigpichttp://happy.srecnica.com/web

            Comment


              #7
              Originally posted by wap2k View Post
              try

              Code:
              if($pass!==$pass1[0]){
              No, not even this
              sigpichttp://happy.srecnica.com/web

              Comment


                #8
                OK..... lets see...
                Last edited by wap2k; 16.09.09, 12:19.

                Comment


                  #9
                  Code:
                  else if($action=="password"){
                  addonline(getuid_sid($sid),"Gallery pasword","");
                  echo "<card id=\"main\" title=\"HAPPY Forum\">";
                  $sid   = $_GET["sid"];
                  $pass = $_GET["pass"];
                  $gid = $_GET["gid"];
                  echo "<p align=\"center\">";
                  $uid = getuid_sid($sid);
                  $pass1 = mysql_fetch_array(mysql_query("SELECT pass FROM ibwf_gallery1 WHERE id='".$gid."' AND uid='".$uid."'"));
                  
                  echo $pass[0]."<br/>";
                  echo $pass1."<br/>";
                  
                  if($pass!=$pass[0]){ 
                  echo "<b>Authorisation Failed!! <br/> Wrong Password! Try Again!</b>";
                  }else {
                  echo "Success!!<br/><a href=\"gallery1.php?action=viewuser&amp;who=$who&amp;sid=$sid\">Click Here</a> To Continue to User Gallery<br/>"; 
                  }
                  
                  echo "</p>";
                  echo "<p align=\"center\">";
                  echo "<br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
                  echo "HAPPY</a>";
                  echo "</p></card>";
                  }

                  Try that does it print the pasword twice ?
                  Last edited by wap2k; 16.09.09, 12:17.

                  Comment


                    #10
                    Originally posted by wap2k View Post
                    Code:
                    else if($action=="password"){
                    addonline(getuid_sid($sid),"Gallery pasword","");
                    echo "<card id=\"main\" title=\"HAPPY Forum\">";
                    $sid   = $_GET["sid"];
                    $pass = $_GET["pass"];
                    $gid = $_GET["gid"];
                    echo "<p align=\"center\">";
                    $uid = getuid_sid($sid);
                    $pass1 = mysql_fetch_array(mysql_query("SELECT pass FROM ibwf_gallery1 WHERE id='".$gid."' AND uid='".$uid."'"));
                    
                    echo $pass[0]."<br/>";
                    echo $pass1."<br/>";
                    
                    if($pass!=$pass[0]){ 
                    echo "<b>Authorisation Failed!! <br/> Wrong Password! Try Again!</b>";
                    }else {
                    echo "Success!!<br/><a href=\"gallery1.php?action=viewuser&amp;who=$who&amp;sid=$sid\">Click Here</a> To Continue to User Gallery<br/>"; 
                    }
                    
                    echo "</p>";
                    echo "<p align=\"center\">";
                    echo "<br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
                    echo "HAPPY</a>";
                    echo "</p></card>";
                    }
                    Try that does it print the pasword twice ?
                    Nop, not even this....I think the mistake in this code
                    Code:
                    $pass1 = mysql_fetch_array(mysql_query("SELECT pass FROM ibwf_gallery1 WHERE id='".$gid."' AND uid='".$uid."'"));
                    ...but I do not know how to do it differently....
                    sigpichttp://happy.srecnica.com/web

                    Comment


                      #11
                      $pass1 = mysql_fetch_array(mysql_query("SELECT pass FROM ibwf_gallery1 WHERE id='".$gid."'"));

                      Comment


                        #12
                        Originally posted by something else View Post
                        $pass1 = mysql_fetch_array(mysql_query("SELECT pass FROM ibwf_gallery1 WHERE id='".$gid."'"));
                        nop... noooo
                        sigpichttp://happy.srecnica.com/web

                        Comment


                          #13
                          yeeeeeeeeeeeeeI succeeded !!!!
                          This code is valid
                          else if($action=="password"){
                          addonline(getuid_sid($sid),"Gallery pasword","");
                          echo "<card id=\"main\" title=\"HAPPY Forum\">";
                          $sid = $_GET["sid"];
                          $pass = $_GET["pass"];
                          $gid = $_GET["gid"];
                          echo "<p align=\"center\">";
                          $uid = getuid_sid($sid);

                          $pass1 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_gallery1 WHERE pass='".$pass."'"));


                          if($pass1[0]==0)
                          {

                          echo "<b>Authorisation Failed!! <br/> Wrong Password! Try Again!</b>";
                          }else {
                          echo "Success!!<br/><a href=\"gallery1.php?action=viewuser&amp;who=$who&a mp;sid=$sid\">Click Here</a> To Continue to User Gallery<br/>";
                          }


                          echo "</p>";
                          echo "<p align=\"center\">";
                          echo "<br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";
                          echo "HAPPY</a>";
                          echo "</p></card>";
                          }
                          Now we have a gallery which the owner can lock the password and the password which says what he wants...
                          the only problem is that the user who added photo must always write the same password .. because it can not be next to each image to specify a new password... Maybe you could help instead of the one who adds a photo can choose to be a gallery with password or without password .. as well as create private chat rooms ....
                          Last edited by srecnica; 16.09.09, 15:54.
                          sigpichttp://happy.srecnica.com/web

                          Comment


                            #14
                            that code is wrong lol
                            try entering with a differnt nick lol

                            Comment


                              #15
                              Originally posted by something else View Post
                              that code is wrong lol
                              try entering with a differnt nick lol
                              .... ok..give the correct code .. The problem is that any password that is based on each gallery opens ......
                              I started Come on and give you ideas and help to create the gallery, along with the password
                              ..Do not criticize me a lot, because I am not professional coder, but an amateur who likes the script xexe help...
                              Last edited by srecnica; 16.09.09, 16:32.
                              sigpichttp://happy.srecnica.com/web

                              Comment

                              Working...
                              X