Create cookie.txt file if possible, and add better errors if not creatable or writable. Fixes #3
This commit is contained in:
@@ -27,8 +27,15 @@ function login($usr, $pwd){
|
|||||||
|
|
||||||
$cookie_file_path = 'cookies.txt';
|
$cookie_file_path = 'cookies.txt';
|
||||||
|
|
||||||
if (!file_exists($cookie_file_path) || !is_writable($cookie_file_path)){
|
if (!file_exists($cookie_file_path)){
|
||||||
echo 'Cookie file missing or not writable.';
|
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;
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user