forked from imabutahersiddik/CodeStore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.php
More file actions
67 lines (59 loc) · 1.83 KB
/
config.php
File metadata and controls
67 lines (59 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
// Database configuration
define('DB_HOST', 'sql307.infinityfree.com');
define('DB_NAME', 'if0_39405604_codestore');
define('DB_USER', 'if0_39405604');
define('DB_PASS', 'ewcyR11vc0z');
// File upload settings
define('UPLOAD_MAX_SIZE', 50 * 1024 * 1024); // 50MB
define('ALLOWED_IMAGE_TYPES', ['image/jpeg', 'image/png', 'image/svg+xml']);
define('ALLOWED_ARCHIVE_TYPES', ['application/zip', 'application/x-zip-compressed']);
// Cache settings
define('CACHE_ENABLED', true);
define('CACHE_DIRECTORY', __DIR__ . '/cache');
define('CACHE_DEFAULT_TTL', 3600);
// Security settings
define('SESSION_LIFETIME', 7200);
define('MAX_LOGIN_ATTEMPTS', 5);
define('LOGIN_TIMEOUT', 900);
// Site settings
define('SITE_NAME', 'Web Apps Platform');
define('SITE_URL', 'https://yourdomain.com');
define('ADMIN_EMAIL', 'admin@yourdomain.com');
// Initialize database connection
try {
$pdo = new PDO(
"mysql:host=" . DB_HOST . ";dbname=" . DB_NAME . ";charset=utf8mb4",
DB_USER,
DB_PASS,
[
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false
]
);
} catch (PDOException $e) {
die("Connection failed: " . $e->getMessage());
}
// Initialize components
require_once 'error_handler.php';
require_once 'security.php';
require_once 'cache.php';
require_once 'auth.php';
$errorHandler = new ErrorHandler();
$security = new Security();
$cache = new Cache(CACHE_DIRECTORY);
$auth = new Auth($pdo);
// Set session parameters
ini_set('session.cookie_httponly', 1);
ini_set('session.use_only_cookies', 1);
ini_set('session.cookie_secure', 1);
session_set_cookie_params([
'lifetime' => SESSION_LIFETIME,
'path' => '/',
'domain' => '',
'secure' => true,
'httponly' => true,
'samesite' => 'Lax'
]);
?>