![]() |
|
Password Protect - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: Password Protect (/thread-1119.html) |
Password Protect - S11 - 2007-11-19 I'm using the Default-Password theme right now but want to use the Default-Dark Theme and add the password protect script. I've managed to do Steps 1 and 2; upon Step 3, I am able to get it working but it doesn't ask for a password upon clicking the Album. Yes; I have ensured there is an _ before the album name, I even changed it to a "." to check if that'd help. My code for Step 3 is shown below... if anyoen could help, that'd be great! Thx! <?php if ($newwws_askforpassword){ include($newwws_passwordfile); } else { ?> <div id="images"> <?php while (next_image(false, $firstPageImages)): ?> <div class="image"> <div class="imagethumb"><a>" title="<?php echo getImageTitle();?>"> <?php printImageThumb(getImageTitle()); ?></a></div> </div> <?php endwhile; ?> </div> <?php } ?> Password Protect - aitf311 - 2007-11-19 Instructions for ZP 1.1+ In order to get it working just take the password.php and album_images files from default-pass and drop them in default. Open up album_images and fill it with this: ` <?php while (next_album()): ?> <div class="album"> <div class="thumb"> <a>" title="View album: <?php echo getAlbumTitle();?>"><?php printAlbumThumbImage(getAlbumTitle()); ?></a> <a>" title="View album: <?php echo getAlbumTitle();?>"><?php printAlbumTitle(); ?></a> <small><?php printAlbumDate(""); ?></small> <?php printAlbumDesc(); ?> <p style="clear: both; "> </div> <?php endwhile; ?> </div> <?php while (next_image(false, $firstPageImages)): ?> <div class="image"> <div class="imagethumb"><a>" title="<?php echo getImageTitle();?>"><?php printImageThumb(getImageTitle()); ?></a> </div> <?php endwhile; ?> </div> ` add this to the top of your album.php: ` <?php if (substr(getAlbumTitle(), 0, 1) == "_" && empty($newwws_password)) $newwws_password = "zen"; /* Check if this is a private album and ask for a password */ $newwws_passwordfile = $themepath . "/" . $theme . "/" . "password.php"; $album_image_file = $themepath . "/" . $theme . "/" . "album_images.php"; if (empty($newwws_password)){ $newwws_authenticated = false; } else { $newwws_authenticated = true; } $newwws_password_soll = $newwws_password; $newwws_password_ist = $_POST['newwws_pw']; if($_COOKIE["newwws_".strtolower(str_replace(" ", "_", getAlbumTitle()))] == "OK") $newwws_password_ist = $newwws_password_soll; if ($newwws_password_ist == $newwws_password_soll) { $newwws_authenticated = false; setcookie ("newwws_".strtolower(str_replace(" ", "_", getAlbumTitle())),"OK",time()+1800, "/"); } ?> ` and in album.php replace the albums and images DIVS with: ` <?php if ($newwws_authenticated){ include("$newwws_passwordfile"); } else { include("$album_image_file"); } ?> ` |