문제

Is this expression is safe or does this approach has vulnerabilities?

$pdo = new PDO('mysql:host=localhost;dbname=test', 'user', 'password');
$pdo->exec('SET time_zone = "' . date_default_timezone_get() . '"');

올바른 솔루션이 없습니다

다른 팁

I would check first if date_default_timezone_get() returns a valid value, to avoid a query like: SET time_zone = "".

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top