Trying to have mulitple passwords

Dr. GBooky is here to help you with your guestbook problems ...
Post Reply
FRUITY

Trying to have mulitple passwords

Post by FRUITY »

Script URL: http://www.fgps.com/keith/
Version of script: 1.34
Version of PHP: 5.0.5
Hosting company: Apache 2.+(Home)
Have you searched THIS FORUM for your problem: N/A
(if not please do before posting)
If so, what terms did you try: N/A

Write your message below:

Hi Guys,

am trying to make it so i can have multiple passwords,

i get to a point where it accepts the last one of the array i have set , but not all!!!

inside settings.php i have swapped

$settings['apass']="*******************************";
with
$settings['apass'] = array('*******','************','***','******');

and inside gbook.php i have swapped

function showPrivate($pass,$num) {
global $settings;
if ($pass != $settings[apass]) {problem("Wrong password! Only the Notepad owner may read this post!","1");}

with

function showPrivate($pass,$num) {
global $settings;
$pass=gbook_input($_REQUEST['pass']);
foreach ($settings['apass'] as $TRUE);
if ($pass != $TRUE) {problem("Wrong password! Only the Notepad owner may read this post!","1");}

as i say it always accepts the last password but never any of the others.

any pointers or am i going the completely wrong way about it, maybe im tired and should retry in the morning or something.

anyway, help appreciated and pre thanks for even atempting.

Fruity
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

How about something like this:

Code: Select all

$pass=gbook_input($_REQUEST['pass']);

if (!in_array($pass,$settings['apass'])) {
problem("Wrong password! Only the Notepad owner may read this post!","1");
}
Regards
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Fruity

Post by Fruity »

Thank You Klemen,


Works like a dream.


Fruity
Post Reply