CodeChargeMVP
Posts: 473
|
| Posted: 09/10/2010, 1:56 AM |
|
Hello,
I´m stuggling with this dummy question, as far as I know on the projects there´re
some session variables than are saved by use them on different pages in the way
the programmer likes, but I don´t really know how this variables has been created,
for example there´s a .php page on the project which code hasn´t been modified manually
by any developer this means than CCS has generated this lines automatically:
function Show()
{
global $Tpl;
global $CCSLocales;
if(!$this->Visible) return;
$this->RowNumber = 0;
$this->DataSource->Parameters["sesIdUsu"] = CCGetSession("IdUsu", NULL);
$this->DataSource->Parameters["urls_IdTrans"] = CCGetFromGet("s_IdTrans", NULL);
$this->DataSource->Parameters["urls_ONGCodEmi"] = CCGetFromGet("s_ONGCodEmi", NULL);
$this->DataSource->Parameters["urls_ONGCodRec"] = CCGetFromGet("s_ONGCodRec", NULL);
$this->DataSource->Parameters["urls_ProCod"] = CCGetFromGet("s_ProCod", NULL);
$this->DataSource->Parameters["sesProCod"] = CCGetSession("ProCod", NULL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);
so the question is clearly and just simple
¿is there any feature builder or anything when you set those variables?
Thank you very much for your time.
_________________
Best Regards
Entrepeneur | NT Consultant
|
 |
 |
MichaelMcDonald
Posts: 640
|
| Posted: 09/11/2010, 1:44 AM |
|
You can add a hidden field on a form.
You can use a link parameter (say from a grid) to pass a value to that hidden field on the form, to make this work make sure the hidden field has the same name as the parameter being passed.
In the forms "on validate event" you can choose to "save control value". The control value can be the hidden field, the type can be defined as "session" and the destination name is whatever you would like to call the session variable.
_________________
Central Coast, NSW, Australia.
|
 |
 |
CodeChargeMVP
Posts: 473
|
| Posted: 09/13/2010, 1:49 AM |
|
Ok,
Thank you very much. I´ll keep on mind.
After a long relax weekend I´ve review the php code than I pasted here and it´s so clear now,
the parameters has been added from the datasource form section.
Quote MichaelMcDonald:
You can add a hidden field on a form.
You can use a link parameter (say from a grid) to pass a value to that hidden field on the form, to make this work make sure the hidden field has the same name as the parameter being passed.
In the forms "on validate event" you can choose to "save control value". The control value can be the hidden field, the type can be defined as "session" and the destination name is whatever you would like to call the session variable.
_________________
Best Regards
Entrepeneur | NT Consultant
|
 |
 |
CodeChargeMVP
Posts: 473
|
| Posted: 09/13/2010, 5:54 AM |
|
I´ve resolve 50% of the issue,
now i´m able to use the session variables than already has been created
at the beginning of the login and use them on every different page,
but on the top of every page appear three html fields this way
IdUser: "ThevaluefromtheIdUser" ONG:"Thevaluefromtheong"
CodPro:"Thevaluefromcodeproyect"
I´ve check out the html from this pages and I don´t see them anywhere,
in addition i´ve pick up the index.html page and I don´t see even the html text.
I got understood than when you login you create the session variables with the value
than you like and than use them on every page,
so the question is
¿where has been created this three session variables?
Any suggestion will be very welcome.
Thank you very much.
_________________
Best Regards
Entrepeneur | NT Consultant
|
 |
 |
MichaelMcDonald
Posts: 640
|
| Posted: 09/13/2010, 1:09 PM |
|
Are you referring to session variables that are defined within the project security settings relating to UserID, GroupID & UserLogin?
_________________
Central Coast, NSW, Australia.
|
 |
 |
CodeChargeMVP
Posts: 473
|
| Posted: 09/14/2010, 2:20 AM |
|
Definetely Not,
I´m referring to the session variables than everybody has used anytime,
when you login to a database you can save some data, in this project
there are three info data user which is saved as I said on the last message,
the question which is struggling me is:
¿how has been created this session variables?
and wheres the file where I can watch it with my own eyes.
Quote MichaelMcDonald:
Are you referring to session variables that are defined within the project security settings relating to UserID, GroupID & UserLogin?
_________________
Best Regards
Entrepeneur | NT Consultant
|
 |
 |
MichaelMcDonald
Posts: 640
|
| Posted: 09/15/2010, 3:03 AM |
|
Have you had a look in common.php ?
_________________
Central Coast, NSW, Australia.
|
 |
 |
CodeChargeMVP
Posts: 473
|
| Posted: 09/15/2010, 4:04 AM |
|
Quote MichaelMcDonald:
Have you had a look in common.php ?
I know what I was talking about,
Thank you very much at the bottom of common.php is the solution:
//CCLoginUser @0-96CC6705
function CCLoginUser($login, $password)
{
CCLogoutUser();
$db = new clsDBConnection1();
$SQL = "SELECT usuarios.IdUsu, TipUsuCod, UsuPW, usuarios.ONGCod,ONGTipo,proy_uses.ProCod FROM ongs,usuarios,proy_uses WHERE ongs.ONGCod=usuarios.ONGCod and UsuLogin='".$login . "' AND UsuPW='" .$password."'";
$db->query($SQL);
$Result = $db->next_record();
if ($Result) {
CCSetSession("UserID", $db->f("IdUsu"));
CCSetSession("UserLogin", $login);
CCSetSession("GroupID", $db->f("TipUsuCod"));
CCSetSession("ONG",$db->f("ONGCod"));
CCSetSession("ONGTipo",$db->f("ONGTipo"));
CCSetSession("ProCod",$db->f("ProCod"));
}
_________________
Best Regards
Entrepeneur | NT Consultant
|
 |
 |
datadoit
|
| Posted: 09/15/2010, 6:35 AM |
|
Try not to muck around in Common. Put your code snippet on your page
where you have the Logout Action placed.
1. Apply the Logout Action to the page.
2. Put in Custom Code below where that logout action is placed.
If it's something that is required on all pages, then create your own
custom file (ie: Custom.php), and put your function in there, such as
MyLogout(). Then, include that file and function in your pages.
include(RelativePath . "/Custom.php");
MyLogout();
|
|
|
 |
CodeChargeMVP
Posts: 473
|
| Posted: 09/15/2010, 10:58 AM |
|
Ok,
I´ll keep on mind.
Thank you very much for your time out there.
Quote datadoit:
Try not to muck around in Common. Put your code snippet on your page
where you have the Logout Action placed.
1. Apply the Logout Action to the page.
2. Put in Custom Code below where that logout action is placed.
If it's something that is required on all pages, then create your own
custom file (ie: Custom.php), and put your function in there, such as
MyLogout(). Then, include that file and function in your pages.
include(RelativePath . "/Custom.php");
MyLogout();
_________________
Best Regards
Entrepeneur | NT Consultant
|
 |
 |
|