CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 retrieving records for logged in user

Print topic Send  topic

Author Message
Cleopatra

Posts: 73
Posted: 06/10/2010, 9:35 AM

Hey guys,
How can you retrieve values in a grid based on the logged in user, without using the user_id.
My users have another value company_id, so if a user is from 1 company he will be able to view all the records created by him or any other employee of his company.
What function should I use to put for the where clause parameters in order to retrieve the company_id?
_________________
php newbie
View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 06/10/2010, 9:45 PM

Cleopatra,
You could have the system obtain the user's company_id when they first log into the system and save it as a session variable. This way you can use it throughout the session of the user.
View profile  Send private message
magus

Posts: 98
Posted: 06/11/2010, 9:33 PM

Cleopatra,

To do what mambo is suggesting you may want to modify function

CCLoginUser()

in common.php

The way I modify common.php functions is to take a copy of the function and either put it at the end of common.php or in an included file.

Then I comment out the orginal unaltered function like so:.

/*
//CCLoginUser @0-779D489A
function CCLoginUser($login, $password)
{
CCLogoutUser();
$db = new clsDBvtiger();
$SQL = "SELECT id, user_hash, user_password FROM vtiger_users WHERE user_name=" . $db->ToSQL($login, ccsText) . " AND user_password=" . $db->ToSQL($password, ccsText);
$db->query($SQL);
$Result = $db->next_record();
if ($Result) {
CCSetSession("UserID", $db->f("id"));
CCSetSession("UserLogin", $login);
CCSetSession("GroupID", $db->f("user_hash"));
}
return $Result;
}
//End CCLoginUser
*/

This way Codecharge see the function as unaltered and will perform any updates to it it without complaining of breaking anything.

Regards,
Don A
View profile  Send private message
Cleopatra

Posts: 73
Posted: 06/12/2010, 8:39 PM

Thank you Mambo and Don,

I'll try ot out ;-)
_________________
php newbie
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.