Attribute values

Dear all,

I’ve designed several DB table and for all tables I’ve some fixed fields (set to “not null”):

  1. date_creation ---------> Date of record creation
  2. date_modification -----> Date of record modification
  3. user_creation_id ------> User that create the record
  4. user_modification_id --> Use that modify the record

I would like to use Attributes values but it seems that I miss someone:

INSERT

  1. date_creation ---------> Datetime of inclusion
  2. date_modification -----> Datetime of inclusion ? ? ?
  3. user_creation_id ------> User IP (not possible user ID ?)
  4. user_modification_id --> User IP (not possible user ID ?) ? ? ?
    UPDATE
  5. date_creation ---------> blank
  6. date_modification -----> Datetime of update
  7. user_creation_id ------> blank
  8. user_modification_id --> User IP (not possible user ID ?)

Is this one the correct way ?

How can define a global variable for UserID or other fields ?
Many thanks

Giovannino

Re: Attribute values

choose the option defined value and insert the variable with the user id(the login must set up this variavel):
[login_id] for example.

Re: Attribute values

Thanks,

the login must set up this variavel

how can I set up it ?

I have used SC Security procedure and I’ve defined Control_login form with login and password fields.

Thanks
Giovannino

Re: Attribute values

Hi giovannino,

in your login set simple

$_SESSION[‘user’][‘id’] = $user_id;

or

sc_set_global($user_id);

HTH

Re: Attribute values

Dear HTH,

excuse me my ignorance but I’m not a programmer.

Have I to insert "$_SESSION[‘user’][‘id’] = $user_id; " in somewhere here down ?

Control_login form
Events
On validate …
_____________ code _______

$var_login = sc_sql_injection({login});
$var_password = sc_sql_injection({password});

sc_lookup(ds, "select username, password from auth_user where username = $var_login and password = $var_password ");

if ({ds} != false)
{

$sm_global_login = {login};	
sc_set_global($sm_global_login);

$dir = opendir($this->Ini->path_aplicacao . "..");

while ($file = readdir($dir))
{
	if ($file != '.' && $file != '..' && $file != '_lib')
	{
	   sc_apl_status($file, 'on');
	}		
}

closedir($dir);

sc_redir('menu');	

}
else
{
sc_error_message(“Access denied !”);
}

Re: Attribute values

Hi Giovannino,

HTH = hope that helps, not my name …

My answer to your question is sc_set_global($user_id) ;-).

Re: Attribute values

Dear… RHS,

I can’t see image or wink . Also link http://royalsalutre/smf_test/Smileys/default/wink.gif doesn’t works.
Could you please send it again
Bye
Giovannino

Re: Attribute values

Hi Giovannino,

i have not send a image, but a smiley.

The red “x” is a problem from the forum software that scriptcase used. Diogo should fix this.

Re: Attribute values

Ok.

But where I have to insert “sc_set_global($user_id)”.
Thanks
Giovannino

Re: Attribute values

$var_login = sc_sql_injection({login});
$var_password = sc_sql_injection({password});

sc_lookup(ds, "select username, password from auth_user where username = $var_login and password = $var_password ");

if ({ds} != false)
{

  $sm_global_login = {login};  
  sc_set_global($sm_global_login);  <--------------LOOK HERE

  $dir = opendir($this->Ini->path_aplicacao . "..");

  while ($file = readdir($dir))
  {
   if ($file != '.' && $file != '..' && $file != '_lib')
   {
      sc_apl_status($file, 'on');
   }   
  }
  
  closedir($dir);
  
  sc_redir('menu');  
}
else
{
  sc_error_message("Access denied !");
}

You are already starting with: sc_set_global($sm_global_login);
just use [sm_global_login]