For solution for GBook version 1.5 look for the post further down this thread.
Because it has been asked several times in this forum here's a modification for hiding the e-mail addresses in the guestbook.
It also has the possibility to view the e-mail address by entering the admin password.
There was a solution for GBook v. 1.41 in this post viewtopic.php?t=877 given by Klemen Stirn, but you could not view the e-mail address with this modification without opening the entries.txt file manually.
So here it goes.
Add after line 148
Code: Select all
seeIP($pass,$num);
Code: Select all
} elseif($a=='viewEmail') {
$num=gbook_isNumber($_REQUEST['num'],'Invalid ID');
confViewEmail($num);
} elseif($a=='seeEmail') {
$pass=gbook_input($_REQUEST['pass'],'Please enter your password');
$num=gbook_isNumber($_REQUEST['num'],'Invalid ID');
seeEmail($pass,$num);
Code: Select all
} // END confViewIP
Code: Select all
function seeEmail($pass,$num) {
global $settings;
if ($pass != $settings[apass]) {problem('Wrong password!');}
$lines=file($settings['logfile']);
$myline=explode("\t",$lines[$num]);
if (empty($myline[2])) {$email='E-MAIL NOT AVAILABLE';}
else
{
$email=rtrim($myline[2]);
}
?>
<p> </p>
<p> </p>
<p>The submitter of this post has entered the following e-mail adress:<br><b><?php echo $email; ?></b></p>
<p><a href="gbook.php?page=1">Click here to continue</a></p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<?php
printDownHTML();
exit();
} // END seeEmail
function confViewEmail($num) {
?>
<p> </p>
<p> </p>
<form action="gbook.php" method="POST"><input type="hidden" name="a" value="seeEmail">
<input type="hidden" name="num" value="<?php echo($num); ?>">
<p><b>Only guestbook administrator may view this e-mail address.</b></p>
<p>Please enter your administration password:<br>
<input type="password" name="pass" size="20"></p>
<p><input type="submit" value="View email"> | <a href="Javascript:history.go(-1)">Back</a></p>
</form>
<p> </p>
<p> </p>
<?php
printDownHTML();
exit();
} // END confViewEmail
Code: Select all
if ($email)
{
echo '<font class="smaller">E-mail:</font> <a href="mailto:'.$email.'" target="_blank" class="smaller">'.$email.'</a>';
}
Code: Select all
<a href="gbook.php?a=viewIP&num='.$i.'"><img src="images/ip.gif" width="14" height="14" border="0" alt="View IP address"></a>
Code: Select all
<a href="gbook.php?a=viewEmail&num='.$i.'"><img src="images/email.gif" width="14" height="14" border="0" alt="View e-mail address"></a>

Greetings,
Henrie