Improve myTinyTodo

by Zeuf


Posted on April 25, 2017 at 4:26 PM



Working with GoogleKeep for a while, I deciced to go without and I found myTinyTodo

Here is a piece of code if you want MTT to ban an IP after 3 times without the good password.

File to modify : ajax.php

Lines to replace : From 293 to 297

				
// zeuf 25 april 2017
$allowConnect = true ;
// check if ip already banned
if ( is_file ( 'tmp/ipsbanned.txt' ) ) {
	$ipsBanned = file ( 'tmp/ipsbanned.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ) ;
	foreach ( $ipsBanned as $ipToCheck ) {
		if ( $ipToCheck == $_SERVER['REMOTE_ADDR'] ) {
			$allowConnect = false ;
		}
	}
}
if ( isset ( $_SESSION['trytolog'] ) && $_SESSION['trytolog'] >= 3 && $allowConnect ) {
	$allowConnect = false ;
	file_put_contents ( 'tmp/ipsbanned.txt', $_SERVER['REMOTE_ADDR'] . "\n", FILE_APPEND | LOCK_EX ) ;
}
// end zeuf 25 april 2017
if($password == Config::get('password') && $allowConnect) {
	$t['logged'] = 1;
	session_regenerate_id(1);
	$_SESSION['logged'] = 1;
	unset ( $_SESSION['trytolog'] ) ; // add May 25 '17
}	
// zeuf 25 april 2017
else {
	if ( isset ( $_SESSION['trytolog'] ) ) {
		$_SESSION['trytolog']++ ;
	}
	else {
		$_SESSION['trytolog'] = 1 ;
	}
}
// end zeuf 25 april 2017
				
				

Leave a Comment:

Email (confidential) :

Pseudo :

Comment :

the Search

Blog Categories

Some Ads

someday :)