View ProjeQtOr On SourceForge.net
ProjeQtOr - Project Management Tool
Support us on Capterra
OIN - Open Invention Network
ProjeQtOr free project management software - Login method - ProjeQtOr
 
 

Login method

More
06 Jul 2011 10:00 #1 by Nicolas
Login method was created by Nicolas
Hi,
I'd like to know how the process of connection work in php code.
I'd like to make a second way to connect users. I've made an sso-like in my applications and i would like to make a link to pass through the connection process with the 'Id' of the user. Some thing like:
http://localhost/projectoria/login.php?id=4 to connect the user who have the Id=4 in table 'user' (in reality I use the Id with sha1 encryption to don't give clear Id in url).

Thanks.

Please Log in or Create an account to join the conversation.

More
07 Jul 2011 10:34 #2 by Nicolas
Replied by Nicolas on topic RE : Login method
I find a solution. I've change the /tool/loginCheck.php file.
My projectoria application is on url : http://localhost/projectoria
I use another application on url http://localhost/cms. In this application when one user is connected he can click on a link wich contain 2 parameters : first is "change=true" and second is "changeid=xxx" xxx is the user id in table user of database of projectoria. This id is crypted by sha1.
So i change loginCheck like that:
$change="";
$changeid="";
$login="";
$password="";
if (array_key_exists('login',$_POST)) {
$login=$_POST;
}
if (array_key_exists('password',$_POST)) {
$password=$_POST;
}
if (array_key_exists('change',$_GET)) {
$change=$_GET;
}
if (array_key_exists('changeid',$_GET)) {
$changeid=$_GET;
}
if ($login=="" && $change != "true") {
loginError();
}
if ($password=="" && $change != "true") {
loginError();
}

$obj=new User();
if($change == "true"){
$users=$obj->getSqlElementsFromCriteria(false,false,'sha1(id)=\''.$changeid.'\'');
}else{
$crit=array('name'=>$login, 'password'=>md5($password));
$users=$obj->getSqlElementsFromCriteria($crit,true);
}
.......
function loginOk ($user) {
global $login;
global $change;
$_SESSION=$user;
$crit=array();
$crit=$user->id;
$crit=null;
$obj=new Parameter();
$objList=$obj->getSqlElementsFromCriteria($crit,false);
foreach($objList as $obj) {
if ($obj->parameterCode=='lang') {
$_SESSION=$obj->parameterValue;
$i18nMessages=null;
} else if ($obj->parameterCode=='defaultProject') {
$prj=new Project($obj->parameterValue);
if ($prj->name!=null and $prj->name!='') {
$_SESSION=$obj->parameterValue;
} else {
$_SESSION='*';
}
} else {
$_SESSION[$obj->parameterCode]=$obj->parameterValue;
}
}
if($change == "true"){
header("Location: http://localhost/projectoria");
}
echo '<span class="messageOK">';
echo i18n('loginOK');
echo '<div id="validated" name="validated" type="hidden" dojoType="dijit.form.TextBox">OK';
echo '</div>';
echo '</span>';
traceLog("NEW CONNECTED USER '" . $login . "'");
}

Please Log in or Create an account to join the conversation.

Moderators: babynusprotion
Time to create page: 0.033 seconds

Cookies settings

×

Functional Cookies

Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.

Session

Please login to see yours activities!

Other cookies

Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.