Php code appearing after login button

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

cudsuk

Thread Starter
Joined
Jan 5, 2013
Messages
1
Hi everyone i need some help with some php code as i get code after my login button

(Attached image )

I have narrowed it down to my template.php

Code:
<? }
					else
					  { 
						echo '<p align="center" style="font-weight:bold;color:white;"><span>Welcome '.$_SESSION['LOgIn'].'</span></p>';
						echo '<p>&nbsp;&nbsp;<a href="'.$siteurl.'/profile.php?show_favorites='.$_SESSION['LOgIn'].'"  class="lilogin"> visit your profile</a><br>';
						echo '&nbsp;&nbsp;<a href="'.$siteurl.'/logout.php"  class="lilogin"> log out</a></p>';
					  }	
					?>
Can anyone shed some light on it for me please , cheers
 

Attachments

JiminSA

Jim
Joined
Dec 15, 2011
Messages
3,404
Hoping to catch the eye of one of our moderators... When clicking on the attachment in this thread start posting, the image downloaded as opposed to opening in another tab as per usual:confused:
 
Joined
Apr 16, 2012
Messages
165
PHP Syntax Check: Parse error: syntax error, unexpected '}' in your code on line 1
Error: There is 1 more closing curly braces '}' than expected

also i i dont think u need tht else ?.

try this.

<?

{
echo '<p align="center" style="font-weight:bold;color:white;"><span>Welcome '.$_SESSION['LOgIn'].'</span></p>';
echo '<p>&nbsp;&nbsp;<a href="'.$siteurl.'/profile.php?show_favorites='.$_SESSION['LOgIn'].'" class="lilogin"> visit your profile</a><br>';
echo '&nbsp;&nbsp;<a href="'.$siteurl.'/logout.php" class="lilogin"> log out</a></p>';
}
?>
 
Joined
Jan 20, 2013
Messages
23
Hi all,

cudsuk, you must avoid to "echo" the HTML code, the elegant and correct way is only echoing the variables:
PHP:
					<?php 
					}
					else
					  { 
					  ?>
						<p align="center" style="font-weight:bold;color:white;"><span>Welcome <?php echo $_SESSION['LOgIn'];?></span></p>
						<p>&nbsp;&nbsp;<a href="<?php echo $siteurl;?>/profile.php?show_favorites=<?php echo $_SESSION['LOgIn'];?>"  class="lilogin"> visit your profile</a><br>
						&nbsp;&nbsp;<a href="<?php echo $siteurl;?>/logout.php"  class="lilogin"> log out</a></p>
					 <?php						
					  }	
					?>
I didn't test this piece of code, but you can take an idea of what I mean.

Also I recommend you a good code editor like Geany

Thanks for reading.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top