Loginscript

tobias2578

New Member
Wurlie User
May 27, 2013
8
0
0
Hi,

I need help with my script, I want to make it so when I am logged in then that is not "hello guest" is but "Hello User / Logout". But I have already started not coming on with the if and else queries.

Script: this is my example:



Code:
<!-- PANEL START -->
<?php if (!$Auth->loggedIn()) ?>
<div class="toppanel">
	<div class="page">
		<div class="tab">
			<ul class="lr">
				<li class="left"></li>
				<li class="welcome_guest">Hallo Gast!</li>
				<li class="line">|</li>
				<li>
					<a href="../login.html">Login</a>
					<a> | </a>
					<a href="../register.html">Registrieren</a>		
				</li>
				<li class="right"></li>
			</ul>
		</div>
	</div>
</div>
<elseif (!$Auth->loggedOut()) != 1 then>
<div class="toppanel">
	<div class="page">
		<div class="tab">
			<ul class="lr">
				<li class="left"></li>
				<li class="welcome_guest">Willkommen zurück, <?php echo $Auth->username; ?></li>
				<li class="line">|</li>
				<li>
					<a href="<?php echo WEB_ROOT; ?>/logout.<?php echo SITE_CONFIG_PAGE_EXTENSION; ?>">Abmelden</a>
				</li>
				<li class="right"></li>
			</ul>
		</div>
	</div>
</div>
<else /></if>
<!-- PANEL ENDE -->
Regards tomcat
 

ysmods

New Member
Jan 29, 2013
860
1
0
UK
www.ysmods.com
Try this
Code:
<!-- PANEL START -->
<?php if($Auth->loggedIn() == false): ?>
	<div class="toppanel">
	   <div class="page">
		  <div class="tab">
			 <ul class="lr">
				<li class="left"></li>
				<li class="welcome_guest">Hallo Gast!</li>
				<li class="line">|</li>
				<li>
				   <a href="<?php echo WEB_ROOT; ?>/login.<?php echo SITE_CONFIG_PAGE_EXTENSION; ?>">Login</a>
				   <a> | </a>
				   <a href="<?php echo WEB_ROOT; ?>/register.<?php echo SITE_CONFIG_PAGE_EXTENSION; ?>">Registrieren</a>      
				</li>
				<li class="right"></li>
			 </ul>
		  </div>
	   </div>
	</div>
<?php else: ?>
	<div class="toppanel">
	   <div class="page">
		  <div class="tab">
			 <ul class="lr">
				<li class="left"></li>
				<li class="welcome_guest">Willkommen zurück, <?php echo $Auth->username; ?></li>
				<li class="line">|</li>
				<li>
				   <a href="<?php echo WEB_ROOT; ?>/logout.<?php echo SITE_CONFIG_PAGE_EXTENSION; ?>">Abmelden</a>
				</li>
				<li class="right"></li>
			 </ul>
		  </div>
	   </div>
	</div>
<?php endif; ?>
<!-- PANEL ENDE -->
 

tobias2578

New Member
Wurlie User
May 27, 2013
8
0
0
How can I do that in this menubar that this field is only visible to registered users only and the other two only for admin?

Visible only for User:
Code:
						<li><a href="#"><img src="../settings.png" class="settings_page" alt="Settings"></img></a>
							<ul>
							<li><a href="#" class="unknown">VISIBLE FOR USER</a></li>
							<li><a href="#" class="unknown">VISIBLE FOR USER</a></li>
							<li><a href="#" class="unknown">VISIBLE ONLY FOR ADMIN</a></li>
							<li><a href="#" class="unknown">VISIBLE ONLY FOR ADMIN</a></li>
							</ul></li>
 

ysmods

New Member
Jan 29, 2013
860
1
0
UK
www.ysmods.com
This?

Code:
<li>
	 <a href="#"><img src="../settings.png" class="settings_page" alt="Settings" /></a>
	 <ul>
		<?php if (($Auth->loggedIn() == true)): ?>
		 <li><a href="#" class="unknown">VISIBLE FOR USER</a></li>
		 <li><a href="#" class="unknown">VISIBLE FOR USER</a></li>
		 <?php endif; ?>
		 <?php if (($Auth->loggedIn() == true) && ($Auth->level == 'admin')): ?>
		 <li><a href="#" class="unknown">VISIBLE ONLY FOR ADMIN</a></li>
		 <li><a href="#" class="unknown">VISIBLE ONLY FOR ADMIN</a></li>
		 <?php endif; ?>
	 </ul>
</li>
I suggest learning a little HTML and PHP if you want to continue. (also looking through _header.php and _footer.php will help you).

For example in your code, you had
Code:
<img src="../settings.png" class="settings_page" alt="Settings"></img>
The correct syntax is:
Code:
<img src="../settings.png" class="settings_page" alt="Settings" />
There is no "</img>" tag, as the " />" closes the tag. :)