Page 1 of 1

Trying to have mulitple passwords

Posted: Thu Nov 24, 2005 1:45 am
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

Posted: Thu Nov 24, 2005 10:58 am
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

Posted: Thu Nov 24, 2005 12:11 pm
by Fruity
Thank You Klemen,


Works like a dream.


Fruity