PhotoPost hack question - 01/09/2005 5:53 AM
Hi,
I found this hack at Photopostdev.com and think it will be perfect for my site (it allows all members to see their own photos, but only paying members to see all photos).
Problem is that part of it is missing, the part that does the checking of access.
Could someone here figure this out, or at least point me in the right direction?
Code of the hack is:
Sanuk!
I found this hack at Photopostdev.com and think it will be perfect for my site (it allows all members to see their own photos, but only paying members to see all photos).
Problem is that part of it is missing, the part that does the checking of access.
Could someone here figure this out, or at least point me in the right direction?
Code of the hack is:
Code
<br />(1) At the end of function get_imagethumb in pp-inc:<br /><br /> // begin hack<br /> if ( ! permitted("PM", $theuser) )<br /> $imgtag="<A HREF=/pay/payMain.php><br /> <IMG SRC=../images/emptyFrame.jpg border=0 height=100 width=100 alt=\"Why is this frame empty?\"><br /> </A>";<br /> // end hack<br /> return( $imgtag );<br />}<br /><br />(2) Approx line 380 of showphoto, after $imgdisp has been assigned (no more found in text search):<br /><br /> // begin hack<br /> if ( ! permitted("PM", $iuserid) )<br /> {<br /> $imgdisp="<table border=\"2\" width=\"$width\" height=\"$height\" bordercolor=\"#996633\" bordercolorlight=\"#996633\" bordercolordark=\"#996633\"><br /> <tr><td width=\"100%\"> </tr></table>";<br /> }<br /> // end hack<br /><br />(3) In pp-inc, after $User=array();<br /><br /> You would need to write your own function here... depends on how you determine<br /> who is currently logged in and what thier permissions are. Key is to always permit<br /> accesss when id or name matches current login. Otherwise, only for paid members.<br /><br /> // begin hack<br /> function permitted($op, $targetId=0, $targetName="") {<br /> global $memberPermit, $memberId, $memberName;<br /> if ( ($memberId<>0) && ($memberId==$targetId) ) return true;<br /> if ( ($memberName<>"Guest") && ($memberName!="") && strtolower($memberName)==strtolower($targetName) ) return true;<br /> for ($i=0;$i<strlen($op);$i++) {<br /> $c=substr($op,$i,1);<br /> if (is_integer(strpos($memberPermit,$c))) return true;<br /> }<br /> // Allow member to see/do his own stuff return false;<br /> }<br /> // end hack<br />
Sanuk!