Bug : fix security , clean completely the session and prevent to set the menu
public to an user
This commit is contained in:
parent
c6288ceaf1
commit
e6e1bf24b4
5 changed files with 36 additions and 9 deletions
|
|
@ -37,7 +37,10 @@ if (defined('MULTI') && MULTI == 0)
|
|||
|
||||
if ( isset ($_POST["p_user"] ) )
|
||||
{
|
||||
|
||||
$http=new HttpInput();
|
||||
|
||||
// clean OLD session
|
||||
User::clean_session($http->post("p_user"));
|
||||
$User=new User($rep);
|
||||
$User->Check(false,'LOGIN');
|
||||
|
||||
|
|
|
|||
|
|
@ -23,14 +23,15 @@
|
|||
require_once '../include/constant.php';
|
||||
require_once ("lib/ac_common.php");
|
||||
require_once('class/database.class.php');
|
||||
session_unset();
|
||||
|
||||
html_page_start("classic");
|
||||
|
||||
/* clean Global variable */
|
||||
|
||||
if ( isset ($g_user) ) unset ($GLOBAL['g_user']);
|
||||
if ( isset ($g_pass) ) unset ($GLOBAL['g_pass']);
|
||||
if(DEBUGNOALYSS>1) {
|
||||
echo h1(_("try to clean session"));
|
||||
var_dump($_SESSION);
|
||||
}
|
||||
User::clean_session();
|
||||
//
|
||||
// Clean the possible cookies
|
||||
//
|
||||
|
|
@ -44,7 +45,13 @@ if (isset($_SERVER['HTTP_COOKIE'])) {
|
|||
}
|
||||
}
|
||||
echo '<h2 class="info">'._('Vous êtes déconnecté').'</h2>';
|
||||
echo '<META HTTP-EQUIV="REFRESH" content="0;url=index.html">';
|
||||
|
||||
if(DEBUGNOALYSS>1) {
|
||||
echo h1(_("Session after cleansing"));
|
||||
var_dump($_SESSION);
|
||||
|
||||
} else {
|
||||
echo '<META HTTP-EQUIV="REFRESH" content="0;url=index.html">';
|
||||
}
|
||||
html_page_stop();
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -118,7 +118,9 @@ if ($op=="profile")
|
|||
$value=$http->post("value");
|
||||
// save profile
|
||||
$sec_User=new User($cn, $user_id);
|
||||
$sec_User->save_profile($value);
|
||||
if ( $value > 0) {
|
||||
$sec_User->save_profile($value);
|
||||
}
|
||||
$ie_input=Inplace_Edit::build($input);
|
||||
$ie_input->set_callback("ajax_misc.php");
|
||||
$ie_input->add_json_param("op", "profile");
|
||||
|
|
|
|||
|
|
@ -1782,7 +1782,22 @@ class User
|
|||
}
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
* @brief clean the sessions
|
||||
*/
|
||||
static function clean_session()
|
||||
{
|
||||
|
||||
$aSession=$_SESSION;
|
||||
foreach($aSession as $key => $value) {
|
||||
if(DEBUGNOALYSS>1) { echo "[$key]=>[$value]";}
|
||||
|
||||
if ( strpos($key,SESSION_KEY) === 0) {
|
||||
unset($_SESSION[$key]);
|
||||
if(DEBUGNOALYSS>1) { echo "=> [$key] cleaned";}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -136,7 +136,7 @@ if ( isset ($_GET["action"] ))
|
|||
if ( $action == "view" )
|
||||
{
|
||||
$l_Db=sprintf("dossier%d",$gDossier);
|
||||
$return= HtmlInput::button_anchor(_('Retour à la liste'),'?&ac='.$http->request('ac').'&'.dossier::get(),_('retour'),"",'smallbutton');
|
||||
$return= HtmlInput::button_anchor(_('Retour à la liste'),'?&ac='.$http->request('ac').'&'.dossier::get(),_('retour'),"",'button');
|
||||
|
||||
$repo=new Database();
|
||||
$user_id=$http->get('user_id',"number");
|
||||
|
|
@ -203,7 +203,7 @@ if ( $action == "view" )
|
|||
echo HtmlInput::hidden('user_id',$user_id);
|
||||
$i_profile=new ISelect ('profile');
|
||||
$i_profile->id=uniqid("profile");
|
||||
$i_profile->value=$cn->make_array("select p_id,p_name from profile
|
||||
$i_profile->value=$cn->make_array("select p_id,p_name from profile where p_id > 0
|
||||
order by p_name");
|
||||
|
||||
$i_profile->selected=$sec_User->get_profile();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue