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
in index.php
------------
------------
in genproc.php
---------------
Sql
---------
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
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&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>"; }
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&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>"; }
------------
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&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&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
---------------
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&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>"; }
---------
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 ;
Comment