I am having some trouble with some PHP. I have spend hours at this simple script but I does not seem to work.
It is a password script and a slideshow made by HTML-refresh tag.
I want to combine those two so the refresh tag(BLUE) only are echo when the password-protection is passed.
Code: Select all
[color=#0000FF]<?php if($sg->image->hasNext() && !isset($control)) { echo '<meta http-equiv="refresh" content="5;url='.$sg->image->nextURL('slideshow').'" />'; } ?>[/color]
</head>
<body id="slideshow">
<?php $password_check = true;
if (file_exists($sg->config->pathto_galleries.$sg->gallery->id."/password.txt")) {
$password_check = false;
$password = trim(file_get_contents($sg->config->pathto_galleries.$sg->gallery->id."/password.txt"));
if (isset($_POST["gallery_password"])) {
$_SESSION[$sg->gallery->id."_Password"] = $_POST["gallery_password"];
}
if ((isset($_SESSION[$sg->gallery->id."_Password"])) && (strcmp($_SESSION[$sg->gallery->id."_Password"], $password) == 0)) {
$password_check = true;
} elseif (isset($_SESSION[$sg->gallery->id."_Password"])&& $_POST["gallery_password"] != '') {
echo '<h2>'.$sg->gallery->name().'</h2>';
echo "<p><font color=\"#CC0000\"><B>Sorry:</B> a valid password is required!</font></p>";
}else{
echo '<h2>'.$sg->gallery->name().'</h2>';
echo "<p>Please enter your client password!</p>";
}
}
//Begin Pass Check ...
if ($password_check) {
?>