Files
Siro/backend/ride/rides/test_notification.php
Hamza-Ayed 3543fdd2cd Fix #21: High-severity fixes (H-01 through H-06)
H-01: Egypt document uploads - added path traversal prevention (basename),
       replaced HTTP_HOST with APP_DOMAIN env var
H-02: 7 remaining hardcoded /home/siro-api/ paths replaced with env vars
       (ENV_FILE_PATH, INTERNAL_SOCKET_KEY_PATH, WEBHOOK_SECRET_KEY_PATH)
H-03: serviceapp/updateDriver.php - added ownership check (user_id must match
       driverID or user must be admin); non-admins blocked from changing
       password/status/email/phone
H-04: ggg.php - replaced weak client-supplied phone auth with proper admin
       JWT authentication via JwtService
H-05: Static IV fallback in encrypt_decrypt.php already documented as legacy
H-06: Wallet shared password noted as design limitation (mitigated by
       fingerprint verification + short token TTL)
- Also fixed functions.php log message (removed hardcoded path)
2026-06-17 07:56:57 +03:00

47 lines
1.5 KiB
PHP

<?php
// test_socket_dispatch.php
$socketUrl = "http://188.68.36.205:2021";
$INTERNAL_KEY = getenv('INTERNAL_SOCKET_KEY');
if (empty($INTERNAL_KEY)) {
$keyPath = getenv('INTERNAL_SOCKET_KEY_PATH');
if ($keyPath && file_exists($keyPath)) {
$INTERNAL_KEY = trim(file_get_contents($keyPath));
}
}
// جرّب Driver ID موجود عندك
$driverId = 691;
$rideId = 99999;
// payload تجريبي (بنفس شكل اللي عم تبعته بالـ add_ride)
$payload = ["32.11153","36.0668","173.00","32.12207","36.06351","1.8064","","849a9faf3e68c1aeb708",
"حمزه عايد","TOKEN","963992952235","1.8064","1","false","1.8064","3","692","","","3","false",
"32.11153499923237,36.06680665165186","","","","","173.00","28.00","963992952235@intaleqapp.com",
"وادي أكيدر","وادي أكيدر","Fixed Price","0.00","5.0"];
$postData = [
'action' => 'dispatch_order',
'drivers_ids' => json_encode([$driverId]),
'ride_id' => $rideId,
'payload' => $payload
];
$ch = curl_init($socketUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
curl_setopt($ch, CURLOPT_HTTPHEADER, ["x-internal-key: $INTERNAL_KEY"]);
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (curl_errno($ch)) {
die("Curl error: " . curl_error($ch));
}
curl_close($ch);
echo "HTTP Code: $httpCode\n";
echo "Response: $response\n";