execute a php code after a user login I see that triggers page is changed from the version 6, It's pretty wierd..
I can't find When user logs in execute a php code thing...

What I have to do is exactly that..
control some user roles depending on his location (intranet or internet)
I already have the php code developed but...can't find how to put it ....

$usr = user_load($uid);

$array_roles=array();
//supose i'm logging in from internet
    $details = array(
        'uid' =&gt; $uid,
        'roles' =&gt; array(
            21 =&gt; 'Internet' 
            )
        );

foreach($usr-&gt;roles as $key=&gt;$value) 
{

 if ($key!=20 and $key!=21) // exclude internet or intranet roles
 {

  $details['roles'][$key]=$value;
 }
}

user_save($usr, $details);
The best way to execute your custom code after a user logs in is by implementing hook_user_login in a small custom module you build yourself.  Turn that php you wrote into a function then call it.

i.e.

function module_name_user_login(&amp;$edit, $account) {
  module_name_user_function($account-&gt;uid);
}

function module_name_user_function($uid) {
$usr = user_load($uid);

$array_roles=array();
//supose i'm logging in from internet
$details = array(
    'uid' =&gt; $uid,
    'roles' =&gt; array(
        21 =&gt; 'Internet' 
        )
    );
foreach($usr-&gt;roles as $key=&gt;$value) {
  if ($key!=20 and $key!=21) {
  $details['roles'][$key]=$value;
  }
}
user_save($usr, $details);
}


More about custom modules, and modules all around can be found at The Module Developer's Guide

I would not recommend putting custom php in a trigger and action.  Keeping custom code in the database is always dangerous for people coming down the line that have to maintain your site in the future.