/    Sign up×
Community /Pin to ProfileBookmark

simple loginscript won’t work properly

I wrote the script below to get an login working. Sometimes it just works, but most of the time it says: “top.nav.location” is empty or not an object.
I don’t understand what’s going wrong, because there’s a frame called “nav”. (the function is called from that frame!)

Anyone can help me out?
(Maybe better question: is there a way to do what I do now using PHP and not JavaScript?

[code]
<?
$username = $_POST[“ussr”];
$password = $_POST[“psswrd”];

if ($username == “administrator”){
if ($password == “testje”) {
echo (“<script language=”Javascript”>top.nav.location.href=”../html_bestanden/vrijwilligers/vrijwilnav.htm”;
top.main.location.href=”../html_bestanden/vrijwilligers/vrijwilmain.htm”;</script>”);
}
Else {
echo (“<script language=”Javascript”>alert(“Gebruikersnaam en/of wachtwoord onjuist.”);</script>”);
}
}
?>
[/code]

Additional question: All users who will login need their own username.
Is it easier to use a MySQL database, or just say

[code]
if ($username=”user1″ || $username=”user2″
[/code]

Regards,

René

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@SheldonNov 28.2005 — Dump frames use includes,[url=http://php.net/include]php includes[/url]

And use a mysql database,[url=]look at this for a database[/url]

if you dont use a databse these two threads might help you

[url=http://www.webdeveloper.com/forum/showthread.php?t=85991]one[/url] and [url=http://www.webdeveloper.com/forum/showthread.php?t=86052]two[/url]

Also its definitly a javascript error i think anyway.
Copy linkTweet thisAlerts:
@SheldonNov 28.2005 — What country are you from thats some funky looking words,
Gebruikersnaam en/of wachtwoord onjuist[/quote]

Cool
Copy linkTweet thisAlerts:
@renevanhauthorNov 28.2005 — What country are you from thats some funky looking words,
[/QUOTE]


It's Dutch ?

Gebruikersnaam = Username

Wachtwoord = password

So it says "Username and/or password incorrect".

Regards,

René
Copy linkTweet thisAlerts:
@SheldonNov 28.2005 — Ah wonderful.

Did the links i posted you help at all?
Copy linkTweet thisAlerts:
@renevanhauthorNov 28.2005 — Didn't even noticed them lol... :o

I'll take a look.

Regards,

René
×

Success!

Help @renevanh spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.12,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...