Exemplo n.º 1
0
 function setPassword($oldPassword, $newPassword)
 {
     $user = UserBo::sendCommand("cat /etc/shadow | grep root");
     $re = "/^[a-z]+:\\W1\\W([0-9a-z]*)\\W([0-9a-z\\/\\.]*):/i";
     preg_match($re, $user, $matches, PREG_OFFSET_CAPTURE);
     $salt = $matches[1][0];
     $oldLinuxPassword = $this->getLinuxPassword($oldPassword, $salt);
     $newLinuxPassword = $this->getLinuxPassword($newPassword, $salt);
     $content = UserBo::sendCommand("cat /etc/shadow");
     $content = str_replace($oldLinuxPassword, $newLinuxPassword, $content);
     file_put_contents("/etc/shadow", $content);
     // 		$user = $this->getUser();
     // 		$user["password"] = $password;
     // 		$this->saveUser($user);
 }
Exemplo n.º 2
0
    You should have received a copy of the GNU General Public License
    along with Parpaing.  If not, see <http://www.gnu.org/licenses/>.
*/
session_start();
require_once 'config/config.php';
include_once "language/language.php";
require_once "engine/bo/UserBo.php";
include_once "engine/utils/bootstrap_forms.php";
require_once "engine/utils/SessionUtils.php";
$page = $_SERVER["SCRIPT_NAME"];
if (strrpos($page, "/") !== false) {
    $page = substr($page, strrpos($page, "/") + 1);
}
$page = str_replace(".php", "", $page);
$userBo = UserBo::newInstance($config);
$user = $userBo->getUser();
$isConnected = false;
if (SessionUtils::isConnected($_SESSION)) {
    $isConnected = true;
} else {
    SessionUtils::setLanguage($user["language"], $_SESSION);
    if ($page != "index" && $page != "about") {
        header("Location: index.php");
        exit;
    }
}
$language = SessionUtils::getLanguage($_SESSION);
?>
<!DOCTYPE html>
<html lang="<?php