Permalink
Browse files

Self Generating Config.php

  • Loading branch information...
1 parent b1e9aa3 commit 8101f51970323d2acd837a88881290a39cb406e5 @linickx committed Jun 2, 2011
Showing with 14 additions and 6 deletions.
  1. +2 −2 php/index.php
  2. +12 −4 php/setup.php
View
@@ -6,13 +6,13 @@
**/
- if (!file_exists("./config.php")) {
+ if (!file_exists("../data/config.php")) {
require_once("./setup.php"); // If no Config - run setup
exit;
} else {
- require_once("./config.php"); // require our config file
+ require_once("../data/config.php"); // require our config file
}
if (isset($_GET['k'])) {
View
@@ -10,11 +10,19 @@
$randomstring = base_convert($n, 10, 36);
$ProviderSalt = hash('sha256', $randomstring);
- echo $ProviderSalt;
+ $ConfigString = '<?php $ProviderSalt = "';
+ $ConfigString .= $ProviderSalt;
+ $ConfigString .= '" ?>;';
- #if (!$handle = fopen("./config.php", 'a')) {
- # echo "Cannot write file (config.php)";
- #}
+ if (!$handle = fopen("../data/config.php", 'a')) {
+ die('cannot write config.php');
+
+ }
+ if(!fwrite($handle,$ConfigString)) {
+ die('cannot save config.php');
+ }
+
+ require_once("./welcome.php");
?>

0 comments on commit 8101f51

Please sign in to comment.