-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtools_software.php
More file actions
124 lines (109 loc) · 5.2 KB
/
tools_software.php
File metadata and controls
124 lines (109 loc) · 5.2 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
require_once 'includes/db_connect.php';
require_once 'includes/session_manager.php';
$sessionManager = SessionManager::getInstance();
// Check if user is logged in
if (!$sessionManager->isLoggedIn()) {
header("Location: login.php");
exit();
}
// Get user info including premium status
$stmt = $pdo->prepare("SELECT * FROM users WHERE id = ?");
$stmt->execute([$sessionManager->getUserId()]);
$user = $stmt->fetch();
// Function to check if user is premium
function isPremium($user) {
return isset($user['is_premium']) && $user['is_premium'] &&
(!isset($user['premium_until']) || strtotime($user['premium_until']) > time());
}
// Get tools and software
$stmt = $pdo->prepare("
SELECT t.*,
(SELECT COUNT(*) FROM tool_ratings WHERE tool_id = t.id) as rating_count,
(SELECT AVG(rating) FROM tool_ratings WHERE tool_id = t.id) as avg_rating
FROM tools t
WHERE t.status = 'active'
ORDER BY t.created_at DESC
");
$stmt->execute();
$tools = $stmt->fetchAll();
// Tool categories
$categories = [
'productivity' => 'Productivity Tools',
'marketing' => 'Marketing Tools',
'finance' => 'Financial Tools',
'design' => 'Design Tools',
'communication' => 'Communication Tools',
'analytics' => 'Analytics Tools'
];
// Set page title and any additional styles
$pageTitle = 'Tools & Software';
$additionalStyles = '
.tool-card {
transition: transform 0.3s ease-in-out;
}
.tool-card:hover {
transform: translateY(-5px);
}
';
include 'includes/head.php';
?>
<?php include 'includes/header.php'; ?>
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
<div class="text-center mb-12">
<h1 class="text-4xl font-bold text-gray-900 dark:text-white mb-4">Tools & Software</h1>
<p class="text-lg text-gray-600 dark:text-gray-400">
Discover powerful tools and software to enhance your Sidestacker gameplay and strategy.
</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
<?php foreach ($tools as $tool): ?>
<div class="tool-card bg-white dark:bg-gray-800 rounded-lg shadow-lg overflow-hidden">
<div class="p-6">
<div class="flex items-center justify-between mb-4">
<h3 class="text-xl font-semibold text-gray-900 dark:text-white">
<?php echo htmlspecialchars($tool['name']); ?>
</h3>
<?php if ($tool['type'] === 'premium'): ?>
<span class="px-3 py-1 text-sm font-medium text-white bg-gradient-to-r from-blue-600 to-purple-600 rounded-full">
Premium
</span>
<?php endif; ?>
</div>
<p class="text-gray-600 dark:text-gray-400 mb-4">
<?php echo htmlspecialchars($tool['description']); ?>
</p>
<div class="flex items-center justify-between mb-4">
<div class="flex items-center">
<i class="<?php echo htmlspecialchars($tool['icon_class']); ?> text-gray-400 mr-2"></i>
<span class="text-sm text-gray-500 dark:text-gray-400">
<?php echo isset($categories[$tool['category']]) ? $categories[$tool['category']] : ucfirst($tool['category']); ?>
</span>
</div>
<?php if ($tool['rating_count'] > 0): ?>
<div class="flex items-center">
<i class="fas fa-star text-yellow-400 mr-1"></i>
<span class="text-sm text-gray-600 dark:text-gray-400">
<?php echo number_format($tool['avg_rating'], 1); ?>
(<?php echo $tool['rating_count']; ?> reviews)
</span>
</div>
<?php endif; ?>
</div>
<?php if ($tool['type'] === 'premium' && !isPremium($user)): ?>
<a href="premium.php" class="block w-full text-center px-4 py-2 bg-gradient-to-r from-blue-600 to-purple-600 text-white rounded-md hover:opacity-90 transition-opacity">
Upgrade to Access
</a>
<?php else: ?>
<a href="tools/<?php echo htmlspecialchars($tool['slug']); ?>" class="block w-full text-center px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors">
Use Tool
</a>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php include 'includes/footer.php'; ?>
</body>
</html>