
06-09-03, 07:10 PM
|
|
Newbie Coder
|
|
Join Date: Jun 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
php sessions
can anybody help me with this problem?
I have this script, it should activate a session if i'm typing in "brukernavn" & "passord" correctly
Quote:
<?php
if($_POST["b"] == "Haavard" && $_POST["p"] == "bo") {
session_start();
session_register('innlogget');
?>
<html>
<head>
<title>Du er logget inn</title>
<link rel="stylesheet" href="../css/basic.css">
</head>
<body>
<hr>
<h1>Du er nå logget inn, <?php echo $_POST["b"]; ?></h1>
<hr>
<h2><a href="medlemsider.php" title="Medlemsider">Trykk Her</a></h2>
</body>
</html>
<?php
}
elseif($_POST["b"] == "Mathias" && $_POST["p"] == "bo") {
session_start();
session_register('innlogget');
?>
<html>
<head>
<title>Du er logget inn</title>
<link rel="stylesheet" href="../css/basic.css">
</head>
<body>
<hr>
<h1>Du er nå logget inn, <?php echo $_POST["b"]; ?></h1>
<hr>
<h2><a href="medlemsider.php" title="Medlemsider">Trykk Her</a></h2>
</body>
</html>
<?php
}
else {
echo "du er ikke logget inn";
}
?>
|
but i'm not shure it is because when i take it to this script :
Quote:
<?PHP
session_start();
if (!isset($_SESSION['innlogget']) || $_SESSION['innlogget']!= true)
{
header('Location: index.php');
}
?>
|
it sends me right back to index.php when it's supose to let me trough if i have the right session, can anyone help me pls?
__________________
Thanks for helping Me
|

06-09-03, 07:27 PM
|
 |
_-*^# PHP Master #^*-_
|
|
Join Date: Jun 2003
Location: Canada
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ok, so this script above, the first one does it have to let both those names:
Mathias and Haavard to login? but if the password is wrong [ i think this is a login script.. ] they get redirected to index.php? or do they get the message: du er ikke logget inn
__________________
Amailer - Spam/Advertise/Have fun
|

06-09-03, 07:41 PM
|
|
Newbie Coder
|
|
Join Date: Jun 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
they get the message : du er ikke logget inn if they type the wrong password, but then i include script nr.2 in the pages i want to passwd protect end even if i have typed in right username & passwd & the session should have been registerd it sends me right back to index.php
__________________
Thanks for helping Me
|

06-09-03, 07:44 PM
|
 |
_-*^# PHP Master #^*-_
|
|
Join Date: Jun 2003
Location: Canada
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ok... i don't know lol but see i made it work, i think.
oh 1 thing, not think lol, the sessions are no use really here but if you want me to make the use i could lol
__________________
Amailer - Spam/Advertise/Have fun
Last edited by amailer; 06-09-03 at 07:47 PM.
|

06-09-03, 07:51 PM
|
 |
_-*^# PHP Master #^*-_
|
|
Join Date: Jun 2003
Location: Canada
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ok, i must tell you im a noob @ php, but i got another login [ i made its very cheap!, its used for amailer lol, Btw amailer is my script ] it uses MYSQL to store the DB, only for 1 user, the admin, im working on makign it for multiple users, but later, i gatta finish my site, if you want to see it, i would be glad to show you 
__________________
Amailer - Spam/Advertise/Have fun
|

06-09-03, 08:55 PM
|
|
Newbie Coder
|
|
Join Date: Jun 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
im not shure i understan what you mean, but thats alright
I guess I'll figure it out somehow
Thanks
__________________
Thanks for helping Me
|

06-09-03, 08:58 PM
|
 |
_-*^# PHP Master #^*-_
|
|
Join Date: Jun 2003
Location: Canada
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hehe i was not sure what the script had to do, so i just did what i thought it needed to do lol, but anyway
__________________
Amailer - Spam/Advertise/Have fun
|

06-09-03, 09:00 PM
|
|
Newbie Coder
|
|
Join Date: Jun 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
i need a script that cheks if the session['innlogget'] exists and if it exists, do nothing but if it don't exists send it back to index.php
__________________
Thanks for helping Me
|

06-09-03, 09:02 PM
|
 |
_-*^# PHP Master #^*-_
|
|
Join Date: Jun 2003
Location: Canada
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
ohhh! omg LOL! well i jsut thoughyou needed a login!
so, ill just use the login to do what you want it to do, check if the nnlogget exists, and etc etc, hehe sorry i just did not get it at first
__________________
Amailer - Spam/Advertise/Have fun
|

06-09-03, 09:04 PM
|
|
Newbie Coder
|
|
Join Date: Jun 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I'll just be happy if someone can help me
__________________
Thanks for helping Me
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|