Skip to main content
update grammar, formatting
Source Link

I have been trying to manage users using jQuery+PHPjQuery & PHP instead using fulljust PHP because I think it is more comfortable to use jQuery+PHPjQuery & PHP but using full phpjust PHP is easier at my personal point butthough more organized.

I will start with my Login.php which code I will skip because I think is irrelevant. Login.php will start my $_SESSIONssessions.

Now I will manage my users menu depending on which type of user is logged in:

Then I just need to call my id to show the menu depending on which user is logged in:

Login.php that will start my $_SESSIONssessions.

I have been trying to manage users using jQuery+PHP instead using full PHP because I think it is more comfortable to use jQuery+PHP but using full php is easier at my personal point but organized.

I will start with my Login.php which code I will skip because I think is irrelevant. Login.php will start my $_SESSIONs.

Now I will manage my users menu depending on which type of user is logged:

Then I just need to call my id to show the menu depending on which user is logged:

Login.php that will start my $_SESSIONs.

I have been trying to manage users using jQuery & PHP instead using just PHP because I think it is more comfortable to use jQuery & PHP but using just PHP is easier at my personal point though more organized.

I will start with my Login.php which code I will skip because I think is irrelevant. Login.php will start my sessions.

Now I will manage my users menu depending on which type of user is logged in:

Then I just need to call my id to show the menu depending on which user is logged in:

Login.php that will start my sessions.

deleted 8 characters in body; edited title
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237

Snippet Menu Using Jquerymenu using jQuery and phpPHP

I have been trying to manage users using jQuery+phpjQuery+PHP instead using full phpPHP because I think it is more comfortable to use jQuery+phpjQuery+PHP but using full php is easier at my personal point but organized.

Since I'm not an expert using jQuery I would like to know if the way I'm managing my users is optimal or should I return to full phpPHP?

LetsLet's take an example of how I work with jQuery+phpjQuery+PHP.

I will start with my Login.php which code I will skip because I think is irrelevant.    Login.php will start my $_SESSION 'ss.

Session_handler.php This

This helps me to focus which type of users is logged at the moment:

session_start();
if(isset($_SESSION['Usuario']))
{
    if( $_SESSION['estado'] == 'User'){
    $send = array('ID' => $_SESSION['ID'], 'user' => $_SESSION['Usuario'], 'estado' => 'usuario' ); 
    echo json_encode($send); 
    }
    if( $_SESSION['estado'] == 'Admin'){
    $send = array('ID' => $_SESSION['ID'], 'user' => $_SESSION['Usuario'], 'estado' => 'admin' ); 
    echo json_encode($send); 
    }

}
else{
    $send = array('estado' => 'invitado' ); 
    echo json_encode($send);
} 

Sessions.js Now

Now I will manage my users menu depending on which type of user is logged:

$(document).ready(function(){
    $.ajax({
        url:'js/Session_handler.php', 
        success:function(data) { 
            var result = $.parseJSON(data);
            var i = 0;
            var carrito = '<li><a href="Carrito.html"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span></a></li>';
            var admin = '<li><a href="Cuenta_admin.html">[Admin] '+result.user+'</a></li>';
            var cuenta = '<li><a href="Cuenta_us.html">'+result.user+'</a></li>';
            var navegacion = '<li><a href="Navegacion/Entrar.html">Entrar</a></li>';
            var registrase = '<li><a href="Navegacion/Registrarse.html">Registrarse</a></li>';
            var salir = '<li><a href="Navegacion/Php/logout.php">Salir</a></li>';
            if(result.estado == 'invitado'){
                $('#snipuser').append(navegacion,registrase);  
            }
            if(result.estado == 'usuario'){
                $('#snipuser').append(carrito,cuenta,salir);
            }
            if(result.estado == 'admin'){
                $('#snipuser').append(carrito,admin,salir);
            }
        }
    });
}); 

Then I just need to call my id to show the menu depending on which user is logged  :

Index.html

OK, now I will ask again in case my doubt was not clear.

