-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
app_key is now generated automatically upon install
- Loading branch information
1 parent
dfe9fad
commit 9293c40
Showing
4 changed files
with
80 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
{ | ||
"name": "athlon1600/php-proxy-app", | ||
"type": "project", | ||
"version": "1.0.0", | ||
"keywords": ["php proxy", "php proxy application", "php proxy web", "proxy script", "php web proxy", "web proxy"], | ||
"version": "2.0.0", | ||
"license": "MIT", | ||
"description": "Web proxy application project powered by PHP-Proxy library", | ||
"keywords": ["php proxy application", "php proxy web", "proxy script", "php web proxy", "web proxy"], | ||
"homepage": "https://www.php-proxy.com/", | ||
"require": { | ||
"athlon1600/php-proxy": "@dev" | ||
} | ||
}, | ||
"post-create-project-cmd": [ | ||
"php -f setup.txt" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
function generate_random_key(){ | ||
|
||
if(function_exists('openssl_random_pseudo_bytes')){ | ||
$random = openssl_random_pseudo_bytes(100); | ||
} else { | ||
$random = rand().microtime().rand(); | ||
} | ||
|
||
return md5($random); | ||
} | ||
|
||
$path_config = './config.php'; | ||
|
||
// config.php won't be writable if ran from within web server | ||
if(!is_writable($path_config)){ | ||
exit; | ||
} | ||
|
||
$key = generate_random_key(); | ||
|
||
// open config.php | ||
$config = file_get_contents($path_config); | ||
|
||
// replace blank app_key with new generated key | ||
$config = str_replace('$config[\'app_key\'] = \'\';', '$config[\'app_key\'] = \''.$key.'\';', $config); | ||
|
||
// write to config.php | ||
file_put_contents($path_config, $config); | ||
|
||
echo "New Key: {$key}\r\n"; | ||
|
||
?> |