Serverside Filtering based on User Login

Serverside Filtering based on User Login

gadeinnagadeinna Posts: 4Questions: 0Answers: 0
edited September 2013 in DataTables 1.8
Hi All,

I need to have serverside filtering based on user login.

I have two database tables, i.e user table and upload table.

User table is below

[code]
USERNAME PASSWORD JOINING DATE
Jose ***** 9/5/2013
Daniel ***** 9/5/2013
Mary ***** 9/5/2013
Joe ***** 9/5/2013

upload table is below

NAME DEPARTMENT SALARY UPLOADED BY
Raky PG 14000 Daniel
Ankey DL 12000 Mary
Munfa PG 8000 Joe
Cicilia PG 9000 Mary
Randy SIL 13000 Jose
Pandu DL 10000 Daniel
Arun PG 7000 Joe
Kumay SIL 5000 Mary
Mark DL 9800 Jose

Now when ever user login, the data uploaded by respective user should be displayed.

For Daniel login, table should look
NAME DEPARTMENT SALARY
Raky PG 14000
Pandu DL 10000

For Mary login, table should look
NAME DEPARTMENT SALARY
Ankey DL 12000
Cicilia PG 9000
Kumay SIL 5000

For Joe login, table should look
NAME DEPARTMENT SALARY
Munfa PG 8000
Randy SIL 13000
Arun PG 7000

For Jose login, table should look
NAME DEPARTMENT SALARY
Randy SIL 13000
Mark DL 9800
[/code]

Can anyone help please?

Replies

  • tangerinetangerine Posts: 3,350Questions: 37Answers: 394
    If this is a PHP/MySQL site, your solution lies in PHP/MySQL. Do your database query according to your user's credentials.
  • gadeinnagadeinna Posts: 4Questions: 0Answers: 0
    Yes. It does. It works perfectly fine with client-side processing. But do not know how to deal with serverside processing. Any help?
  • allanallan Posts: 61,726Questions: 1Answers: 10,109 Site admin
    How does the server know if a user is logged in or not? _SESSION variables? If so, can you not just use them to modify the query?

    Allan
  • gadeinnagadeinna Posts: 4Questions: 0Answers: 0
    edited September 2013
    private function check( )
    {
    if ( !isset( $_SESSION[ 'ADMIN' ] ) )
    $this->_redirect( "index/login" );
    $this->template->ADMIN = array(
    "name" => "ADMIN",
    "value" => $_SESSION[ 'ADMIN' ]
    );
    }

    private function checkUserLogged( )
    {

    if ( isset( $_SESSION[ 'ADMIN' ] ) )
    $this->_redirect( "index/dashboard" );
    }

    This is the function, we use to know the user login. Can you please give an example to make changes to query?
  • gadeinnagadeinna Posts: 4Questions: 0Answers: 0
    Thanks.. I solved the problem.
This discussion has been closed.