- Joined
- Apr 29, 2010
- Messages
- 36
- Reaction score
- 1
Hey. I have this kind of problem with login script (in login.php) and index.php. I want, when the person is logging in, to automatically get back to index.php (i have done that). AND to write a different comment of: "You have logged in successfully" or lets say for an example "User doesn't exist". Codes how i tried to do that (btw, my login is fully working):
from Login.php: #1
from Index.php: #2
this is to check if session has started to show different log in forms when person IS logged in and ISNT (works perfectly). Basically to recognise it...
Now, this is the one which doesnt work (doesnt show anything): #3
I havent done the include: "login.php" anywhere, because when i do, my index.php becomes a mess. So i need code #3 to take info from login.php code #1 and show some info.... Anyway i think you understood what i am trying to do
Btw i am new to php, so dont judge me for noobishness of this question
I really need help with this... Thanks
from Login.php: #1
Code:
else
$loginanswer3 = 'User doesn't exist!';
echo "$loginanswer3";
header( 'Location: Index.php' );
}
from Index.php: #2
this is to check if session has started to show different log in forms when person IS logged in and ISNT (works perfectly). Basically to recognise it...
Code:
<?php session_start();
//report all errors except e-notice
error_reporting(E_ALL ^ E_NOTICE);
if ($_SESSION['username'])
{
?>
Now, this is the one which doesnt work (doesnt show anything): #3
Code:
<div id="trueorfalse">
this text is visible
<?php
if ($loginanswer3==TRUE)
{
echo "invisible, $loginanswer3";
}
?>
</div>
I havent done the include: "login.php" anywhere, because when i do, my index.php becomes a mess. So i need code #3 to take info from login.php code #1 and show some info.... Anyway i think you understood what i am trying to do
Btw i am new to php, so dont judge me for noobishness of this question
I really need help with this... Thanks