Gallery with password

Started on the old forum in September 2009 · view the original in the archive · old links redirect here

16 replies · 970 views · started 17 years ago · 2 min read

3 participants
srecnica Developer · 174 posts #1

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

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&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&sid=$sid\">Gallery</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "HAPPY</a>";
  echo "</p>";
   echo "</card>";

}
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&sid=$sid\"> Gallery</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "HAPPY</a>";
  echo "</p>";
echo "</card>";
}

in index.php

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&sid=$sid\">$user($countpics1[0])</a><br/>";
  
echo "Gallery  $lnk1";
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&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&sid=$sid\">HAPPY</a>";
     echo "</p>";
     echo "</card>";
}

in genproc.php

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&who=$who&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&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "HAPPY</a>";
  echo "</p></card>";
}

Sql

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 🙂

something else Fellow · 2,296 posts #2

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

wap2k Developer · 168 posts #4

try

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

Editied the first way was correct sorry its the != operater

wap2k Developer · 168 posts #8

OK..... lets see...

wap2k Developer · 168 posts #9
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&who=$who&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&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "HAPPY</a>";
echo "</p></card>";
}

Try that does it print the pasword twice ?

srecnica Developer · 174 posts #10

wap2k wrote:

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&who=$who&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&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

$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....

something else Fellow · 2,296 posts #11

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

srecnica Developer · 174 posts #13

yeeeeeeeeeeeee🥳I 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 " "; $uid = getuid_sid($sid);

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

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

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

echo " "; echo " "; echo " <a href="index.php?action=main&sid=$sid"><img src="http://coding-talk.com/images/home.gif" alt="*"/>"; echo "HAPPY</a>"; echo " </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 .... 🙂

something else Fellow · 2,296 posts #14

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

srecnica Developer · 174 posts #15

something else wrote: 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...

srecnica Developer · 174 posts #17

something else wrote: oh you have edited it 🙂 its ok now :)

no, not ok ... now in my gallery that you can come and password of your galleries ... Understand? with any password to enter the galleries from my or me in your gallery...😳 for example .. I make the gallery and write password aaaa .. I create a gallery and write password bbbb .. you will enter with your password in my gallery and I with my password I enter in your gallery ... must define the password and uid of the same user =same gallery=pass

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close