feat: Secure SMS verification with Redis (Predis)
- Added Predis library for Redis connection (no PHP extension required) - Server-side SMS code generation and storage in Redis - Rate limiting and brute-force protection - Integration with n8n webhook for SMS sending - Environment variables moved to .env file - Fixed policy verification endpoint - Added file-based fallback if Redis unavailable
This commit is contained in:
34
test_redis.php
Normal file
34
test_redis.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
header('Content-Type: text/plain; charset=utf-8');
|
||||
|
||||
echo "PHP Version: " . PHP_VERSION . "\n";
|
||||
echo "SAPI: " . php_sapi_name() . "\n";
|
||||
echo "extension_loaded('redis'): " . (extension_loaded('redis') ? 'YES' : 'NO') . "\n";
|
||||
echo "class_exists('Redis'): " . (class_exists('Redis') ? 'YES' : 'NO') . "\n";
|
||||
|
||||
if (class_exists('Redis')) {
|
||||
try {
|
||||
$redis = new Redis();
|
||||
$host = 'crm.clientright.ru';
|
||||
$port = 6379;
|
||||
$connected = @$redis->connect($host, $port, 2);
|
||||
if ($connected) {
|
||||
echo "Redis connection: SUCCESS\n";
|
||||
$ping = $redis->ping();
|
||||
echo "Redis ping: " . var_export($ping, true) . "\n";
|
||||
} else {
|
||||
echo "Redis connection: FAILED\n";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo "Redis error: " . $e->getMessage() . "\n";
|
||||
}
|
||||
} else {
|
||||
echo "Redis class not available\n";
|
||||
echo "Loaded extensions:\n";
|
||||
$extensions = get_loaded_extensions();
|
||||
foreach ($extensions as $ext) {
|
||||
if (stripos($ext, 'redis') !== false) {
|
||||
echo " - $ext\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user