Файл: chat/includes/password.php
Строк: 22
<?php
/**
* @package Chat for JohnCMS
* @link http://johncms.com
* @copyright Copyright (C) 2010-2017 k_2
* @license LICENSE.txt (see attached file)
* @version VERSION.txt (see attached file)
* @author http://johncms.com/profile/?user=6251
*/
defined('_IN_JOHNCMS') or die('Error: restricted access');
if (!$id) {
header("Location: index.php");
exit;
}
switch ($mod) {
case 'new' :
/*
-----------------------------------------------------------------
Смена пароля
-----------------------------------------------------------------
*/
$_SESSION['key'] = '';
$_SESSION['salt'] = '';
header("location: $home/chat/index.php?id=$id");
break;
case 'rand' :
/*
-----------------------------------------------------------------
Присваивание сессии случайного числа
-----------------------------------------------------------------
*/
$_SESSION['nev'] = '';
$_SESSION['salt'] = '';
$_SESSION['key'] = rand(0, 1000);
header("Location: $home/chat/index.php?id=$id");
break;
default :
/*
-----------------------------------------------------------------
Сохранение пароля
-----------------------------------------------------------------
*/
$password = functions::check($_POST['password']);
$password = mb_substr($password, 0, 100);
if (!empty($password)) {
$_SESSION['key'] = md5($password);
$_SESSION['salt'] = sha1($password);
}
header("location: $home/chat/index.php?id=$id");
break;
}