Is it more effective to work this way (JQuery+php) than working with full PHP?

Is it more effective to work this way (JQuery+PHP) than working with full PHP? What does it meansmean to work with full phpPHP?. I will show an example.

Login.php that will start my $_SESSION 's$_SESSIONs.

JQuery+PHP or FULL PHP? jQuery+PHP or full PHP?

Snippet Menu Using Jquery and php

I have been trying to manage users using jQuery+php instead using full php because I think it is more comfortable to use jQuery+php but using full php is easier at my personal point but organized.

Since I'm not an expert using jQuery I would like to know if the way I'm managing my users is optimal or should I return to full php?

Lets take an example of how I work with jQuery+php

I will start with my Login.php which code I will skip because I think is irrelevant.  Login.php will start my $_SESSION 's

Session_handler.php This helps me to focus which type of users is logged at the moment

session_start();
if(isset($_SESSION['Usuario']))
{
    if( $_SESSION['estado'] == 'User'){
    $send = array('ID' => $_SESSION['ID'], 'user' => $_SESSION['Usuario'], 'estado' => 'usuario' ); 
    echo json_encode($send); 
    }
    if( $_SESSION['estado'] == 'Admin'){
    $send = array('ID' => $_SESSION['ID'], 'user' => $_SESSION['Usuario'], 'estado' => 'admin' ); 
    echo json_encode($send); 
    }

}
else{
    $send = array('estado' => 'invitado' ); 
    echo json_encode($send);
} 

Sessions.js Now I will manage my users menu depending on which type of user is logged

$(document).ready(function(){
    $.ajax({
        url:'js/Session_handler.php', 
        success:function(data) { 
            var result = $.parseJSON(data);
            var i = 0;
            var carrito = '<li><a href="Carrito.html"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span></a></li>';
            var admin = '<li><a href="Cuenta_admin.html">[Admin] '+result.user+'</a></li>';
            var cuenta = '<li><a href="Cuenta_us.html">'+result.user+'</a></li>';
            var navegacion = '<li><a href="Navegacion/Entrar.html">Entrar</a></li>';
            var registrase = '<li><a href="Navegacion/Registrarse.html">Registrarse</a></li>';
            var salir = '<li><a href="Navegacion/Php/logout.php">Salir</a></li>';
            if(result.estado == 'invitado'){
                $('#snipuser').append(navegacion,registrase);  
            }
            if(result.estado == 'usuario'){
                $('#snipuser').append(carrito,cuenta,salir);
            }
            if(result.estado == 'admin'){
                $('#snipuser').append(carrito,admin,salir);
            }
        }
    });
}); 

Then I just need to call my id to show the menu depending on which user is logged  Index.html

OK, now I will ask again in case my doubt was not clear.

Is it more effective to work this way (JQuery+php) than working with full PHP?

What it means to work with full php?. I will show an example.

Login.php that will start my $_SESSION 's

JQuery+PHP or FULL PHP?

Snippet menu using jQuery and PHP

I have been trying to manage users using jQuery+PHP instead using full PHP because I think it is more comfortable to use jQuery+PHP but using full php is easier at my personal point but organized.

Since I'm not an expert using jQuery I would like to know if the way I'm managing my users is optimal or should I return to full PHP?

Let's take an example of how I work with jQuery+PHP.

I will start with my Login.php which code I will skip because I think is irrelevant.  Login.php will start my $_SESSIONs.

Session_handler.php

This helps me to focus which type of users is logged at the moment:

session_start();
if(isset($_SESSION['Usuario']))
{
    if( $_SESSION['estado'] == 'User'){
    $send = array('ID' => $_SESSION['ID'], 'user' => $_SESSION['Usuario'], 'estado' => 'usuario' ); 
    echo json_encode($send); 
    }
    if( $_SESSION['estado'] == 'Admin'){
    $send = array('ID' => $_SESSION['ID'], 'user' => $_SESSION['Usuario'], 'estado' => 'admin' ); 
    echo json_encode($send); 
    }

}
else{
    $send = array('estado' => 'invitado' ); 
    echo json_encode($send);
}

