Integrating Datatables into a existing website with session management
Integrating Datatables into a existing website with session management
Hi there,
first of all I have to say thanks for the great work, that has been done here.
Datatables is just brilliant !
I found DT just by accident and I have to say I am not really familiar with javascript, jquery and php. I used some of it from time to time but never really invested much time to learn it in more detail.
So here is my problem:
I was working with DT the last couple of days and I could solve a my problems so far. I am using server side processing and everything is working great at this point. Now I wanted to integrate the datatables into an existing webpage, where you have to log in to get access to the site. The login Data are stored in the same database, where I get my Datatables data from. I have access to the scripts and everything on that existing website.
So what do I have to change, so that there is no clear text in the script on the server with the database connection. Instead it should use the login data from the website. And everything should be as safe as possible.
I could imagine this task is not that big of a deal for someone who knows how to solve that. But for me I just dont know where to start.
Maybe someone can help me and first of all tell me, what needs to get done generally, that this will work.
Thanks in advance
Dave
first of all I have to say thanks for the great work, that has been done here.
Datatables is just brilliant !
I found DT just by accident and I have to say I am not really familiar with javascript, jquery and php. I used some of it from time to time but never really invested much time to learn it in more detail.
So here is my problem:
I was working with DT the last couple of days and I could solve a my problems so far. I am using server side processing and everything is working great at this point. Now I wanted to integrate the datatables into an existing webpage, where you have to log in to get access to the site. The login Data are stored in the same database, where I get my Datatables data from. I have access to the scripts and everything on that existing website.
So what do I have to change, so that there is no clear text in the script on the server with the database connection. Instead it should use the login data from the website. And everything should be as safe as possible.
I could imagine this task is not that big of a deal for someone who knows how to solve that. But for me I just dont know where to start.
Maybe someone can help me and first of all tell me, what needs to get done generally, that this will work.
Thanks in advance
Dave
This discussion has been closed.
Replies
I can't give any specific directions without knowing how your existing authentication and database setup is laid out, though I can say with 99.999% certainty that it can be done.
If you don't know php/javascript/jquery very well, you should really hire a consultant to ensure that everything is done securely and efficiently. You can probably find many suitable people here or on freelance sites that would be willing to take on some work, and I don't imagine it would be very costly.
its not that I dont know anything about php/javascript/jquery. I just dont have the experience in any bigger project whatsoever.
And I dont want anybody to do the whole work for me, I really want to learn that stuff, even if it takes some time :-)
I think clear text is the wrong expression then. It's not that I echo anything to the user. At the moment everything (especially the db connection data) is in variables. I havent changed anything else in the datatables code than what needed to be changed. So it still looks like that :
[code]
$gaSql['user'] = "myUser";
$gaSql['password'] = "myPW";
$gaSql['db'] = "myDB";
$gaSql['server'] = "localhost";
[/code]
to give you more information about the whole situation:
One needs to login at the login.php (with an already existing account in the database)
Once logged in a session is created and the user can get some data from the database ( they just got select rights on the DB)
Now I want to integrate the Datatables into the existing session mechanism.
So my first thought for this was:
Just pass the user and password from my session to the datatables connection.
But how do I do this ?
The session handling code is the class AnfoDB in AnfoDB.php
When I use the $_SESSION["user"] and $_SESSION["userpass"] for my datatables connection similar to this
[code]
$gaSql['user'] = Anfodb::$_SESSION["user"];
$gaSql['password'] = Anfodb::$_SESSION["userpass"];
$gaSql['db'] = "myDB";
$gaSql['server'] = "localhost";
[/code]
I get following error:
[quote]
Fatal error: Access to undeclared static property: AnfoDB::$_SESSION in C:\xampp\htdocs\datatabletest\server_side\scripts\server_processing.php on line 26
[/quote]
So this does not seem to work. Any tips are welcome :-)
Genrally I appreciate every tips I can get regarding the basic structure of the website. As I said, I have not much expierience and would like to learn how to do it the best way :-)
I've put following line in the server_processing.php ( this is where the Datatables connection is )
[code]
require_once 'AnfoDB.php';
[/code]
Allan
yeah it definitely has nothing to do with datatables, as DT is working just fine.
I am just looking for a way to easily integrate datatables into an exisiting session system of a website.
I think that cant be that hard for someone who did that before ? Maybe this someone could tell me at least in theory the steps that have to be done to solve that little problem :-)
Should I maybe just post all the code I have ? I dont know if someone really wants to read through all that :-)