bug fixing minor improvements
This commit is contained in:
@@ -10,7 +10,13 @@
|
||||
terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or later.
|
||||
|
||||
Please see the LICENSE file for more information.
|
||||
Fat-Free Framework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with Fat-Free Framework. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
@@ -137,8 +143,9 @@ class Session extends Mapper {
|
||||
* @param $db object
|
||||
* @param $table string
|
||||
* @param $force bool
|
||||
* @param $onsuspect callback
|
||||
**/
|
||||
function __construct(\DB\SQL $db,$table='sessions',$force=TRUE) {
|
||||
function __construct(\DB\SQL $db,$table='sessions',$force=TRUE,$onsuspect=NULL) {
|
||||
if ($force) {
|
||||
$eol="\n";
|
||||
$tab="\t";
|
||||
@@ -178,8 +185,12 @@ class Session extends Mapper {
|
||||
($agent=$this->agent()) &&
|
||||
(!isset($headers['User-Agent']) ||
|
||||
$agent!=$headers['User-Agent'])) {
|
||||
session_destroy();
|
||||
$fw->error(403);
|
||||
if (isset($onsuspect))
|
||||
$fw->call($onsuspect,array($this));
|
||||
else {
|
||||
session_destroy();
|
||||
$fw->error(403);
|
||||
}
|
||||
}
|
||||
$csrf=$fw->hash($fw->get('ROOT').$fw->get('BASE')).'.'.
|
||||
$fw->hash(mt_rand());
|
||||
|
||||
Reference in New Issue
Block a user