Hi,
I am having a very difficult time trying to get my pages to show if someone is logged on.
For example:
Welcome (username)
or
You are currently logged on as (username)
I want it to display their user name if the are logged on.
You can refer to the image I uploaded.
Please help.
Thanks.
Hi cwhazzoo,
in addition to what dwfaq.info suggests, it should be mentioned that ADDT makes it pretty easy to display a certain page region only if a user is logged in -- in your case I suggest to highlight the whole...
Welcome {Session.kt_login_user}
...line and apply ADDT´s "Show If User Is Logged In" server behaviour (under "Conditional Regions") to it. This behaviour also comes with a helpful optional sub-feature named "has ELSE", which lets you specify an alternate text such as "you´re currently not logged in" in case, well, the user isn´t logged in.
Cheers,
Günter
cwhazzoo wrote:
I currently dont have ADDT and I went to go look at it and Adobe is getting rid of it. Is there any way to do the same stuff just using Dreamweaver CS4 without having to know complex coding?
nope, the required coding isn´t too complex -- but then again I think that questions which are not related to ADDT should rather be posted to the regular Dreamweaver forums (Application Development) and not in here ;-)
Cheers,
Günter
In dreamweaver, switch to the code view. put the code at the first line or below the <?php require_once('../Connections/.. ); ?> if u have database connection. Make sure the code is in PHP tag <?php like below:
<?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
}
.....
//any of your is here
?>
What do u mean dreamweaver doesn't have that?? When u try to create login form, you must do the Log In User under Server Behaviour. This will automatically produce the code that consists of MM_Username. Try to do that and you can see this kind of code
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername; <-- the username of user
$_SESSION['MM_UserGroup'] = $loginStrGroup; <-- the access level of user if u create one in your registration form
Excuse my lanquage ,but HOLY CRAP. IT WORKED!!!! Thank you soo much! There is just one problem.
The page is sending this error:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/cwhazzoo/public_html/logingood.php:2) in /home/cwhazzoo/public_html/logingood.php on line 5
How do I fix this?
But wait... It is still showing this error on the page
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/cwhazzoo/public_html/logingood.php:2) in /home/cwhazzoo/public_html/logingood.php on line 5
Hey QiQi86... i want the same thing but it is not working with me. Also this page does not have any log out or restrict acces to codes.
Basically this is a public page but i want an 'edit' link beside any entry which should only be visible to the admin (i.e if logged in)
So i simply add session start and then if(isset($_SESSION['MM_Username'])) {echo $row_codeSamples2['id'];}
and nothing else related to the admin session.. also this page is not directly related to any admin page so is it possible that the var gets lost in between, when there is no session code. If yes then what should i add to every other page (for now 1) which comes in between.
i cand code php well but sessions knowledge is a bit weak. Plz help thanks ![]()
Parse error: syntax error, unexpected T_IS_EQUAL, expecting ',' or ')'
if i exactly put you code "if(isset($_SESSION['MM_Username'] == 'Administrator'))", no surprise... isn't it wrong to use isset with ==?? these are two different methods.. aren't they??
and if i try if($_SESSION['MM_Username'] == 'Administrator')
it still does not work..
Do i need to post any more code.. coz i really dont think any code could be posted..
North America
Europe, Middle East and Africa
Asia Pacific