/** * Check whether the user's last login datastore file exists or not, if not then * we try to create the file and check again the success of the operation. * * @return string Absolute filepath where the user's last login information is stored. */ function sucuriscan_lastlogins_datastore_exists() { $fpath = sucuriscan_lastlogins_datastore_filepath(); if (!file_exists($fpath)) { @file_put_contents($fpath, "<?php exit(0); ?>\n", LOCK_EX); } if (file_exists($fpath)) { return $fpath; } return false; }
/** * Check whether the user's last login datastore file exists or not, if not then * we try to create the file and check again the success of the operation. * * @return string Absolute filepath where the user's last login information is stored. */ function sucuriscan_lastlogins_datastore_exists() { $datastore_filepath = sucuriscan_lastlogins_datastore_filepath(); if (!file_exists($datastore_filepath)) { if (@file_put_contents($datastore_filepath, "<?php exit(0); ?>\n", LOCK_EX)) { @chmod($datastore_filepath, 0644); } } return file_exists($datastore_filepath) ? $datastore_filepath : false; }