hello there
im trying to add 2 links to a login menu
after the user had logged in it should display there name followed by you are logged in.
but if there user level is -1 then it should also add below that the 2 links create fixture and reset rankings.
now ive got all this to show up but only prob is i have hello blah you are logged in twice lol
and also - logout is now only visible to the -1 user level and that needs to be viewable by all
how would i arrange that code below so that it displays the hello you are logged in just the once - along with logout and also the 2 links IF a -1 user level?

<?php
}else{
	echo "<p>Hello " . $_SESSION['user'] . ", you are logged in</p>";
	if (isset($_SESSION['user']) AND $_SESSION['level'] == '-1'){
	echo "Hello " . $_SESSION['user'] . ", you are logged in<br />";
	?>
	<a href="create_fixtures.php">Create Fixture</a><br />
	<a href="ranking.php">Reset Rankings</a>
	
	<?
	?>
	<br />
	<a href="index.php?page=login&logout=yes">Log out</a>
	<?php
    }
}
?>

im still trying to learn this and i know ive got 2 echo statements the same - ive just never worked with different user levels
thanks in advance :D

Recommended Answers

All 2 Replies

Member Avatar for diafol
if (isset($_SESSION['user']) && $_SESSION['level'] == 2){

You could try that.

thanks for the advice but i sorted it now anyway....
changed it to the following and it shows how i want it too :D

<?php
}else{
	echo "Welcome " . $_SESSION['user'] . "";
	?>
	<br />
	<a href="index.php?page=login&logout=yes">Log out</a><br /><br />
<?php	if (isset($_SESSION['user']) AND $_SESSION['level'] == '-1'){
	echo "<p>Admin Links</p>";?>
	<a href="create_fixtures.php">Create Fixture</a><br />
	<a href="ranking.php">Reset Rankings</a>
	
	<?
	?>
	<?php
    }
}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.