X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=inc%2Fgen_sql_patches.php;h=a358c8d74a31730107d78eb09ce915688c3d742c;hb=c9eeea4ffb9f186fb8d5207542a0bb0da7028f83;hp=98337f0f3c55565e050416eeffe2223629929e26;hpb=f9a9c09e1ae257449bfd98f8854e321efba1dc3c;p=mailer.git
diff --git a/inc/gen_sql_patches.php b/inc/gen_sql_patches.php
index 98337f0f3c..a358c8d74a 100644
--- a/inc/gen_sql_patches.php
+++ b/inc/gen_sql_patches.php
@@ -1,7 +1,7 @@
Cookie: ".get_session('u_hash')."
Test: ".$test);
-
- // Write $file_hash to database
- $result = SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_config` SET file_hash='%s' WHERE config=0 LIMIT 1",
- array($file_hash), __FILE__, __LINE__);
-
- // Also create .htaccess file
- $fp = @fopen(PATH."inc/.secret/.htaccess", 'w') or mxchange_die("Cannot write to .htaccess file!");
- if ($fp != false) {
- // Add deny line to file
- fwrite($fp, "Deny from all");
-
- // Close the file
- fclose($fp);
+ writeToFile($FQFN, $secretKey);
+
+ // Is the file there?
+ if (isFileReadable($FQFN)) {
+ //* DEBUG: */ removeFile($FQFN);
+ //* DEBUG: */ $test = hexdec(getSession('u_hash')) / hexdec($secretKey);
+ //* DEBUG: */ $test = generateHash(str_replace('.', '', $test));
+ //* DEBUG: */ die("Secret-Key: ".$secretKey."
Cookie: ".getSession('u_hash')."
Test: ".$test);
+
+ // Write $fileHash to database
+ updateConfiguration('file_hash', $fileHash);
+
+ // Generate FQFN for .htaccess file
+ $FQFN = sprintf("%sinc/.secret/.htaccess",
+ getConfig('PATH')
+ );
+
+ // Is the .htaccess file there?
+ if (!isFileReadable($FQFN)) {
+ // Also create .htaccess file
+ writeToFile($FQFN, "Deny from all\n");
} // END - if
// Also update configuration
- $_CONFIG['secret_key'] = $secretKey; unset($secretKey);
- $_CONFIG['file_hash'] = $file_hash; unset($file_hash);
+ setConfigEntry('secret_key', $secretKey);
+
+ // Remove variables
+ unset($secretKey);
+ unset($fileHash);
} // END - if
} // END - if