0
Personal in my code above, I am trying to display 2 types of menu for the user, when logged in, and not logged in, in case when logged in it still mounts another menu comparing which type of user is logged in, if it is a simple user or advanced user... only this my echo ta problem I am not able to do display one or the other in the condition... someone could help me?
Detail Drawn below :
LOGIN | REGISTER
WHEN FACE CLICKS ON ONE OF THEM WILL APPEAR A FLOATING TAB BELOW..
IF THE GUY LOGS IN, LOGIN AND REGISTRATION DISAPPEARS | AND DISPLAYS USER NAME REGISTERED IN THE SYSTEM; THUS
USER and below the links of the menus for that user.
, but when logging in, the system will identify which user will have access to which menu... because in the system below need to be shown the correct menu for the user the condition already works perfectly, the problem is that I need to do an if Else, to display only the menus of logged in and the not logged in already until put inside each echo...
<div class="auth auth--header">
<ul class="auth__nav">
<?php
session_start();
if(!isset($_SESSION['usertype']))
{
echo '<li class="dropdown auth__nav-item">
<div class="dropdown__menu auth__dropdown--restore">
<!-- BEGIN AUTH RESTORE-->
<h5 class="auth__title">Resetar Senha</h5>
<form action="#" class="auth__form js-restore-form js-parsley">
<div class="auth__row form-group">
<label for="restore-email-dropdown" class="auth__label control-label">Digite usuario ou email</label>
<input type="email" name="email" id="restore-email-dropdown" required class="auth__in auth__in--text form-control">
</div>
<div class="auth__row">
<button type="submit" class="auth__in auth__in--submit">Resetar senha</button>
</div>
<div class="auth__row"><span class="auth__links">Back para
<button type="button" class="js-user-login">Logar em</button>ou
<button type="button" class="js-user-register">Registrar</button></span>
<!-- end of block .auth__links-->
</div>
</form>
<!-- end of block .auth__form-->
<!-- END AUTH RESTORE-->
</div>
</li>
<li class="dropdown auth__nav-item">
<button data-toggle="dropdown" type="button" class="dropdown-toggle js-auth-nav-btn auth__nav-btn">
<svg class="auth__icon-user">
<use xlink:href="#icon-user"></use>
</svg><span class="header__span"> Entrar /</span>
</button>
<div class="dropdown__menu auth__dropdown--login">
<!-- BEGIN AUTH LOGIN-->
<h5 class="auth__title">Entre com sua conta</h5>
<form action="#" class="auth__form js-login-form js-parsley">
<div class="auth__row form-group">
<label for="login-username-dropdown" class="auth__label control-label">Usuario</label>
<input type="text" name="username" id="login-username-dropdown" required data-parsley-trigger="keyup" data-parsley-minlength="6" data-parsley-validation-threshold="5" data-parsley-minlength-message="Login should be at least 6 chars" class="auth__in auth__in--text form-control">
</div>
<div class="auth__row auth__row--password form-group">
<label for="login-password-dropdown" class="auth__label control-label">Senha</label>
<input type="password" name="password" id="login-password-dropdown" required class="auth__in auth__in--text form-control">
</div>
<div class="auth__row">
<button type="button" class="auth__forgot js-user-restore">Perdeu a senha ?</button>
<button type="submit" class="auth__in auth__in--submit">Entrar?</button><span class="auth__remember">
<input type="checkbox" id="remember-in-dropdown" class="in-checkbox">
<label for="remember-in-dropdown" class="in-label">Lembre-me</label></span>
</div>
<div class="auth__row"><span class="auth__links">Não e usuário?
<button type="button" class="js-user-register">Pegue uma conta</button></span></div>
</form>
<!-- end of block .auth__form-->
<!-- END AUTH LOGIN-->
</div>
</li>
<li class="dropdown auth__nav-item">
<button data-toggle="dropdown" type="button" class="dropdown-toggle auth__nav-btn"><span class="header__span">Cadastrar</span></button>
<div class="dropdown__menu auth__dropdown--register">
<!-- BEGIN AUTH REGISTER-->
<h5 class="auth__title">Registre uma nova conta</h5>
<form action="#" class="auth__form js-register-form js-parsley">
<div class="auth__coll form-group">
<label for="register-name-dropdown" class="auth__label control-label">Nome</label>
<input type="text" name="username" id="register-name-dropdown" required class="auth__in auth__in--text form-control">
</div>
<div class="auth__coll auth__coll--right form-group">
<label for="register-lastname-dropdown" class="auth__label control-label">Sobre Nome</label>
<input type="text" name="name" id="register-lastname-dropdown" required class="auth__in auth__in--text form-control">
</div>
<div class="auth__coll auth__coll--email form-group">
<label for="register-email-dropdown" class="auth__label control-label">E-mail</label>
<input type="email" name="email" id="register-email-dropdown" required class="auth__in auth__in--text form-control">
</div>
<div class="auth__coll auth__coll--right form-group">
<label for="register-password-dropdown" class="auth__label control-label">Senha</label>
<input type="password" name="password" id="register-password-dropdown" required class="auth__in auth__in--text form-control">
</div>
<div class="auth__row"><span class="auth__links">Back para
<button type="button" class="js-user-login">Entrar</button></span>
<button type="submit" class="auth__in auth__in--submit">Entrar</button>
</div>
</form>
</div>
</li> ';
}
else
{
echo ' <li class="dropdown auth__nav-item">
<button data-toggle="dropdown" type="button" class="dropdown-toggle js-auth-nav-btn auth__nav-btn">
<svg class="auth__icon-user">
<use xlink:href="#icon-user"></use>
</svg><span class="header__span"> <?php if (isset($username)){echo $username;} ?><?php if (isset($model)){echo $model;} ?></span>
</button>
<div class="dropdown__menu auth__dropdown--login">
<nav class="worker__nav">
<li class="topmenu"><a href="#" style="height:10px;line-height:10px;"><span></span></a>
<div class="submenu" style="width:92px;">
<?php if($username) {
echo '<li><a href="cp/chatusers/index.php">Minha Conta</a></li>
<li><a href="cp/chatusers/favorites.php">Favoritos</a></li>
<li><a href="cp/chatusers/updateprofile.php">Meu Perfil</a></li>
<li><a href="cp/chatusers/viewsessions.php">Histórico</a></li>
<li><a href="cp/chatusers/buyminutes.php">Dinheiro</a></li>
<li><a href="logout.php">Logout</a></li>';} ?>
<?php if($model) {
echo '<li><a href="index.php">Minha Conta</a></li>
<li><a href="cp/chatmodels/broadcast.php">Transmiss&aatilde;o</a></li>
<li><a href="cp/chatmodels/updateprofile.php">Meu Perfil</a></li>
<li><a href="cp/chatmodels/showslist.php">Histórico</a></li>
<li><a href="cp/chatmodels/uploadpicture.php">Minhas Fotos</a></li>
<li><a href="cp/chatmodels/paymentop.php">Dinheiro</a></li>
<li><a href="logout.php">Logout</a></li>';} ?>
</div>
</li>
</nav>';
}
?>
</ul>
<!-- end of block .auth header-->
</div>
Where do the $model and $username variables come from? Probably the error is there.
– Andrei Coelho
No actually the error is coming from '' echo... I do not know how to put 2 Texts inside each other and make a comparative condition... $model and $username already takes the variables of the database...
– Bruno Roberto
But which echo comes the error?
– Andrei Coelho