Archived
1
0

Create cookie.txt file if possible, and add better errors if not creatable or writable. Fixes #3

This commit is contained in:
James Stuckey Weber
2015-06-19 00:47:37 +00:00
parent 96f9742e3c
commit 4aea80bda2

View File

@@ -27,8 +27,15 @@ function login($usr, $pwd){
$cookie_file_path = 'cookies.txt';
if (!file_exists($cookie_file_path) || !is_writable($cookie_file_path)){
echo 'Cookie file missing or not writable.';
if (!file_exists($cookie_file_path)){
fopen($cookie_file_path, "w");
if (!file_exists($cookie_file_path)){
echo "Cookie file missing and can't be created.\n";
die;
}
}
if(!is_writable($cookie_file_path)){
echo 'Cookie file not writable- chmod to the user writing the script\n.';
die;
}