X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fgen_sql_patches.php;h=d853f1ca8d9b9b1b56619e90b1827f27d2c1db99;hp=8fd4b43047bacaad899070e04138e004578b25f6;hb=4b7f401f2a4680ae46ca41c57f749cfe35163660;hpb=7ff28f7292939ad1a61b9b7a4e3398ff6310a3d0;ds=sidebyside diff --git a/inc/gen_sql_patches.php b/inc/gen_sql_patches.php index 8fd4b43047..d853f1ca8d 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); - // Don't miss the admin hash here... - $passHash = generatePassString(get_session('admin_md5')); - set_session('admin_md5', $passHash); - } -} + // Remove variables + unset($secretKey); + unset($fileHash); + } // END - if +} // END - if -// -?> \ No newline at end of file +// [EOF] +?>