Fixed emial sending links to support ajax call.
[fa-stable.git] / install / save.php
index b11263a3e3d2836ac75ae25fa4d495e9ecaeb1e8..1e568b653d8d6a9f4a399fccb0f899d1bb1b4712 100644 (file)
@@ -27,7 +27,8 @@ if (!function_exists("_")) {
 //
 function display_error($message)
 {
-       global $_POST;
+       global $_POST, $path_to_root;
+
        if(isset($message) AND $message != '')
        {
                // Copy values entered into session so user doesn't have to re-enter everything
@@ -53,6 +54,7 @@ function display_error($message)
                // Specify that session support is enabled
                $_SESSION['session_support'] = '<font class="good">Enabled</font>';
                // Redirect to first page again and exit
+               @unlink($path_to_root."/config.php"); // remove just created config file
                header('Location: index.php?sessions_checked=true');
                exit();
        }
@@ -263,7 +265,7 @@ if (!isset($_POST['admin_email']) || $_POST['admin_email'] == '')
 }
 else
 {
-       if (eregi("^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$", $_POST['admin_email']))
+       if (preg_match("/^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$/i", $_POST['admin_email']))
        {
                $admin_email = $_POST['admin_email'];
        }
@@ -295,9 +297,7 @@ if ($admin_password != $admin_repassword)
 }
 // End admin user details code
 
-if (!file_exists($path_to_root . "/config.php")) {
-       copy($path_to_root. "/config.default.php", $path_to_root. "/config.php");
-}
+copy($path_to_root. "/config.default.php", $path_to_root. "/config.php");
 
 include_once($path_to_root . "/includes/db/connect_db.inc");
 include_once($path_to_root . "/admin/db/maintenance_db.inc");
@@ -382,8 +382,10 @@ if (!$db)
 }
 
 session_unset();
+session_regenerate_id();
 session_destroy();
 $_SESSION = array();
+
 header("Location: ".$path_to_root."/index.php");
 exit();