PHP: Making my code simpler/shorter welcome message
- by Karem
Any suggestion to make this welcome message shorter:
<?php
if(isset($_SESSION['user_id'])) {
if(isSet($_SESSION['1stTime'])){
?>
<strong id="welcome" style="font-size: 10px;">
<a href="logout.php">
Logga ut
</a>
</strong>
<?php
}else{
$_SESSION['1stTime'] = time();
?>
<script>
$(document).ready(function() {
$("#welcome").fadeIn("slow");
setTimeout(function(){
$("#welcome").fadeOut("slow");
setTimeout(function(){
$("#welcome").html("<a href='logout.php'>Logga ut</a>");
$("#welcome").fadeIn();
}, 800);
}, 5000);
});
</script>
<strong id="welcome" style="display: none; color: #FFF; font-size: 10px;">Hej, <?php echo $FULL; ?>!</strong>
<?php
}
}
?>
First it checks if you are signed in. Next if 1stTime is set, if it is then show "Log out" in swedish, if it isnt, then introduce with "Hi, NAME", and then change to "Log out" after 5 seconds(jquery) + set the session
How can i make this simpler?