إضافة كود بوابة الواتساب وملفات التهيئة والتحكم في الطريقة
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
# Protect includes directory
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
|
||||
# Block direct access to includes/
|
||||
RewriteRule ^includes/ - [F,L]
|
||||
|
||||
# Block access to config files
|
||||
RewriteRule ^config\.php$ - [F,L]
|
||||
|
||||
# Block access to hidden files
|
||||
RewriteRule (^|/)\. - [F,L]
|
||||
|
||||
# Block access to SQL files
|
||||
RewriteRule \.sql$ - [F,L]
|
||||
|
||||
# Block access to log files
|
||||
RewriteRule \.log$ - [F,L]
|
||||
</IfModule>
|
||||
|
||||
# Disable directory listing
|
||||
Options -Indexes
|
||||
|
||||
# Prevent script execution in includes
|
||||
<Directory "includes">
|
||||
php_flag engine off
|
||||
</Directory>
|
||||
@@ -102,18 +102,23 @@ $otpCode = str_pad((string) random_int(0, 9999), 4, '0', STR_PAD_LEFT);
|
||||
|
||||
// Determine delivery method
|
||||
$method = 'flash_call'; // Default fallback
|
||||
$whatsappAvailable = false;
|
||||
$methodInput = isset($input['method']) ? strtolower(trim($input['method'])) : null;
|
||||
|
||||
try {
|
||||
$whatsappAvailable = WhatsAppClient::isAvailable($phone);
|
||||
} catch (\Throwable $e) {
|
||||
error_log('WhatsApp check failed: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
if ($whatsappAvailable) {
|
||||
$method = 'whatsapp';
|
||||
if ($methodInput && in_array($methodInput, ['flash_call', 'sms', 'whatsapp', 'telegram'], true)) {
|
||||
$method = $methodInput;
|
||||
} else {
|
||||
$method = ($deviceType === 'ios') ? 'sms' : 'flash_call';
|
||||
$whatsappAvailable = false;
|
||||
try {
|
||||
$whatsappAvailable = WhatsAppClient::isAvailable($phone);
|
||||
} catch (\Throwable $e) {
|
||||
error_log('WhatsApp check failed: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
if ($whatsappAvailable) {
|
||||
$method = 'whatsapp';
|
||||
} else {
|
||||
$method = ($deviceType === 'ios') ? 'sms' : 'flash_call';
|
||||
}
|
||||
}
|
||||
|
||||
$db = Database::getInstance();
|
||||
|
||||
7
backend/composer.json
Normal file
7
backend/composer.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "intaleq/flash-call-otp",
|
||||
"description": "Flash Call OTP Backend",
|
||||
"require": {
|
||||
"vlucas/phpdotenv": "^5.5"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user