<?php
/**
 * @package linea21.core
 * @subpackage user
 * @author linea21 <info@linea21.com>
 * @version $id SVN
 * @access public
 * @license http://opensource.org/licenses/gpl-3.0.html
 */

//////////// Check Inclusion de pages ////////////
if (!function_exists('AuthenthificationProcess')) {
    include_once("../lib/lib_common.php");
    ReloadIndex('admin');
} 
////////////

//////////// Check Droits utilisateur ////////////
if (!IsSuperAdmin()) ReloadIndex('admin');
////////////

if(isset($_POST['id']))	$id=$_POST['id'];
if(isset($_GET['id']))	$id=$_GET['id'];

$requete=SQL_getAllUserInfo($id);
$result=$sql_object->DBSelect($requete);
if($result==0 || count($result)!=1) exit;
$user_email=$result[0]['profile_email'];

$user_object= new user;
$new_pass=$user_object->GetNewPassword();
/** include envoi de mail */
$todo_mail='change_pass';
include_once('../user/mail_actions.php');
include_once('../mail/template.php');
/** end mail */
$result=$user_object->UpdateUserPassword($id, $new_pass, $sql_object);
$link_confirm="confirm.php?rub=".$rub."&todo=".$todo;
if($result) header("Location: ".$link_confirm);
else  system_error();
?>