Sessions.js

Now I will manage my users menu depending on which type of user is logged:

$(document).ready(function(){
    $.ajax({
        url:'js/Session_handler.php', 
        success:function(data) { 
            var result = $.parseJSON(data);
            var i = 0;
            var carrito = '<li><a href="Carrito.html"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span></a></li>';
            var admin = '<li><a href="Cuenta_admin.html">[Admin] '+result.user+'</a></li>';
            var cuenta = '<li><a href="Cuenta_us.html">'+result.user+'</a></li>';
            var navegacion = '<li><a href="Navegacion/Entrar.html">Entrar</a></li>';
            var registrase = '<li><a href="Navegacion/Registrarse.html">Registrarse</a></li>';
            var salir = '<li><a href="Navegacion/Php/logout.php">Salir</a></li>';
            if(result.estado == 'invitado'){
                $('#snipuser').append(navegacion,registrase);  
            }
            if(result.estado == 'usuario'){
                $('#snipuser').append(carrito,cuenta,salir);
            }
            if(result.estado == 'admin'){
                $('#snipuser').append(carrito,admin,salir);
            }
        }
    });
});

Then I just need to call my id to show the menu depending on which user is logged:

Index.html

OK, now I will ask again in case my doubt was not clear.

Is it more effective to work this way (JQuery+PHP) than working with full PHP? What does it mean to work with full PHP? I will show an example.

Login.php that will start my $_SESSIONs.

jQuery+PHP or full PHP?

added 3 characters in body
Source Link
mdfst13
  • 21.7k
  • 6
  • 33
  • 68

I have been trying to manage users using jquery+phpjQuery+php instead using full php because iI think it is more comfortable using jquery+phpto use jQuery+php but using full php is easier at my personal point but organized.

Since i'mI'm not an expert using jqueryjQuery I would like to know if the way i'mI'm managing my users is optimal or should I return to full php?

Lets take an example of how I work with jquery+phpjQuery+php

I will start with my Login.php which code I will skip because I think is irrelevant. LogingLogin.php will start my $_SESSION 's

Sessions.js Now I will manage my users menu depending on which type of usuruser is logged

OkOK, now I will ask again in case my doubt was not clear.

It isIs it more effective to work this way  (JQuery+php) than working with full PHP?

LogingLogin.php that will start my $_SESSION 's

Now instead working with Index.html I will be bound change my file extentionextension to Index.php and work my menus like this:

I have been trying to manage users using jquery+php instead using full php because i think is more comfortable using jquery+php but using full php is easier at my personal point but organized.

Since i'm not an expert using jquery I would like to know if the way i'm managing my users is optimal or should I return to full php?

Lets take an example of how I work with jquery+php

I will start with my Login.php which code I will skip because I think is irrelevant. Loging.php will start my $_SESSION 's

Sessions.js Now I will manage my users menu depending on which type of usur is logged

Ok, now I will ask again in case my doubt was not clear.

It is more effective to work this way(JQuery+php) than working with full PHP?

Loging.php that will start my $_SESSION 's

Now instead working with Index.html I will be bound change my file extention to Index.php and work my menus like this:

I have been trying to manage users using jQuery+php instead using full php because I think it is more comfortable to use jQuery+php but using full php is easier at my personal point but organized.

Since I'm not an expert using jQuery I would like to know if the way I'm managing my users is optimal or should I return to full php?

Lets take an example of how I work with jQuery+php

I will start with my Login.php which code I will skip because I think is irrelevant. Login.php will start my $_SESSION 's

Sessions.js Now I will manage my users menu depending on which type of user is logged

OK, now I will ask again in case my doubt was not clear.

Is it more effective to work this way  (JQuery+php) than working with full PHP?

Login.php that will start my $_SESSION 's

Now instead working with Index.html I will be bound change my file extension to Index.php and work my menus like this:

Source Link
Mugen
  • 39
  • 3
Loading