Session Variables & Changing default view query #33

Open
hardbouw opened this Issue Aug 24, 2016 · 1 comment

Projects

None yet

2 participants

@hardbouw
hardbouw commented Aug 24, 2016 edited

Hallo,

Love your program, I just have a question regarding a specific customization I need to perform:

I have written a separate PHP web form off an example off the net for call center agents to capture their sales on. I want to be able to give them each an unique username and password in mysql to access this web app. That I know how. As they submit the web form I created for them they need to select their name first, that is also saved in the database. I would like to provide each agent only with the records he added using his username. My plan is to somehow add a extra part to the query showing the main table as you log in to only display the rows for the user logged in. The agent will only be able to see and edit his own sales.

For example: SELECT * FROM table WHERE agentname = Jack;

Which file do I edit and how?

In your documentation you talk about "Session Variables", this will help with this.

I looked through some files and its between these:

options.js:

function objCopy(a,b){jPrompt(("Enter new name for the database object"),b+"_copy",("Copy Object"),function(c){null!=c&&(c&&c!=b?wrkfrmSubmit("copy",a,b,c):jAlert(__("Enter new name for the database object")))})}function tableCreate(a){taskbar.openDialog("editable","?q=wrkfrm&type=createtbl&name="+a,800,440,!0)}function tableSelect(a){st=sql_delimiter+"SELECT * FROM "+DB.quote(a);setSqlCode(st,1)}function tableInsert(a){wrkfrmSubmit("tableinsert","",a)}

privelages.php:

$sql = "SELECT * FROM $tableName WHERE User = '{$this->username}' AND Host = '{$this->host}'";
$sql = "SELECT * FROM $tableName WHERE User = '{$this->username}' AND Host = '{$this->host}' AND Db = '{$this->dbName}'";

Also is there a way to make the default display after a user has logged in display the database table the need to use instead of having to click on it every time?

@Samnan
Owner
Samnan commented Aug 24, 2016

Hi

All the select queries are performed in the 'query.php', 'queryall.php'
files in modules folder. So all you need to do to add your own condition to
all select queries is to modify these two files, and put your condition in
the sql statement right before it is sent to the database -> query() method.

To change the default display, you will need to modify info.php in the
modules folder. Replace the statement for server/db information display
with your own code using either createResultGrid() or createSimpleGrid()
function to show the table. Alternatively, you can just setup query
variables and then include 'query.php', which will do the same and show
table data immediately after login.


Samnan ur Rehman
Consultant / Senior Software Developer
about.me/samnan

On Wed, Aug 24, 2016 at 7:40 PM, hardbouw notifications@github.com wrote:

Hallo,

Love your program, I just have a question regarding a specific
customization I need to perform:

I have written a separate PHP web form off an example off the net for call
center agents to capture their sales on. I want to be able to give them
each an unique username and password in mysql to access this web app. That
I know how. As they submit the web form I created for them they need to
select their name first, that is also saved in the database. I would like
to provide each agent only with the records he added using his username. My
plan is to somehow add a extra part to the query showing the main table as
you log in to only display the rows for the user logged in. The agent will
only be able to see and edit his own sales.

For example: SELECT * FROM table WHERE agentname = Jack;

Which file do I edit?

In your documentation you talk about "Session Variables", this will help
with this.

I looked through some files and its between these:

options.js:

function objCopy(a,b){jPrompt(_("Enter new name for the database
object"),b+"copy",("Copy Object"),function(c){null!=c&&
(c&&c!=b?wrkfrmSubmit("copy",a,b,c):jAlert(__("Enter new name for the
database object")))})}function tableCreate(a){taskbar.
openDialog("editable","?q=wrkfrm&type=createtbl&name="+a,800,440,!0)}function
tableSelect(a){st=sql_delimiter+"SELECT * FROM
"+DB.quote(a);setSqlCode(st,1)}function tableInsert(a){wrkfrmSubmit("
tableinsert","",a)}

privelages.php:

$sql = "SELECT * FROM $tableName WHERE User = '{$this->username}' AND Host
= '{$this->host}'";
$sql = "SELECT * FROM $tableName WHERE User = '{$this->username}' AND Host
= '{$this->host}' AND Db = '{$this->dbName}'";

Also is there a way to make the default display after a user has logged in
display the database table the need to use instead of having to click on it
every time?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#33, or mute the thread
https://github.com/notifications/unsubscribe-auth/AA1SICR9zjsK2bQfmYAyAnHEgFe1AOArks5qjFfGgaJpZM4JsFDK
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment