Update: 2026-06-11 18:22:57

This commit is contained in:
Hamza-Ayed
2026-06-11 18:22:59 +03:00
parent c5170a88d2
commit 727068b668
629 changed files with 46050 additions and 46109 deletions

View File

@@ -0,0 +1,292 @@
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>الدليل التفاعلي للتكامل بين Intaleq و MTN</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap" rel="stylesheet">
<style>
body { font-family: 'Tajawal', sans-serif; scroll-behavior: smooth; }
.code-block { background-color: #1e293b; color: #e2e8f0; padding: 1rem; border-radius: 0.5rem; direction: ltr; text-align: left; font-family: 'Courier New', Courier, monospace; }
.tab-active { border-color: #3b82f6; color: #3b82f6; background-color: #eff6ff; }
.tab-inactive { border-color: transparent; color: #4b5563; }
.endpoint-section { display: none; }
.endpoint-section.active { display: block; }
.flow-step { position: relative; padding-right: 40px; }
.flow-step:not(:last-child)::before { content: ''; position: absolute; right: 15px; top: 40px; bottom: -20px; width: 2px; background-color: #d1d5db; }
.flow-number { position: absolute; right: 0; top: 0; width: 32px; height: 32px; }
</style>
</head>
<body class="bg-slate-50 text-slate-800">
<div class="max-w-6xl mx-auto p-4 md:p-8">
<header class="text-center mb-12">
<div class="inline-block bg-blue-600 text-white p-4 rounded-full shadow-lg mb-4">
<svg xmlns="http://www.w3.org/2000/svg" class="h-10 w-10" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" /></svg>
</div>
<h1 class="text-4xl font-extrabold text-slate-900">الدليل التفاعلي للتكامل بين Intaleq و MTN</h1>
<p class="mt-4 text-lg text-slate-600 max-w-3xl mx-auto">دليلك الكامل لفهم واختبار آلية الدفع عبر MTN. تم تصميم هذا الدليل لتسهيل عملية التطوير وضمان تكامل سلس وفعال.</p>
</header>
<div class="bg-white p-8 rounded-2xl shadow-lg border border-slate-200">
<!-- Flow Section -->
<section id="flow" class="mb-12">
<h2 class="text-2xl font-bold mb-6 border-r-4 border-blue-500 pr-4">آلية عمل دورة الدفع</h2>
<div class="space-y-8">
<div class="flow-step">
<div class="flow-number flex items-center justify-center bg-slate-200 text-slate-600 rounded-full font-bold text-lg">1</div>
<h3 class="font-bold text-lg text-slate-800">إنشاء الفاتورة</h3>
<p class="text-slate-600">يبدأ المستخدم (سائق/راكب) عملية الدفع من تطبيق Intaleq، فيقوم نظامنا بإنشاء فاتورة داخلية بحالة "انتظار".</p>
</div>
<div class="flow-step">
<div class="flow-number flex items-center justify-center bg-slate-200 text-slate-600 rounded-full font-bold text-lg">2</div>
<h3 class="font-bold text-lg text-slate-800">استعلام MTN</h3>
<p class="text-slate-600">عندما يقوم المستخدم بفتح تطبيق MTN Cash Mobile للدفع، يقوم سيرفر MTN بإرسال طلب استعلام إلى سيرفرنا باستخدام رقم هاتف المستخدم للتحقق من وجود فاتورة معلقة وقيمتها.</p>
</div>
<div class="flow-step">
<div class="flow-number flex items-center justify-center bg-slate-200 text-slate-600 rounded-full font-bold text-lg">3</div>
<h3 class="font-bold text-lg text-slate-800">تأكيد الدفع</h3>
<p class="text-slate-600">بعد أن يكمل المستخدم عملية الدفع بنجاح في تطبيق MTN، يقوم سيرفر MTN بإرسال طلب تأكيد (Webhook) إلى سيرفرنا يحتوي على تفاصيل العملية الناجحة.</p>
</div>
<div class="flow-step">
<div class="flow-number flex items-center justify-center bg-green-500 text-white rounded-full font-bold text-lg">4</div>
<h3 class="font-bold text-lg text-slate-800">إتمام العملية</h3>
<p class="text-slate-600">يتحقق سيرفرنا من صحة طلب التأكيد، ويقوم بتحديث حالة الفاتورة إلى "مكتملة"، ثم يضيف الرصيد تلقائياً إلى محفظة المستخدم في تطبيق Intaleq.</p>
</div>
</div>
</section>
<!-- Security Section -->
<section id="security" class="mb-12 p-6 bg-slate-100 rounded-xl">
<h2 class="text-2xl font-bold mb-4 border-r-4 border-blue-500 pr-4">آلية الحماية والتوثيق</h2>
<p class="text-slate-700 mb-4">لضمان أن جميع الطلبات تأتي من مصدر موثوق (سيرفرات MTN حصراً)، نعتمد على آلية المفتاح السري المشترك (Shared Secret Key). يجب على سيرفراتكم إرسال هذا المفتاح في كل طلب يتم إرساله إلى نقاط النهاية الخاصة بنا.</p>
<div class="bg-white p-4 rounded-lg shadow-sm">
<p class="font-semibold">الهيدر المطلوب: <code class="text-red-600">X-AUTH-TOKEN</code></p>
<div class="bg-orange-50 border border-orange-200 p-3 rounded-md mt-2">
<p class="text-sm text-orange-800 font-medium">سيتم تزويدكم بالمفتاح السري (Secret Key) بشكل آمن عبر قنوات التواصل الرسمية.</p>
</div>
</div>
</section>
<!-- IP Whitelisting Section -->
<section id="ip-whitelisting" class="mb-12 p-6 bg-yellow-50 border border-yellow-300 rounded-xl">
<div class="flex items-start">
<div class="flex-shrink-0">
<svg class="h-6 w-6 text-yellow-500" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>
</div>
<div class="mr-4">
<h2 class="text-2xl font-bold mb-4 border-r-4 border-yellow-500 pr-4">زيادة مستوى الأمان: القائمة البيضاء (IP Whitelisting)</h2>
<p class="text-yellow-800 mb-3">للوصول إلى أعلى مستويات الأمان وحماية التكامل، نعتمد آلية القائمة البيضاء لعناوين IP. هذه الآلية تضمن أن سيرفراتنا لن تقبل الطلبات إلا من سيرفرات MTN المصرح بها حصراً.</p>
<div class="bg-white p-4 rounded-lg shadow-sm border border-yellow-200">
<p class="font-bold text-slate-800">الإجراء المطلوب:</p>
<p class="mt-2 text-slate-700">نرجو منكم تزويدنا بقائمة ثابتة وكاملة لجميع عناوين IP العامة (Public IPs) التي تستخدمونها لإرسال الطلبات إلى نقاط النهاية الخاصة بنا، ليقوم فريقنا بإضافتها إلى جدار الحماية.</p>
</div>
</div>
</div>
</section>
<!-- API Endpoints Section -->
<section id="api-endpoints">
<h2 class="text-2xl font-bold mb-6 border-r-4 border-blue-500 pr-4">نقاط النهاية (API Endpoints)</h2>
<div class="flex border-b border-slate-200 mb-6">
<button class="api-tab p-4 text-lg font-semibold border-b-2 tab-active" onclick="showEndpoint('query')">1. الاستعلام عن فاتورة</button>
<button class="api-tab p-4 text-lg font-semibold border-b-2 tab-inactive" onclick="showEndpoint('webhook')">2. تأكيد الدفع (Webhook)</button>
</div>
<!-- Query Invoice Endpoint -->
<div id="query-section" class="endpoint-section active">
<h3 class="text-xl font-bold mb-2">نقطة النهاية: الاستعلام عن فاتورة</h3>
<p class="mb-4 text-slate-600">تستخدمها سيرفرات MTN للتحقق من وجود فاتورة معلقة لمستخدم معين قبل عرضها له في تطبيق الدفع.</p>
<div class="grid md:grid-cols-2 gap-6">
<div>
<h4 class="font-semibold mb-2">تفاصيل الطلب:</h4>
<div class="bg-slate-50 p-4 rounded-lg border border-slate-200 space-y-3">
<p><strong>Method:</strong> <span class="bg-sky-100 text-sky-800 font-mono text-sm font-bold mr-2 px-2.5 py-0.5 rounded">GET</span></p>
<div>
<p><strong>URL:</strong></p>
<div class="flex items-center">
<code class="text-sm break-all flex-grow" id="queryUrl">https://walletintaleq.intaleq.xyz/v1/main/ride/mtn_new/query_mtn_invoice.php</code>
<button onclick="copyToClipboard('queryUrl')" class="text-blue-500 hover:text-blue-700 text-xs mr-2 flex-shrink-0">نسخ</button>
</div>
</div>
<p><strong>Header:</strong> <code class="text-sm">X-AUTH-TOKEN: [المفتاح السري]</code></p>
<p><strong>Query Parameter:</strong></p>
<ul class="list-disc pr-6 text-sm">
<li><code>phone_number</code> (إلزامي): رقم هاتف المستخدم.</li>
</ul>
</div>
</div>
<div>
<h4 class="font-semibold mb-2">جرّب الآن:</h4>
<div class="space-y-4">
<div>
<label for="query-phone" class="block text-sm font-medium text-slate-700">رقم الهاتف:</label>
<input type="text" id="query-phone" class="mt-1 block w-full px-3 py-2 bg-white border border-slate-300 rounded-md text-sm shadow-sm placeholder-slate-400 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500" placeholder="e.g., 9639xxxxxxxx">
</div>
<button onclick="testQuery()" class="w-full bg-blue-600 text-white font-bold py-2 px-4 rounded-lg hover:bg-blue-700 transition duration-300">إرسال طلب استعلام</button>
</div>
</div>
</div>
<div class="mt-6">
<h4 class="font-semibold mb-2">الاستجابات المتوقعة:</h4>
<pre id="query-response" class="code-block min-h-[100px]"><code>// The response from the server will appear here...</code></pre>
</div>
</div>
<!-- Webhook Handler Endpoint -->
<div id="webhook-section" class="endpoint-section">
<h3 class="text-xl font-bold mb-2">نقطة النهاية: تأكيد الدفع (Webhook)</h3>
<p class="mb-4 text-slate-600">بعد إتمام الدفع، يجب على سيرفرات MTN إرسال طلب إلى نقطة النهاية هذه لتأكيد العملية وإضافة الرصيد للمستخدم.</p>
<div class="grid md:grid-cols-2 gap-6">
<div>
<h4 class="font-semibold mb-2">تفاصيل الطلب:</h4>
<div class="bg-slate-50 p-4 rounded-lg border border-slate-200 space-y-3">
<p><strong>Method:</strong> <span class="bg-green-100 text-green-800 font-mono text-sm font-bold mr-2 px-2.5 py-0.5 rounded">POST</span></p>
<div>
<p><strong>URL:</strong></p>
<div class="flex items-center">
<code class="text-sm break-all flex-grow" id="webhookUrl">https://walletintaleq.intaleq.xyz/v1/main/ride/mtn_new/mtn_webhook_handler.php</code>
<button onclick="copyToClipboard('webhookUrl')" class="text-blue-500 hover:text-blue-700 text-xs mr-2 flex-shrink-0">نسخ</button>
</div>
</div>
<p><strong>Header:</strong> <code class="text-sm">X-AUTH-TOKEN: [المفتاح السري]</code></p>
<p><strong>Body (JSON):</strong> انظر هيكل البيانات أدناه.</p>
</div>
</div>
<div>
<h4 class="font-semibold mb-2">جرّب الآن:</h4>
<div class="space-y-4">
<div>
<label for="webhook-invoice" class="block text-sm font-medium text-slate-700">رقم الفاتورة:</label>
<input type="text" id="webhook-invoice" class="mt-1 block w-full px-3 py-2 bg-white border border-slate-300 rounded-md text-sm shadow-sm" value="MTN-FAKE-12345">
</div>
<button onclick="testWebhook()" class="w-full bg-blue-600 text-white font-bold py-2 px-4 rounded-lg hover:bg-blue-700 transition duration-300">إرسال طلب تأكيد</button>
</div>
</div>
</div>
<div class="mt-6">
<h4 class="font-semibold mb-2">هيكل JSON Body والاستجابات المتوقعة:</h4>
<pre id="webhook-response" class="code-block min-h-[200px]"><code>// The response from the server will appear here...
// Example Request Body:
{
"invoice_number": "MTN-FAKE-12345",
"transaction_id": "MTN_TRX_ABC123456",
"amount_paid": 50000.00,
"status": "success",
"payment_timestamp": "2023-03-15T12:00:00Z"
}</code></pre>
</div>
</div>
</section>
</div>
<footer class="text-center mt-8 text-sm text-slate-500">
<p>&copy; 2025 Intaleq. All rights reserved.</p>
</footer>
</div>
<script>
function showEndpoint(endpoint) {
document.querySelectorAll('.endpoint-section').forEach(section => {
section.classList.remove('active');
});
document.getElementById(endpoint + '-section').classList.add('active');
document.querySelectorAll('.api-tab').forEach(tab => {
tab.classList.remove('tab-active');
tab.classList.add('tab-inactive');
});
event.currentTarget.classList.add('tab-active');
event.currentTarget.classList.remove('tab-inactive');
}
function copyToClipboard(elementId) {
const text = document.getElementById(elementId).innerText;
navigator.clipboard.writeText(text).then(() => {
alert('تم نسخ: ' + text);
}, (err) => {
alert('فشل النسخ: ', err);
});
}
function testQuery() {
const phone = document.getElementById('query-phone').value;
const responseEl = document.getElementById('query-response');
if (!phone) {
responseEl.innerHTML = `<code>{\n "status": "error",\n "message": "الرجاء إدخال رقم هاتف."\n}</code>`;
return;
}
responseEl.innerHTML = `<code>// Sending request...</code>`;
// Simulate server responses based on phone number
setTimeout(() => {
let response = {};
if (phone.includes('963911111111')) { // Success case
response = {
status: "success",
invoice_number: "MTN-" + Date.now(),
amount: 50000.00,
user_name: "محمد الأحمد",
user_type: "driver"
};
} else if (phone.includes('963922222222')) { // No pending invoice
response = {
status: "not_found",
message: "No pending invoice found for this user."
};
} else { // Generic error / user not found
response = {
status: "error",
message: "User not found or invalid phone number."
};
}
responseEl.innerHTML = `<code>${JSON.stringify(response, null, 4)}</code>`;
}, 1000);
}
function testWebhook() {
const invoice = document.getElementById('webhook-invoice').value;
const responseEl = document.getElementById('webhook-response');
if (!invoice) {
responseEl.innerHTML = `<code>{\n "status": "error",\n "message": "الرجاء إدخال رقم فاتورة."\n}</code>`;
return;
}
responseEl.innerHTML = `<code>// Sending request...</code>`;
setTimeout(() => {
let response = {};
if(invoice.includes('12345')){ // Success
response = {
status: "success",
message: "Transaction finalized."
};
} else if (invoice.includes('67890')) { // Already processed
response = {
status: "error",
message: "Invoice not found or already processed."
};
} else { // Generic invalid
response = {
status: "error",
message: "Invalid or missing parameters."
};
}
responseEl.innerHTML = `<code>${JSON.stringify(response, null, 4)}</code>`;
}, 1000);
}
</script>
</body>
</html>

View File

@@ -0,0 +1,12 @@
<?php
// token128.php — توليد توكن آمن 128 حرف (hex)
try {
// 64 bytes -> 128 hex chars
$token = bin2hex(random_bytes(64));
echo "Token (128 chars): " . $token . PHP_EOL;
} catch (Exception $e) {
// random_bytes قد يرمي Exception إذا لم تتوفر مصادر عشوائية كافية
fwrite(STDERR, "Failed to generate token: " . $e->getMessage() . PHP_EOL);
exit(1);
}

View File

@@ -0,0 +1,12 @@
{
"name": "root/v1",
"autoload": {
"psr-4": {
"Root\\V1\\": "src/"
}
},
"require": {
"firebase/php-jwt": "^6.11",
"vlucas/phpdotenv": "^5.6"
}
}

543
walletintaleq.intaleq.xyz/v2/composer.lock generated Normal file
View File

@@ -0,0 +1,543 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "b5ca8e9d1f3a2639d0ba6eaeb261ec12",
"packages": [
{
"name": "firebase/php-jwt",
"version": "v6.11.1",
"source": {
"type": "git",
"url": "https://github.com/firebase/php-jwt.git",
"reference": "d1e91ecf8c598d073d0995afa8cd5c75c6e19e66"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/d1e91ecf8c598d073d0995afa8cd5c75c6e19e66",
"reference": "d1e91ecf8c598d073d0995afa8cd5c75c6e19e66",
"shasum": ""
},
"require": {
"php": "^8.0"
},
"require-dev": {
"guzzlehttp/guzzle": "^7.4",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.5",
"psr/cache": "^2.0||^3.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0"
},
"suggest": {
"ext-sodium": "Support EdDSA (Ed25519) signatures",
"paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present"
},
"type": "library",
"autoload": {
"psr-4": {
"Firebase\\JWT\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Neuman Vong",
"email": "neuman+pear@twilio.com",
"role": "Developer"
},
{
"name": "Anant Narayanan",
"email": "anant@php.net",
"role": "Developer"
}
],
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
"homepage": "https://github.com/firebase/php-jwt",
"keywords": [
"jwt",
"php"
],
"support": {
"issues": "https://github.com/firebase/php-jwt/issues",
"source": "https://github.com/firebase/php-jwt/tree/v6.11.1"
},
"time": "2025-04-09T20:32:01+00:00"
},
{
"name": "graham-campbell/result-type",
"version": "v1.1.3",
"source": {
"type": "git",
"url": "https://github.com/GrahamCampbell/Result-Type.git",
"reference": "3ba905c11371512af9d9bdd27d99b782216b6945"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/3ba905c11371512af9d9bdd27d99b782216b6945",
"reference": "3ba905c11371512af9d9bdd27d99b782216b6945",
"shasum": ""
},
"require": {
"php": "^7.2.5 || ^8.0",
"phpoption/phpoption": "^1.9.3"
},
"require-dev": {
"phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28"
},
"type": "library",
"autoload": {
"psr-4": {
"GrahamCampbell\\ResultType\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
}
],
"description": "An Implementation Of The Result Type",
"keywords": [
"Graham Campbell",
"GrahamCampbell",
"Result Type",
"Result-Type",
"result"
],
"support": {
"issues": "https://github.com/GrahamCampbell/Result-Type/issues",
"source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.3"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type",
"type": "tidelift"
}
],
"time": "2024-07-20T21:45:45+00:00"
},
{
"name": "phpoption/phpoption",
"version": "1.9.3",
"source": {
"type": "git",
"url": "https://github.com/schmittjoh/php-option.git",
"reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/schmittjoh/php-option/zipball/e3fac8b24f56113f7cb96af14958c0dd16330f54",
"reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54",
"shasum": ""
},
"require": {
"php": "^7.2.5 || ^8.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28"
},
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": false
},
"branch-alias": {
"dev-master": "1.9-dev"
}
},
"autoload": {
"psr-4": {
"PhpOption\\": "src/PhpOption/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Johannes M. Schmitt",
"email": "schmittjoh@gmail.com",
"homepage": "https://github.com/schmittjoh"
},
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
}
],
"description": "Option Type for PHP",
"keywords": [
"language",
"option",
"php",
"type"
],
"support": {
"issues": "https://github.com/schmittjoh/php-option/issues",
"source": "https://github.com/schmittjoh/php-option/tree/1.9.3"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption",
"type": "tidelift"
}
],
"time": "2024-07-20T21:41:07+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.32.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638",
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638",
"shasum": ""
},
"require": {
"php": ">=7.2"
},
"provide": {
"ext-ctype": "*"
},
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/polyfill",
"name": "symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.32.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-09-09T11:45:10+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.32.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493",
"reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493",
"shasum": ""
},
"require": {
"ext-iconv": "*",
"php": ">=7.2"
},
"provide": {
"ext-mbstring": "*"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/polyfill",
"name": "symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.32.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-12-23T08:48:59+00:00"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.32.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608",
"reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608",
"shasum": ""
},
"require": {
"php": ">=7.2"
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/polyfill",
"name": "symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ion Bazan",
"email": "ion.bazan@gmail.com"
},
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.32.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2025-01-02T08:10:11+00:00"
},
{
"name": "vlucas/phpdotenv",
"version": "v5.6.2",
"source": {
"type": "git",
"url": "https://github.com/vlucas/phpdotenv.git",
"reference": "24ac4c74f91ee2c193fa1aaa5c249cb0822809af"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/24ac4c74f91ee2c193fa1aaa5c249cb0822809af",
"reference": "24ac4c74f91ee2c193fa1aaa5c249cb0822809af",
"shasum": ""
},
"require": {
"ext-pcre": "*",
"graham-campbell/result-type": "^1.1.3",
"php": "^7.2.5 || ^8.0",
"phpoption/phpoption": "^1.9.3",
"symfony/polyfill-ctype": "^1.24",
"symfony/polyfill-mbstring": "^1.24",
"symfony/polyfill-php80": "^1.24"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"ext-filter": "*",
"phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2"
},
"suggest": {
"ext-filter": "Required to use the boolean validator."
},
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": false
},
"branch-alias": {
"dev-master": "5.6-dev"
}
},
"autoload": {
"psr-4": {
"Dotenv\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Vance Lucas",
"email": "vance@vancelucas.com",
"homepage": "https://github.com/vlucas"
}
],
"description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
"keywords": [
"dotenv",
"env",
"environment"
],
"support": {
"issues": "https://github.com/vlucas/phpdotenv/issues",
"source": "https://github.com/vlucas/phpdotenv/tree/v5.6.2"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv",
"type": "tidelift"
}
],
"time": "2025-04-30T23:37:27+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {},
"platform-dev": {},
"plugin-api-version": "2.6.0"
}

BIN
walletintaleq.intaleq.xyz/v2/main/.DS_Store vendored Executable file

Binary file not shown.

View File

@@ -0,0 +1,17 @@
PASS=@:1F62hwYsdmju^1RpXrXlBl
USER=seferli1_spd563608XrXlBl
USERNAME=hamzaphFlut@g.cXrXlBl
PASSWORD=malFlu@2101Ham
SECRET_KEY=seferegypt
CLAUDAISEFER=zg-qbc-qvo39-n4VdMQ5nuJeIYhMN4PDYr7qox3-t2i1Lh7aNTDfYF-Gf8whUJZCs47EeelKn8_UcmUMmiSLaf0UJg0DvUlQrDt-76CRrkQQXrXlBl
PASSWORDPAYMOB=g@nkD2#99!hD_.wXrXlBl
PAYMOBOUTCLIENTSECRET=xyjjRlahJM0Xc38WjApCOh8bvgL9slFpNdM9YeCu9AhLqboKMPtmSvc2N9O4tXxFLV2JAV6stBSTAGFGCVubGe6MNpc7MzJnZ3SiT6GpavBoCLWkUvVbdSDaM0zHvuBOXrXlBl
PAYMOBOUTCLIENT_ID=Z05ut48dVkS2gI2zenFFcKsfDKfHAU0WELqKyJ0LXrXlBl
PayPalClientIdLive=QZFjAoZfGtngNserll6r3cC56Xl1sVLQkn5dMbyebhzJY59EQ3hz7YxaEqEDYPTUFcQWqvePaQ5UJJVRXrXlBl
SMSPASSWORDEGYPT=J)Vh=qb/@MXrXlBl
OCP-APIM-SUBSCRIPTION-KEY=3u5yqfffyxfj0797x7q5u851882931j9XrXlBl
visionApi=3pALsqSSYTvzp69Q5FMIgbzjG6Z1zktJXrXlBl
payPalSecretLive=JQDATqnDfiFpEAN60KB4pGpDaJjyqBAd9jxMBPpzWU1P1k3H1jZhQjn73EHsKQna74P8p98hgOnMaWPWXrXlBl
publishableKeyStripe=vg_ropj_57Iiv6MFCBFq3C2n6kNJnZByV6nuDtXe9IjEPOfhmpDtWmt3MLR0gQpiHcQmAFMUPrZc3QiCDjxBZLbxDC3efxWxz33bWH1ZgrsXrXlBl
secretKeyStripe=zg_ropj_57Iiv6MFCBFq3C2n6IXlmjykpxDmW93SW3vvXh68UA9T5FORTWgWsT37StKsOPdwDdsy8qR9srMUluahs3nPHvgBa33tGk90vV5XrXlBl
passwordnewpassenger=unknown

View File

@@ -0,0 +1,6 @@
# DO NOT REMOVE OR MODIFY. CLOUDLINUX ENV VARS CONFIGURATION BEGIN
<IfModule Litespeed>
SetEnv appId 12994c6e707543e68d5638894d04f989
SetEnv appCertificate e21a388f83034a159f2783889a6d7bcf
</IfModule>
# DO NOT REMOVE OR MODIFY. CLOUDLINUX ENV VARS CONFIGURATION END

Binary file not shown.

View File

@@ -0,0 +1,103 @@
<?php
include "../../connect.php";
$sql = "SELECT
`driver`.`id`,
`driver`.`phone`,
`driver`.`email`,
`driver`.`gender`,
`driver`.`status`,
`driver`.`birthdate`,
`driver`.`site`,
`driver`.`first_name`,
`driver`.`last_name`,
`driver`.`education`,
`driver`.`employmentType`,
`driver`.`maritalStatus`,
`driver`.`created_at`,
`driver`.`updated_at`,
(
SELECT
COUNT(`driver`.`id`)
FROM
`driver`
) AS countPassenger,
(
SELECT
CAST(AVG(`rating`) AS DECIMAL(10, 2))
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`driverID` = `driver`.`id`
) AS ratingPassenger,
(
SELECT
COUNT(`ratingPassenger`.`driverID`)
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`driverID` = `driver`.`id`
) AS countDriverRate,
(
SELECT
COUNT(`canecl`.`driverID`)
FROM
`canecl`
WHERE
`canecl`.`driverID` = `driver`.`id`
) AS countPassengerCancel,
(
SELECT
CAST(
AVG(`ratingDriver`.`rating`) AS DECIMAL(10, 2)
)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`driver_id` = `driver`.`id`
) AS passengerAverageRating,
(
SELECT
COUNT(`ratingDriver`.`driver_id`)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`driver_id` = `driver`.`id`
) AS countPassengerRate,
(
SELECT
COUNT(`ride`.`driver_id`)
FROM
`ride`
WHERE
`ride`.`driver_id` = `driver`.`id`
) AS countPassengerRide,
(
SELECT
`token`
FROM
`driverToken`
WHERE
`driverToken`.`captain_id` = `driver`.`id`
) AS passengerToken
FROM
`driver`
ORDER BY
passengerAverageRating
DESC
LIMIT 10";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -0,0 +1,109 @@
<?php
include "../../connect.php";
$driver_id = filterRequest("driver_id");
$driverEmail = filterRequest("driverEmail");
$driverPhone = filterRequest("driverPhone");
$sql = "SELECT
`driver`.`id`,
`driver`.`phone`,
`driver`.`email`,
`driver`.`gender`,
`driver`.`status`,
`driver`.`birthdate`,
`driver`.`site`,
`driver`.`first_name`,
`driver`.`last_name`,
`driver`.`education`,
`driver`.`employmentType`,
`driver`.`maritalStatus`,
`driver`.`created_at`,
`driver`.`updated_at`,
(
SELECT
COUNT(`driver`.`id`)
FROM
`driver`
) AS countPassenger,
(
SELECT
CAST(AVG(`rating`) AS DECIMAL(10, 2))
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`driverID` = `driver`.`id`
) AS ratingPassenger,
(
SELECT
COUNT(`ratingPassenger`.`driverID`)
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`driverID` = `driver`.`id`
) AS countDriverRate,
(
SELECT
COUNT(`canecl`.`driverID`)
FROM
`canecl`
WHERE
`canecl`.`driverID` = `driver`.`id`
) AS countPassengerCancel,
(
SELECT
CAST(
AVG(`ratingDriver`.`rating`) AS DECIMAL(10, 2)
)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`driver_id` = `driver`.`id`
) AS passengerAverageRating,
(
SELECT
COUNT(`ratingDriver`.`driver_id`)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`driver_id` = `driver`.`id`
) AS countPassengerRate,
(
SELECT
COUNT(`ride`.`driver_id`)
FROM
`ride`
WHERE
`ride`.`driver_id` = `driver`.`id`
) AS countPassengerRide,
(
SELECT
`token`
FROM
`driverToken`
WHERE
`driverToken`.`captain_id` = `driver`.`id`
) AS passengerToken
FROM
`driver`
WHERE driver.email = '$driverEmail' OR driver.phone = '$driverPhone' OR driver.id = '$driver_id'
ORDER BY
passengerAverageRating
DESC
LIMIT 10
";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -0,0 +1,107 @@
<?php
include "../../connect.php";
$driver_id = filterRequest("driver_id");
$sql = "SELECT
`driver`.`id`,
`driver`.`phone`,
`driver`.`email`,
`driver`.`gender`,
`driver`.`status`,
`driver`.`birthdate`,
`driver`.`site`,
`driver`.`first_name`,
`driver`.`last_name`,
`driver`.`education`,
`driver`.`employmentType`,
`driver`.`maritalStatus`,
`driver`.`created_at`,
`driver`.`updated_at`,
(
SELECT
COUNT(`driver`.`id`)
FROM
`driver`
) AS countPassenger,
(
SELECT
CAST(AVG(`rating`) AS DECIMAL(10, 2))
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`driverID` = `driver`.`id`
) AS ratingPassenger,
(
SELECT
COUNT(`ratingPassenger`.`driverID`)
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`driverID` = `driver`.`id`
) AS countDriverRate,
(
SELECT
COUNT(`canecl`.`driverID`)
FROM
`canecl`
WHERE
`canecl`.`driverID` = `driver`.`id`
) AS countPassengerCancel,
(
SELECT
CAST(
AVG(`ratingDriver`.`rating`) AS DECIMAL(10, 2)
)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`driver_id` = `driver`.`id`
) AS passengerAverageRating,
(
SELECT
COUNT(`ratingDriver`.`driver_id`)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`driver_id` = `driver`.`id`
) AS countPassengerRate,
(
SELECT
COUNT(`ride`.`driver_id`)
FROM
`ride`
WHERE
`ride`.`driver_id` = `driver`.`id`
) AS countPassengerRide,
(
SELECT
`token`
FROM
`driverToken`
WHERE
`driverToken`.`captain_id` = `driver`.`id`
) AS passengerToken
FROM
`driver`
WHERE
driver.id = '$driver_id'
ORDER BY
passengerAverageRating
DESC
LIMIT 10
";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -0,0 +1,145 @@
<?php
include "../../connect.php";
$sql = "SELECT
(
SELECT
TIME_FORMAT(
AVG(
TIMESTAMPDIFF(
SECOND,
rideTimeStart,
rideTimeFinish
)
),
'%Hh %im'
) AS avg_duration
FROM
ride
) AS driver_avg_duration,(
SELECT
COUNT(*) AS total_rows
FROM
(
SELECT
COUNT(driver_id)
FROM
ride
GROUP BY
driver_id
) sub
) AS num_Driver,
(
SELECT
COUNT(*)
FROM
ride
) AS total_rides,
(
SELECT
COUNT(*)
FROM
ride
WHERE
STATUS
= 'waiting'
) AS ongoing_rides,
(
SELECT
COUNT(*)
FROM
ride
WHERE
STATUS
= 'Finished'
) AS completed_rides,
(
SELECT
COUNT(*)
FROM
ride
WHERE
STATUS
= 'cancelled'
) AS cancelled_rides,
(
SELECT
MAX(
TIME_FORMAT(
TIMESTAMPDIFF(
SECOND,
rideTimeStart,
rideTimeFinish
),
'%Hh %im'
)
) AS duration
FROM
ride
) AS longest_duration,
(
SELECT
ROUND(SUM(DISTANCE),
2)
FROM
ride
) AS total_distance,
(
SELECT
ROUND(AVG(DISTANCE),
2)
FROM
ride
) AS average_distance,
(
SELECT
ROUND(MAX(DISTANCE),
2)
FROM
ride
) AS longest_distance,
(
SELECT
SUM(price_for_driver)
FROM
ride
) AS total_driver_earnings,
(
SELECT
SUM(`price_for_passenger`)
FROM
ride
) AS total_company_earnings,
(
ROUND(
(
SELECT
SUM(`price_for_passenger`)
FROM
ride
) /(
SELECT
SUM(price_for_driver)
FROM
ride
),
2
)
) AS companyPercent
FROM
ride
LIMIT 1";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -0,0 +1,35 @@
<?php
include "../../connect.php";
$currentYear = date('Y');
$sql = "SELECT
YEAR(date) AS year,
MONTH(date) AS month,
DAY(date) AS day,
COUNT(*) AS rides_count,
(SELECT COUNT(*) FROM ride WHERE MONTH(date) = MONTH(CURRENT_DATE) AND YEAR(date) = YEAR(CURRENT_DATE)) AS current_month_rides_count
FROM
ride
GROUP BY
YEAR(date),
MONTH(date),
DAY(date)
ORDER BY
YEAR(date),
MONTH(date),
DAY(date)";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -0,0 +1,25 @@
<?php
include "../../connect.php";
$deviceNumber = filterRequest("deviceNumber"); // Assuming you'll get deviceNumber as input
$name = filterRequest("name");
$sql = "INSERT INTO `adminUser`(`id`, `device_number`, `name`) VALUES (
UUID(),
:deviceNumber,
:name
)";
$stmt = $con->prepare($sql);
$stmt->bindParam(':deviceNumber', $deviceNumber);
$stmt->bindParam(':name', $name);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Print a success message
printSuccess($message = "Admin user data saved successfully");
} else {
// Print a failure message
printFailure($message = "Failed to save admin user data");
}
?>

View File

@@ -0,0 +1,24 @@
<?php
include "../../connect.php";
$device_number = filterRequest("device_number");
$sql = "SELECT
*
FROM
`adminUser`
WHERE
`device_number` = '$device_number'";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (count($result) === 1) {
// Print the first record as a success message
printSuccess( $result[0]);
} else {
// Print a failure message
printFailure($message = "Failed to retrieve Password or user name incorrect");
}
?>

View File

@@ -0,0 +1,404 @@
<?php
//dashbord.php
include "../connect.php";
// $passengerID = filterRequest("passengerID");
$sql = "SELECT
COALESCE(
(
SELECT
COUNT(`email`)
FROM
`passengers`
),
0
) AS countPassengers,
COALESCE(
(
SELECT
COUNT(`email`)
FROM
`driver`
),
0
) AS countDriver,
COALESCE(
(
SELECT
COUNT(`id`)
FROM
`ride`
),
0
) AS countRide,
COALESCE(
(
SELECT
COUNT(`id`)
FROM
`passengers`
WHERE
`passengers`.`created_at` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
),
0
) AS countPassengersThisMonth,
COALESCE(
(
SELECT
COUNT(`id`)
FROM
`ride`
WHERE
`ride`.`created_at` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
),
0
) AS countRideThisMonth,
COALESCE(
(
SELECT
COUNT(`id`)
FROM
`driver`
WHERE
`driver`.`created_at` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
),
0
) AS countDriverThisMonth,
COALESCE(
(
SELECT
COUNT(`id`)
FROM
`CarRegistration`
WHERE
`CarRegistration`.`created_at` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
),
0
) AS countCarRegistrationThisMonth,
COALESCE(
(
SELECT
COUNT(`id`)
FROM
`complaint`
WHERE
`complaint`.`date_filed` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
),
0
) AS countComplaintThisMonth,
COALESCE(
(
SELECT
COUNT(`id`)
FROM
`complaint`
WHERE
`complaint`.`date_filed` BETWEEN DATE_FORMAT(
DATE_SUB(
CURRENT_DATE,
INTERVAL WEEKDAY(CURRENT_DATE) DAY
),
'%Y-%m-%d'
) AND DATE_FORMAT(
DATE_ADD(
DATE_SUB(
CURRENT_DATE,
INTERVAL WEEKDAY(CURRENT_DATE) DAY
),
INTERVAL 6 DAY
),
'%Y-%m-%d'
)
),
0
) AS countComplaintThisWeek,
COALESCE(
(
SELECT
COUNT(`id`)
FROM
`complaint`
WHERE
`complaint`.`date_filed` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-%d') AND DATE_FORMAT(CURRENT_DATE, '%Y-%m-%d')
),
0
) AS countComplaintToday,
COALESCE(
(
SELECT
SUM(`payments`.`amount`)
FROM
`payments`
WHERE
`payments`.`created_at` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE) AND `payments`.`payment_method` IN(
'visa-in',
'visa',
'visaRide',
'TransferFrom',
'payout',
'TransferTo'
)
),
0
) AS payments,
COALESCE(
(
SELECT
SUM(`driverWallet`.`amount`)
FROM
`driverWallet`
WHERE
`driverWallet`.`dateCreated` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE) AND `driverWallet`.`paymentMethod` IN('visa', '')
),
0
) AS driverWallet,
COALESCE(
(
SELECT
SUM(`passengerWallet`.`balance`)
FROM
`passengerWallet`
WHERE
`passengerWallet`.`created_at` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
),
0
) AS passengerWallet,
COALESCE(
(
SELECT
SUM(`seferWallet`.`amount`)
FROM
`seferWallet`
WHERE
`seferWallet`.`createdAt` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
),
0
) AS seferWallet,
COALESCE(
(
SELECT
TIME_FORMAT(
AVG(
TIMESTAMPDIFF(
SECOND,
rideTimeStart,
rideTimeFinish
)
),
'%Hh %im'
) AS avg_duration
FROM
ride
),
'0:00'
) AS driver_avg_duration,
COALESCE(
(
SELECT
COUNT(*) AS total_rows
FROM
(
SELECT
COUNT(driver_id)
FROM
ride
GROUP BY
driver_id
) sub
),
0
) AS num_Driver,
COALESCE(
(
SELECT
COUNT(*)
FROM
ride
),
0
) AS total_rides,
COALESCE(
(
SELECT
COUNT(*)
FROM
ride
WHERE
STATUS
= 'waiting'
),
0
) AS ongoing_rides,
COALESCE(
(
SELECT
COUNT(*)
FROM
ride
WHERE
STATUS
= 'Finished'
),
0
) AS completed_rides,
COALESCE(
(
SELECT
COUNT(*)
FROM
ride
WHERE
STATUS
= 'cancelled'
),
0
) AS cancelled_rides,
COALESCE(
(
SELECT
MAX(
TIME_FORMAT(
TIMESTAMPDIFF(
SECOND,
rideTimeStart,
rideTimeFinish
),
'%Hh %im'
)
) AS duration
FROM
ride
),
'0:00'
) AS longest_duration,
COALESCE(
(
SELECT
ROUND(SUM(DISTANCE),
2)
FROM
ride
),
0
) AS total_distance,
COALESCE(
(
SELECT
ROUND(AVG(DISTANCE),
2)
FROM
ride
),
0
) AS average_distance,
COALESCE(
(
SELECT
ROUND(MAX(DISTANCE),
2)
FROM
ride
),
0
) AS longest_distance,
COALESCE(
(
SELECT
SUM(price_for_driver)
FROM
ride
WHERE
STATUS
= 'Finished'
),
0
) AS total_driver_earnings,
COALESCE(
ROUND(
(
SELECT
AVG(`ride`.`price_for_passenger`)
FROM
`ride`
)
),
0
) AS avg_passenger_price,
COUNT(
CASE WHEN HOUR(created_at) BETWEEN 6 AND 11 THEN id
END
) AS morning_ride_count,
COUNT(
CASE WHEN HOUR(created_at) BETWEEN 12 AND 17 THEN id
END
) AS evening_ride_count,
COUNT(
CASE WHEN(
HOUR(created_at) BETWEEN 18 AND 23 OR HOUR(created_at) BETWEEN 0 AND 5
) THEN id
END
) AS night_ride_count,
(
SELECT
COUNT(*) AS ride_count
FROM
ride
WHERE
`ride`.`carType` = 'Comfort'
) AS comfort,
(
SELECT
COUNT(*) AS ride_count
FROM
ride
WHERE
`ride`.`carType` = 'Speed'
) AS speed,
(
SELECT
COUNT(*) AS ride_count
FROM
ride
WHERE
`ride`.`carType` = 'Lady'
) AS lady,
COUNT(
CASE WHEN HOUR(created_at) BETWEEN 6 AND 11 THEN id
END
) AS morning_ride_count,
COUNT(
CASE WHEN HOUR(created_at) BETWEEN 12 AND 17 THEN id
END
) AS evening_ride_count,
COUNT(
CASE WHEN(
HOUR(created_at) BETWEEN 18 AND 23 OR HOUR(created_at) BETWEEN 0 AND 5
) THEN id
END
) AS night_ride_count
,
(SELECT
COUNT(*)
FROM
payments
WHERE
payment_method = 'TransferFrom'
)AS transfer_from_count
FROM
`passengers`
LIMIT 1;";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -0,0 +1,110 @@
<?php
include "../connect.php";
$sql = "SELECT
`passengers`.`id`,
`passengers`.`phone`,
`passengers`.`email`,
`passengers`.`gender`,
`passengers`.`status`,
`passengers`.`birthdate`,
`passengers`.`site`,
`passengers`.`first_name`,
`passengers`.`last_name`,
`passengers`.`sosPhone`,
`passengers`.`education`,
`passengers`.`employmentType`,
`passengers`.`maritalStatus`,
`passengers`.`created_at`,
`passengers`.`updated_at`,
(
SELECT
COUNT(`passengers`.`id`)
FROM
`passengers`
) AS countPassenger,
(
SELECT
COUNT(`feedBack`.id)
FROM
`feedBack`
) AS countFeedback,
(
SELECT
CAST(AVG(`rating`) as DECIMAL(10,2))
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`passenger_id` = `passengers`.`id`
) AS ratingPassenger,
(
SELECT
COUNT(`ratingPassenger`.`driverID`)
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`passenger_id` = `passengers`.`id`
) AS countDriverRate,
(
SELECT
COUNT(`canecl`.`passengerID`)
FROM
`canecl`
WHERE
`canecl`.`passengerID` = `passengers`.`id`
) AS countPassengerCancel,
(
SELECT
CAST(AVG(`ratingDriver`.`rating`) as DECIMAL(10,2))
FROM
`ratingDriver`
WHERE
`ratingDriver`.`passenger_iD` = `passengers`.`id`
) AS passengerAverageRating,
(
SELECT
COUNT(`ratingDriver`.`driver_id`)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`passenger_id` = `passengers`.`id`
) AS countPassengerRate,
(
SELECT
COUNT(`ride`.`passenger_id`)
FROM
`ride`
WHERE
`ride`.`passenger_id` = `passengers`.`id`
) AS countPassengerRide
,
(
SELECT
`tokens`.`token`
FROM
`tokens`
WHERE
`tokens`.`passengerID` = `passengers`.`id`
) AS passengerToken
FROM
`passengers`
GROUP BY
`passengers`.`id`
ORDER BY
countPassengerRide
DESC
LIMIT 10";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -0,0 +1,111 @@
<?php
include "../connect.php";
$passengerID = filterRequest("passengerID");
$sql = "SELECT
`passengers`.`id`,
`passengers`.`phone`,
`passengers`.`email`,
`passengers`.`gender`,
`passengers`.`status`,
`passengers`.`birthdate`,
`passengers`.`site`,
`passengers`.`first_name`,
`passengers`.`last_name`,
`passengers`.`sosPhone`,
`passengers`.`education`,
`passengers`.`employmentType`,
`passengers`.`maritalStatus`,
`passengers`.`created_at`,
`passengers`.`updated_at`,
(
SELECT
COUNT(`passengers`.`id`)
FROM
`passengers`
) AS countPassenger,
(
SELECT
COUNT(`feedBack`.id)
FROM
`feedBack`
) AS countFeedback,
(
SELECT
CAST(AVG(`rating`) as DECIMAL(10,2))
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`passenger_id` = `passengers`.`id`
) AS ratingPassenger,
(
SELECT
COUNT(`ratingPassenger`.`driverID`)
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`passenger_id` = `passengers`.`id`
) AS countDriverRate,
(
SELECT
COUNT(`canecl`.`passengerID`)
FROM
`canecl`
WHERE
`canecl`.`passengerID` = `passengers`.`id`
) AS countPassengerCancel,
(
SELECT
CAST(AVG(`ratingDriver`.`rating`) as DECIMAL(10,2))
FROM
`ratingDriver`
WHERE
`ratingDriver`.`passenger_iD` = `passengers`.`id`
) AS passengerAverageRating,
(
SELECT
COUNT(`ratingDriver`.`driver_id`)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`passenger_id` = `passengers`.`id`
) AS countPassengerRate,
(
SELECT
COUNT(`ride`.`passenger_id`)
FROM
`ride`
WHERE
`ride`.`passenger_id` = `passengers`.`id`
) AS countPassengerRide,
(
SELECT
`tokens`.`token`
FROM
`tokens`
WHERE
`tokens`.`passengerID` = `passengers`.`id`
) AS passengerToken
FROM
`passengers` WHERE passengers.id='$passengerID'
GROUP BY
`passengers`.`id`
ORDER BY
countPassengerRide
DESC
";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -0,0 +1,112 @@
<?php
include "../connect.php";
$passengerEmail = filterRequest("passengerEmail");
$passengerId = filterRequest("passengerId");
$passengerphone = filterRequest("passengerphone");
$sql = "SELECT
`passengers`.`id`,
`passengers`.`phone`,
`passengers`.`email`,
`passengers`.`gender`,
`passengers`.`status`,
`passengers`.`birthdate`,
`passengers`.`site`,
`passengers`.`first_name`,
`passengers`.`last_name`,
`passengers`.`sosPhone`,
`passengers`.`education`,
`passengers`.`employmentType`,
`passengers`.`maritalStatus`,
`passengers`.`created_at`,
`passengers`.`updated_at`,
(
SELECT
COUNT(`passengers`.`id`)
FROM
`passengers`
) AS countPassenger,
(
SELECT
COUNT(`feedBack`.id)
FROM
`feedBack`
) AS countFeedback,
(
SELECT
CAST(AVG(`rating`) AS DECIMAL(10, 2))
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`passenger_id` = `passengers`.`id`
) AS ratingPassenger,
(
SELECT
COUNT(`ratingPassenger`.`driverID`)
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`passenger_id` = `passengers`.`id`
) AS countDriverRate,
(
SELECT
COUNT(`canecl`.`passengerID`)
FROM
`canecl`
WHERE
`canecl`.`passengerID` = `passengers`.`id`
) AS countPassengerCancel,
(
SELECT
CAST(
AVG(`ratingDriver`.`rating`) AS DECIMAL(10, 2)
)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`passenger_iD` = `passengers`.`id`
) AS passengerAverageRating,
(
SELECT
COUNT(`ratingDriver`.`driver_id`)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`passenger_id` = `passengers`.`id`
) AS countPassengerRate,
(
SELECT
COUNT(`ride`.`passenger_id`)
FROM
`ride`
WHERE
`ride`.`passenger_id` = `passengers`.`id`
) AS countPassengerRide,
(
SELECT
`tokens`.`token`
FROM
`tokens`
WHERE
`tokens`.`passengerID` = `passengers`.`id`
) AS passengerToken
FROM
`passengers`
WHERE
passengers.email = '$passengerEmail' OR passengers.phone = '$passengerphone' OR passengers.id = '$passengerId'
";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -0,0 +1,47 @@
<?php
include "../connect.php";
$sql = "
SELECT
COALESCE(
(SELECT SUM(amount) FROM payments
WHERE created_at BETWEEN DATE_FORMAT(CURDATE(), '%Y-%m-01') AND LAST_DAY(CURDATE())
AND payment_method IN ('visa', 'visa-in', 'visaRide', 'TransferFrom', 'payout', 'TransferTo')),
0
) AS payments,
COALESCE(
(SELECT SUM(amount) FROM driverWallet
WHERE dateCreated BETWEEN DATE_FORMAT(CURDATE(), '%Y-%m-01') AND LAST_DAY(CURDATE())
AND paymentMethod IN ('visa', '')),
0
) AS driverWallet,
COALESCE(
(SELECT SUM(balance) FROM passengerWallet
WHERE created_at BETWEEN DATE_FORMAT(CURDATE(), '%Y-%m-01') AND LAST_DAY(CURDATE())),
0
) AS passengerWallet,
COALESCE(
(SELECT SUM(amount) FROM seferWallet
WHERE createdAt BETWEEN DATE_FORMAT(CURDATE(), '%Y-%m-01') AND LAST_DAY(CURDATE())),
0
) AS seferWallet;
";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
// ✅ Always log what were sending back
error_log('📊 Dashboard Result: ' . json_encode($result, JSON_PRETTY_PRINT));
printSuccess($result);
} else {
error_log('⚠️ Dashboard: No records found');
printFailure("No records found");
}
?>

View File

@@ -0,0 +1,51 @@
<?php
include "../connect.php";
// $driverID = filterRequest("driverID");
$sql = "SELECT
COUNT(DISTINCT driverID) AS driver_count,
`payments`.driverID,
COALESCE(SUM(amount),
0) AS total_amount,
`driver`.`phone`,
`driver`.`name_arabic`,
`driver`.`accountBank`,
`driver`.`bankCode`,
`driver`.`email`
FROM
payments
LEFT JOIN `driver` ON `driver`.`id` = payments.driverID
WHERE
isGiven = 'waiting' AND payment_method IN(
'visa-in',
'visa',
'visaRide',
'TransferFrom',
'payout',
'TransferTo',
'payFromSeferToDriver'
) AND WEEK(`payments`.created_at) = WEEK(CURRENT_DATE)
GROUP BY
driverID
HAVING
COALESCE(SUM(amount),
0) > 0
AND total_amount > 100
LIMIT 0, 25;
";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Fetch the record
$row = $stmt->fetchAll(PDO::FETCH_ASSOC);
printSuccess( $row);
}
else{
// Print a failure message
printFailure($message = "No wallet record found");
}
?>

View File

@@ -0,0 +1,79 @@
<?php
// File: send_payment_received_email.php
// Connect to the database
include '../connect.php';
// Get trip details from the database or API
$driverID = filterRequest('driverID');
$totalAmount = filterRequest('total_amount');
$driverPhone = filterRequest('phone');
$driverArabicName = filterRequest('name_arabic');
$accountBank = filterRequest('accountBank');
$driverEmail = filterRequest('email');
// Determine the language preference
$language = 'en'; // Default to English
// Email content
$bodyEmail = "<html>
<head>
<style>
/* Email styling here */
</style>
</head>
<body>
<div class='container'>
<img src='https://lh3.googleusercontent.com/a/ACg8ocLe5TgvmTjoFx7KjIoWGxX0G2ryKBTzUZi2-mBYb9DI1dsKQ0WEYh5ZPdnA3WeFbp9VnaTNzJuA0w8S4RiQ7042AKrOwXo3=s576-c-no' style='width: 150px; margin: 20px auto; display: block;'>
<h1>Payment Sent - SEFER</h1>
<p>Thank you for being a valued driver on the SEFER platform.</p>
<p>SEFER has sent a payment of $totalAmount to your account. Please note that it may take a few days for the bank to process this transaction.</p>
<p>We appreciate your service and hope to continue our partnership.</p>
<p>Regards,<br> SEFER Team</p>
</div>
</body>
</html>";
// Arabic email content
$bodyEmailAr = "<html>
<head>
<style>
/* Arabic email styling here */
</style>
</head>
<body dir='rtl'>
<div class='container'>
<img src='YOUR_SEFER_LOGO_URL_HERE' alt='SEFER' style='width: 150px; margin: 20px auto; display: block;'>
<h1>تم إرسال الدفع - سفر</h1>
<p>شكراً لك على كونك سائقًا متميزًا على منصة سفر.</p>
<p>لقد أرسلت سفر دفعة قدرها $totalAmount إلى حسابك. يرجى ملاحظة أنه قد يستغرق البنك عدة أيام لمعالجة هذه المعاملة.</p>
<p>نحن نقدر خدمتك ونأمل أن نستمر في شراكتنا.</p>
<p>مع خالص التحية،<br> فريق سفر</p>
</div>
</body>
</html>";
// Set the email headers
$supportEmail = 'seferteam@sefer.live';
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$headers .= "From: $supportEmail\r\n";
// Send email to the driver
if (!empty($driverEmail)) {
if (mail($driverEmail, "Payment Sent - SEFER", $bodyEmail, $headers)) {
// echo "Email sent successfully to $driverEmail";
printSuccess($message = "'Email sent successfully to ' . $driverEmail");
} else {
printFailure($message = "Failed to send email to ' . $driverEmail");
}
} else {
printFailure($message = "Invalid email address: ' . $driverEmail");
}
?>

View File

@@ -0,0 +1,28 @@
<?php
// Admin/v2/financial/dashboard_wallet.php
// هذا الملف يجب أن يرفع على سيرفر المحفظة فقط!
require_once __DIR__ . '/../../../connect.php'; // مسار الاتصال الخاص بسيرفر المحفظة
if ($role !== 'admin' && $role !== 'super_admin') {
jsonError("Unauthorized", 403);
}
try {
$stmt = $con->prepare("
SELECT
(SELECT IFNULL(SUM(amount), 0) FROM payments WHERE status = 'completed') as payments,
(SELECT IFNULL(SUM(balance), 0) FROM driverWallet) as driverWallet,
(SELECT IFNULL(SUM(balance), 0) FROM passengerWallet) as passengerWallet,
(SELECT IFNULL(SUM(balance), 0) FROM seferWallet) as seferWallet
");
$stmt->execute();
$stats = $stmt->fetch(PDO::FETCH_ASSOC);
// نعيد البيانات داخل رسالة (Array) لتطابق توقعات الفلاتر
jsonSuccess([$stats]);
} catch (Exception $e) {
jsonError('Wallet Query failed: ' . $e->getMessage(), 500);
}
?>

View File

@@ -0,0 +1,40 @@
<?php
// Admin/v2/financial/settlements.php
require_once __DIR__ . '/../../../connect.php';
try {
// جلب السائقين الذين لديهم مستحقات أو مديونية
// الحسبة: إجمالي (price_for_driver) من الرحلات المكتملة
$stmt = $con->prepare("
SELECT
d.id, d.first_name, d.last_name, d.phone,
SUM(r.price_for_driver) as total_earned,
COUNT(r.id) as total_rides
FROM driver d
LEFT JOIN ride r ON d.id = r.driver_id AND r.status = 'Finished'
GROUP BY d.id
HAVING total_earned > 0
ORDER BY total_earned DESC
LIMIT 50
");
$stmt->execute();
$drivers = $stmt->fetchAll(PDO::FETCH_ASSOC);
// فك تشفير البيانات
foreach ($drivers as &$driver) {
$driver['first_name'] = $encryptionHelper->decryptData($driver['first_name']);
$driver['last_name'] = $encryptionHelper->decryptData($driver['last_name']);
$driver['phone'] = $encryptionHelper->decryptData($driver['phone']);
}
echo json_encode([
'status' => 'success',
'data' => $drivers
]);
} catch (Exception $e) {
http_response_code(500);
echo json_encode(['status' => 'error', 'message' => $e->getMessage()]);
}
?>

View File

@@ -0,0 +1,30 @@
<?php
// Admin/v2/financial/stats.php
require_once __DIR__ . '/../../../connect.php';
try {
// إحصائيات مالية عامة
$stmt = $con->prepare("
SELECT
SUM(price_for_passenger) as total_revenue,
SUM(price_for_driver) as total_driver_pay,
SUM(price_for_passenger - price_for_driver) as total_platform_commission,
(SELECT SUM(amount) FROM payments WHERE payment_method = 'Cash') as cash_payments,
(SELECT SUM(amount) FROM payments WHERE payment_method != 'Cash') as digital_payments
FROM ride
WHERE status = 'Finished'
");
$stmt->execute();
$stats = $stmt->fetch(PDO::FETCH_ASSOC);
echo json_encode([
'status' => 'success',
'data' => $stats
]);
} catch (Exception $e) {
http_response_code(500);
echo json_encode(['status' => 'error', 'message' => $e->getMessage()]);
}
?>

Binary file not shown.

View File

@@ -0,0 +1,52 @@
<?php
require_once __DIR__ . '/vendor/autoload.php';
// Replace with your actual credentials
$appId = '12994c6e707543e68d5638894d04f989';
$appCertificate = 'e21a388f83034a159f2783889a6d7bcf';
// Set server port
$port = 8080;
// Function to generate Agora token
function generateToken($channelName, $uid = 0, $role = RtcRole::SUBSCRIBER, $expireTime = 360) {
// Check mandatory parameter
if (!$channelName) {
throw new Exception('Channel name is required');
}
// Calculate privilege expiration time
$currentTime = time();
$privilegeExpireTime = $currentTime + $expireTime;
// Build and return token
return RtcTokenBuilder::buildTokenWithUid($appId, $appCertificate, $channelName, $uid, $role, $privilegeExpireTime);
}
// Create server using Slim Framework
$app = new Slim\App();
// Token generation endpoint
$app->get('/token', function ($request, $response) use ($app, $appId, $appCertificate) {
// Get parameters
$channelName = $request->getQueryParam('channelName');
$uid = $request->getQueryParam('uid', 0);
$role = $request->getQueryParam('role', RtcRole::SUBSCRIBER);
$expireTime = $request->getQueryParam('expireTime', 3600);
try {
// Generate token
$token = generateToken($channelName, $uid, $role, $expireTime);
// Respond with JSON
$response->withJson(['token' => $token]);
} catch (Exception $e) {
// Handle error
$response->withStatus(500)->withJson(['error' => $e->getMessage()]);
}
});
// Start server
$app->run($port);

View File

@@ -0,0 +1,9 @@
var http = require('http');
var server = http.createServer(function(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
var message = 'It works!\n',
version = 'NodeJS ' + process.versions.node + '\n',
response = [message, version].join('\n');
res.end(response);
});
server.listen();

View File

@@ -0,0 +1,60 @@
<?php
include "../connect.php";
// Get the image file from the request.
$image_file = $_FILES['image'];
$driverID = filterRequest("driverID");
// Define allowed extensions
$allowed_extensions = ['jpg', 'jpeg', 'png'];
// Get the image file from the request.
$image_file = $_FILES['image'];
// Check if the image file was uploaded successfully.
if ($image_file['error'] !== UPLOAD_ERR_OK) {
echo "Image upload failed";
exit;
}
// Get file information
$image_name = $image_file['name'];
$image_size = $image_file['size'];
$image_extension = strtolower(pathinfo($image_name, PATHINFO_EXTENSION));
// Validate file extension
if (!in_array($image_extension, $allowed_extensions)) {
echo "Invalid image format";
exit;
}
// Generate a unique filename using timestamp and random string
$new_filename = $driverID . '.' . $image_extension;
// Set target directory for uploads
$target_dir = "card_image/";
// Construct target file path
$target_file = $target_dir . $new_filename;
// Move the image file to the target location
if (!move_uploaded_file($image_file['tmp_name'], $target_file)) {
echo json_encode(array('status' => "Failed to save image")); ;
exit;
}
// Store additional information (modify based on your needs)
$image_url = $target_dir . $new_filename; // Update if needed
$image_details = [
"name" => $image_name,
"size" => $image_size,
"extension" => $image_extension,
"url" => $image_url,
];
// Use the image details for further processing (e.g., display, store in database)
// ...
echo json_encode(array('status' => 'Image uploaded successfully!'));
?>

View File

@@ -0,0 +1,60 @@
<?php
include "../connect.php";
// Get the image file from the request.
$image_file = $_FILES['image'];
$driverID = filterRequest("driverID");
// Define allowed extensions
$allowed_extensions = ['jpg', 'jpeg', 'png'];
// Get the image file from the request.
$image_file = $_FILES['image'];
// Check if the image file was uploaded successfully.
if ($image_file['error'] !== UPLOAD_ERR_OK) {
echo "Image upload failed";
exit;
}
// Get file information
$image_name = $image_file['name'];
$image_size = $image_file['size'];
$image_extension = strtolower(pathinfo($image_name, PATHINFO_EXTENSION));
// Validate file extension
if (!in_array($image_extension, $allowed_extensions)) {
echo "Invalid image format";
exit;
}
// Generate a unique filename using timestamp and random string
$new_filename = $driverID . '.' . $image_extension;
// Set target directory for uploads
$target_dir = "egypt/idFront/";
// Construct target file path
$target_file = $target_dir . $new_filename;
// Move the image file to the target location
if (!move_uploaded_file($image_file['tmp_name'], $target_file)) {
echo json_encode(array('status' => "Failed to save image")); ;
exit;
}
// Store additional information (modify based on your needs)
$image_url = $target_dir . $new_filename; // Update if needed
$image_details = [
"name" => $image_name,
"size" => $image_size,
"extension" => $image_extension,
"url" => $image_url,
];
// Use the image details for further processing (e.g., display, store in database)
// ...
echo json_encode(array('status' => 'Image uploaded successfully!'));
?>

Binary file not shown.

View File

@@ -0,0 +1,29 @@
<?php
include "../../connect.php";
$appPlatform = filterRequest("appPlatform");
$sql = "SELECT
*
FROM
`testApp`
WHERE
appPlatform = '$appPlatform' AND isTest = 0;";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print the retrieved data
// echo json_encode($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No driver order data found");
}
?>

View File

@@ -0,0 +1,23 @@
<?php
include "../../connect.php";
$appPlatform = filterRequest("appPlatform");
$sql = "UPDATE
`testApp`
SET
`isTest` = '1'
WHERE
`testApp`.appPlatform = '$appPlatform';";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Print a success message
printSuccess($message = "Test data updated successfully");
} else {
// Print a failure message
printFailure($message = "Failed to update driver order data");
}
?>

View File

@@ -0,0 +1,35 @@
<?php
include "../../connect.php";
// Sanitize and validate input
$driverId = filterRequest("driverId");
$issueDate = filterRequest("IssueDate");
$inspectionResult = filterRequest("InspectionResult");
// Prepare SQL statement
$sql = "INSERT INTO criminalDocuments (driverId, IssueDate, InspectionResult)
VALUES (:driverId, :issueDate, :inspectionResult)";
try {
$stmt = $con->prepare($sql);
// Bind parameters
$stmt->bindParam(':driverId', $driverId, PDO::PARAM_INT);
$stmt->bindParam(':issueDate', $issueDate, PDO::PARAM_STR);
$stmt->bindParam(':inspectionResult', $inspectionResult, PDO::PARAM_STR);
// Execute the statement
$stmt->execute();
// Check if the insertion was successful
if ($stmt->rowCount() > 0) {
printSuccess("Criminal document data saved successfully");
} else {
printFailure("Failed to save criminal document data");
}
} catch (PDOException $e) {
// Log the error and print a generic failure message
error_log("Database Error: " . $e->getMessage());
printFailure("An error occurred while saving the data");
}
?>

View File

@@ -0,0 +1,19 @@
<?php
include "../../connect.php";
$id = filterRequest("id");
$sql = "UPDATE `driver` SET `status`='deleteFromHimself' WHERE `id`=$id'";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Print a success message
printSuccess($message = "Record deleted successfully");
} else {
// Print a failure message
printFailure($message = "Failed to delete record");
}
?>

View File

@@ -0,0 +1,22 @@
<?php
include "../../connect.php";
$driverID = filterRequest("id");
$sql = "SELECT `accountBank` FROM `driver` WHERE `id`='$driverID'";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Fetch the record
$row = $stmt->fetchAll(PDO::FETCH_ASSOC);
printSuccess( $row);
}
else{
// Print a failure message
printFailure($message = "No wallet record found");
}
?>

View File

@@ -0,0 +1,23 @@
<?php
include "../../connect.php";
// $driverID = filterRequest("id");
$sql = "
SELECT * FROM `promptDriverIDEgypt`";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Fetch the record
$row = $stmt->fetchAll(PDO::FETCH_ASSOC);
printSuccess( $row);
}
else{
// Print a failure message
printFailure($message = "No wallet record found");
}
?>

View File

@@ -0,0 +1,67 @@
<?php
include "../../connect.php";
$email = filterRequest('email');
$phone = filterRequest('phone');
$password = filterRequest('password');
// Hash the password
$hashed_password = password_hash($password, PASSWORD_DEFAULT);
$sql = "SELECT
driver.id,
driver.phone,
driver.email,
driver.password,
driver.gender,
driver.birthdate,
driver.site,
driver.first_name,
driver.last_name,
driver.education,
driver.employmentType,
driver.maritalStatus,
driver.created_at,
driver.updated_at,
email_verifications.verified
FROM
driver
LEFT JOIN email_verifications ON email_verifications.email = driver.email
WHERE
driver.phone = :phone AND driver.email = :email ";
$stmt = $con->prepare($sql);
$stmt->bindParam(':email', $email);
$stmt->bindParam(':phone', $phone);
$stmt->execute();
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
$count = $stmt->rowCount();
if ($count > 0) {
$stored_password = $data[0]['password'];
if (password_verify($password, $stored_password)) {
unset($data[0]['password']);
echo json_encode([
"status" => "success",
"count" => $count,
"data" => $data
]);
} else {
// The password is incorrect
echo json_encode([
"status" => "Failure",
"data" => "Incorrect password."
]);
// printFailure("Incorrect password.");
}
} else {
// The user does not exist
echo json_encode([
"status" => "Failure",
"data" => "User does not exist."
]);
// printFailure("User does not exist.");
}
$conn->close();
?>

View File

@@ -0,0 +1,56 @@
<?php
include "../../connect.php";
$email = filterRequest('email');
$driverID = filterRequest('id');
$sql = "SELECT
driver.id,
driver.phone,
driver.email,
driver.gender,
driver.birthdate,
driver.site,
driver.first_name,
driver.last_name,
driver.bankCode,
driver.accountBank,
driver.education,
driver.employmentType,
driver.maritalStatus,
driver.created_at,
driver.updated_at,
phone_verification.is_verified
FROM
driver
LEFT JOIN phone_verification ON phone_verification.phone_number = driver.phone
WHERE
driver.email = :email AND driver.id = :id AND `phone_verification`.`is_verified`='1' ";
$stmt = $con->prepare($sql);
$stmt->bindParam(':email', $email);
$stmt->bindParam(':id', $driverID);
$stmt->execute();
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
$count = $stmt->rowCount();
if ($count > 0) {
echo json_encode([
"status" => "success",
"count" => $count,
"data" => $data
]);
} else {
// The user does not exist
// echo json_encode([
// "status" => "Failure",
// "data" => "User does not exist."
// ]);
printFailure("User does not exist.");
}
$stmt = null; // Close the statement
$con = null; // Close the connection
exit();

View File

@@ -0,0 +1,110 @@
<?php
include "../../connect.php";
try {
// Collect and validate input data
$requiredFields = ["phone", "email", "password", "gender", "birthdate", "first_name", "last_name"];
$inputData = [];
foreach ($requiredFields as $field) {
$inputData[$field] = filterRequest($field);
if (empty($inputData[$field])) {
printFailure("Missing required field: $field");
}
}
// Collect optional fields
$optionalFields = [
"id", "license_type", "national_number", "name_arabic", "name_english",
"issue_date", "expiry_date", "license_categories", "address", "card_id",
"occupation", "licenseIssueDate", "religion", "status", "site",
"education", "employmentType", "maritalStatus"
];
foreach ($optionalFields as $field) {
$inputData[$field] = filterRequest($field);
}
// Generate driver ID if not provided
// $inputData['id'] = empty($inputData['id']) ? sha1(uniqid()) : $inputData['id'];
// Hash password
$inputData['hashedPassword'] = password_hash($inputData['password'], PASSWORD_DEFAULT);
// Set default site if not specified
$inputData['site'] = ($inputData['site'] === null || $inputData['site'] === "") ? "Not specified" : $inputData['site'];
// Check if the phone number or email address already exists
$stmt = $con->prepare("SELECT * FROM driver WHERE phone = :phone OR email = :email");
$stmt->bindParam(':phone', $inputData['phone'], PDO::PARAM_STR);
$stmt->bindParam(':email', $inputData['email'], PDO::PARAM_STR);
$stmt->execute();
if ($stmt->rowCount() > 0) {
printFailure("The email or phone number is already registered.");
}
// Prepare SQL for inserting new driver
$sql = "
INSERT INTO `driver` (
`id`, `phone`, `email`, `password`, `gender`, `license_type`, `national_number`,
`name_arabic`, `name_english`, `issue_date`, `expiry_date`, `license_categories`,
`address`, `card_id`, `occupation`, `licenseIssueDate`, `religion`, `status`,
`birthdate`, `site`, `first_name`, `last_name`, `education`,
`employmentType`, `maritalStatus`, `created_at`, `updated_at`
) VALUES (
:id, :phone, :email, :hashedPassword, :gender, :license_type, :national_number,
:name_arabic, :name_english, :issue_date, :expiry_date, :license_categories,
:address, :card_id, :occupation, :licenseIssueDate, :religion, :status,
:birthdate, :site, :first_name, :last_name, :education,
:employmentType, :maritalStatus, NOW(), NOW()
)
";
$stmt = $con->prepare($sql);
if (!$stmt) {
throw new Exception("Failed to prepare statement: " . $con->error);
}
// Bind parameters
$paramsToBind = [
'id', 'phone', 'email', 'hashedPassword', 'gender', 'license_type', 'national_number',
'name_arabic', 'name_english', 'issue_date', 'expiry_date', 'license_categories',
'address', 'card_id', 'occupation', 'licenseIssueDate', 'religion', 'status',
'birthdate', 'site', 'first_name', 'last_name', 'education',
'employmentType', 'maritalStatus'
];
foreach ($paramsToBind as $param) {
if (isset($inputData[$param])) {
$stmt->bindValue(":$param", $inputData[$param], PDO::PARAM_STR);
} else {
$stmt->bindValue(":$param", null, PDO::PARAM_STR);
}
}
// Log SQL and parameters for debugging
error_log("SQL: " . $sql);
error_log("Params: " . print_r($inputData, true));
// Execute the statement
if (!$stmt->execute()) {
throw new Exception("Failed to execute statement: " . $stmt->errorInfo()[2]);
}
// Check if the record was successfully saved
if ($stmt->rowCount() > 0) {
printSuccess($inputData['id']);
} else {
printFailure("Failed to save driver data");
}
} catch (PDOException $e) {
error_log("Database error: " . $e->getMessage());
printFailure("A database error occurred: " . $e->getMessage());
} catch (Exception $e) {
error_log("An error occurred: " . $e->getMessage());
printFailure("An error occurred: " . $e->getMessage());
}

View File

@@ -0,0 +1,19 @@
<?php
include "../../connect.php";
$id = filterRequest("id");
$sql = "DELETE FROM `passengers` WHERE `id`='$id'";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Print a success message
printSuccess($message = "Record deleted successfully");
} else {
// Print a failure message
printFailure($message = "Failed to delete record");
}
?>

View File

@@ -0,0 +1,44 @@
<?php
include "../../connect.php";
$phone_number = filterRequest("phone_number");
$driverId = filterRequest("driverId");
$email = filterRequest("email");
$token_code = filterRequest("token_code");
$expiration_time = filterRequest("expiration_time"); // Assuming this is a timestamp
// Check if the phone number already exists
$sql = "SELECT * FROM `phone_verification` WHERE `phone_number` = '$phone_number'";
$stmt = $con->prepare($sql);
$stmt->execute();
$rowCount = $stmt->rowCount();
if ($rowCount > 0) {
// The phone number already exists, so update the data
$sql = "UPDATE `phone_verification` SET `token_code` = '$token_code', `expiration_time` = DATE_ADD(NOW(), INTERVAL 5 MINUTE) WHERE `phone_number` = '$phone_number'";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// The update was successful
printSuccess($message = "Phone verification data updated successfully");
} else {
// The update was unsuccessful
printFailure($message = "Failed to update phone verification data");
}
} else {
// The phone number does not exist, so insert the data
$sql = "INSERT INTO `phone_verification` (`phone_number`, `driverId` ,`email`,`token_code`, `expiration_time`, `is_verified`, `created_at`) VALUES ('$phone_number','$driverId','$email', '$token_code', DATE_ADD(NOW(), INTERVAL 5 MINUTE), 0, NOW())";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// The insertion was successful
printSuccess($message = "Phone verification data saved successfully");
} else {
// The insertion was unsuccessful
printFailure($message = "Failed to save phone verification data");
}
}
?>

View File

@@ -0,0 +1,111 @@
<?php
include "../../connect.php";
$id = filterRequest("id");
// Check if any columns are set in the request
// if (!isset($_POST["phone"]) && !isset($_POST["email"]) && !isset($_POST["password"]) &&
// !isset($_POST["gender"]) && !isset($_POST["status"]) && !isset($_POST["birthdate"]) &&
// !isset($_POST["site"]) && !isset($_POST["first_name"]) && !isset($_POST["last_name"]) &&
// !isset($_POST["accountBank"]) && !isset($_POST["education"]) && !isset($_POST["employmentType"]) &&
// !isset($_POST["maritalStatus"]) && !isset($_POST["created_at"]) && !isset($_POST["updated_at"])) {
// // No data to update
// printFailure($message = "No driver data provided for update.");
// exit;
// }
// Create an empty array to store the column-value pairs
$columnValues = array();
// Add column-value pairs based on received data
if (isset($_POST["phone"])) {
$phone = filterRequest("phone");
$columnValues[] = "`phone` = '$phone'";
}
if (isset($_POST["email"])) {
$email = filterRequest("email");
$columnValues[] = "`email` = '$email'";
}
if (isset($_POST["password"])) {
$password = filterRequest("password");
$columnValues[] = "`password` = '$password'"; // Hash password before storing
}
if (isset($_POST["gender"])) {
$gender = filterRequest("gender");
$columnValues[] = "`gender` = '$gender'";
}
if (isset($_POST["status"])) {
$status = filterRequest("status");
$columnValues[] = "`status` = '$status'";
}
if (isset($_POST["birthdate"])) {
$birthdate = filterRequest("birthdate");
$columnValues[] = "`birthdate` = '$birthdate'";
}
if (isset($_POST["site"])) {
$site = filterRequest("site");
$columnValues[] = "`site` = '$site'";
}
if (isset($_POST["first_name"])) {
$first_name = filterRequest("first_name");
$columnValues[] = "`first_name` = '$first_name'";
}
if (isset($_POST["last_name"])) {
$last_name = filterRequest("last_name");
$columnValues[] = "`last_name` = '$last_name'";
}
if (isset($_POST["accountBank"])) {
$accountBank = filterRequest("accountBank");
$columnValues[] = "`accountBank` = '$accountBank'";
}
if (isset($_POST["education"])) {
$education = filterRequest("education");
$columnValues[] = "`education` = '$education'";
}
if (isset($_POST["employmentType"])) {
$employmentType = filterRequest("employmentType");
$columnValues[] = "`employmentType` = '$employmentType'";
}
if (isset($_POST["maritalStatus"])) {
$maritalStatus = filterRequest("maritalStatus");
$columnValues[] = "`maritalStatus` = '$maritalStatus'";
}
if (isset($_POST["bankCode"])) {
$bankCode = filterRequest("bankCode");
$columnValues[] = "`bankCode` = '$bankCode'";
}
if (isset($_POST["updated_at"])) {
$updatedAt = filterRequest("updated_at");
$columnValues[] = "`updated_at` = '$updatedAt'";
}
// Construct the SET clause of the update query
$setClause = implode(", ", $columnValues);
$sql = "UPDATE `driver` SET $setClause WHERE `id` = '$id'";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Print success message
printSuccess($message = "Driver data updated successfully");
} else {
// Print failure message
printFailure($message = "Failed to update driver data");
}
?>

View File

@@ -0,0 +1,33 @@
<?php
include "../../connect.php";
$phone_number = filterRequest("phone_number");
$token_code = filterRequest("token_code");
// Check if the phone number and token code match
$sql = "SELECT
`id`,
`phone_number`,
`token_code`,
`expiration_time`,
`is_verified`,
`created_at`
FROM
`phone_verification`
WHERE
`phone_number` = '$phone_number' AND `token_code` = '$token_code' AND `expiration_time` > NOW()";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetch();
if ($result) {
// $id = $result["id"];
$sql = "UPDATE `phone_verification` SET `is_verified` = 1 WHERE `phone_number` = $phone_number";
$stmt = $con->prepare($sql);
$stmt->execute();
printSuccess($message = "Your phone number has been verified.");
} else {
printFailure($message = "Your phone number could not be verified. Please try again.");
}
?>

View File

@@ -0,0 +1,27 @@
<?php
include "../connect.php";
$phoneNumber = filterRequest("phone_number");
$sql = "SELECT
*
FROM
`phone_verification`
WHERE
`phone_verification`.`phone_number` = '$phoneNumber'
";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Fetch the records
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
printSuccess($rows);
} else {
// Print a failure message
printFailure($message = "No Phone verified yet found");
}
?>

View File

@@ -0,0 +1,27 @@
<?php
include "../connect.php";
$phoneNumber = filterRequest("phone_number");
$sql = "SELECT
*
FROM
`phone_verification_passenger`
WHERE
`phone_verification_passenger`.`phone_number` = '$phoneNumber'
";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Fetch the records
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
printSuccess($rows);
} else {
// Print a failure message
printFailure($message = "No Phone verified yet found");
}
?>

View File

@@ -0,0 +1,23 @@
<?php
include "../connect.php";
// Import the map
$cn = array(
"0" => "3",
"1" => "7",
"2" => "1",
"3" => "9",
"4" => "0",
"5" => "5",
"6" => "2",
"7" => "6",
"8" => "4",
"9" => "8"
);
// Convert the map to a JSON string with JSON_FORCE_OBJECT option
$jsonString = json_encode($cn, JSON_FORCE_OBJECT);
// Send the JSON string to the Flutter app
echo $jsonString;
?>

View File

@@ -0,0 +1 @@
["3","7","1","9","0","5","2","6","4","8"]

View File

@@ -0,0 +1,67 @@
<?php
include "../connect.php";
$email = filterRequest('email');
$phone = filterRequest('phone');
$password = filterRequest('password');
// Hash the password
$hashed_password = password_hash($password, PASSWORD_DEFAULT);
$sql = "SELECT
passengers.`id`,
passengers.`phone`,
passengers.`email`,
passengers.`password`,
passengers.`gender`,
passengers.`birthdate`,
passengers.`site`,
passengers.`first_name`,
passengers.`last_name`,
passengers.`education`,
passengers.`employmentType`,
passengers.`maritalStatus`,
passengers.`created_at`,
passengers.`updated_at`,
email_verifications.verified
FROM
`passengers`
LEFT JOIN email_verifications ON email_verifications.email = passengers.email
WHERE
passengers.phone = :phone AND passengers.email = :email ";
$stmt = $con->prepare($sql);
$stmt->bindParam(':email', $email);
$stmt->bindParam(':phone', $phone);
$stmt->execute();
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
$count = $stmt->rowCount();
if ($count > 0) {
$stored_password = $data[0]['password'];
if (password_verify($password, $stored_password)) {
unset($data[0]['password']);
echo json_encode([
"status" => "success",
"count" => $count,
"data" => $data
]);
} else {
// The password is incorrect
echo json_encode([
"status" => "Failure",
"data" => "Incorrect password."
]);
// printFailure("Incorrect password.");
}
} else {
// The user does not exist
echo json_encode([
"status" => "Failure",
"data" => "User does not exist."
]);
// printFailure("User does not exist.");
}
$conn->close();
?>

View File

@@ -0,0 +1,41 @@
<?php
include "../connect.php";
$email = filterRequest('email');
$id = filterRequest('id');
$sql = "SELECT
*,
phone_verification_passenger.verified
FROM
passengers
LEFT JOIN phone_verification_passenger ON phone_verification_passenger.phone_number = passengers.phone
WHERE
passengers.email =:email AND passengers.id = :id AND phone_verification_passenger.verified='1'
";
$stmt = $con->prepare($sql);
$stmt->bindParam(':email', $email);
$stmt->bindParam(':id', $id);
$stmt->execute();
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
$count = $stmt->rowCount();
header('Content-Type: application/json'); // Ensure the response is JSON
if ($count > 0) {
echo json_encode([
"status" => "success",
"count" => $count,
"data" => $data
]);
} else {
echo json_encode([
"status" => "Failure",
"data" => "User does not exist."
]);
}
$stmt = null; // Close the statement
$con = null; // Close the connection
exit(); // Ensure no further output

View File

@@ -0,0 +1,42 @@
<?php
include "../connect.php";
$phone_number = filterRequest("phone_number");
$token_code = filterRequest("token");
$expiration_time = filterRequest("expiration_time"); // Assuming this is a timestamp
// Check if the phone number already exists
$sql = "SELECT * FROM `phone_verification_passenger` WHERE `phone_number` = '$phone_number'";
$stmt = $con->prepare($sql);
$stmt->execute();
$rowCount = $stmt->rowCount();
if ($rowCount > 0) {
// The phone number already exists, so update the data
$sql = "UPDATE `phone_verification_passenger` SET `token` = '$token_code', `expiration_time` = DATE_ADD(NOW(), INTERVAL 5 MINUTE) WHERE `phone_number` = '$phone_number'";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// The update was successful
printSuccess($message = "Phone verification data updated successfully");
} else {
// The update was unsuccessful
printFailure($message = "Failed to update phone verification data");
}
} else {
// The phone number does not exist, so insert the data
$sql = "INSERT INTO `phone_verification_passenger` (`phone_number`, `token`, `expiration_time`, `verified`, `created_at`) VALUES ('$phone_number', '$token_code', DATE_ADD(NOW(), INTERVAL 5 MINUTE), 0, NOW())";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// The insertion was successful
printSuccess($message = "Phone verification data saved successfully");
} else {
// The insertion was unsuccessful
printFailure($message = "Failed to save phone verification data");
}
}
?>

View File

@@ -0,0 +1,30 @@
<?php
include "../connect.php";
$platform = filterRequest("platform");
$appName = filterRequest("appName");
$sql = "SELECT
`id`,
`platform`,
`appName`,
`createdAt`,
`version`
FROM
`packageInfo`
WHERE
platform='$platform' and appName='$appName';";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -0,0 +1,42 @@
<?php
include "../../connect.php";
$phone_number = filterRequest("phone_number");
$token_code = filterRequest("token_code");
$expiration_time = filterRequest("expiration_time"); // Assuming this is a timestamp
// Check if the phone number already exists
$sql = "SELECT * FROM `phone_verification_passenger` WHERE `phone_number` = '$phone_number'";
$stmt = $con->prepare($sql);
$stmt->execute();
$rowCount = $stmt->rowCount();
if ($rowCount > 0) {
// The phone number already exists, so update the data
$sql = "UPDATE `phone_verification_passenger` SET `token_code` = '$token_code', `expiration_time` = DATE_ADD(NOW(), INTERVAL 5 MINUTE) WHERE `phone_number` = '$phone_number'";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// The update was successful
printSuccess($message = "Phone verification data updated successfully");
} else {
// The update was unsuccessful
printFailure($message = "Failed to update phone verification data");
}
} else {
// The phone number does not exist, so insert the data
$sql = "INSERT INTO `phone_verification_passenger` (`phone_number`, `token_code`, `expiration_time`, `is_verified`, `created_at`) VALUES ('$phone_number', '$token_code', DATE_ADD(NOW(), INTERVAL 5 MINUTE), 0, NOW())";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// The insertion was successful
printSuccess($message = "Phone verification data saved successfully");
} else {
// The insertion was unsuccessful
printFailure($message = "Failed to save phone verification data");
}
}
?>

View File

@@ -0,0 +1,23 @@
<?php
include "../connect.php";
$phone_number = filterRequest("phone_number");
$token_code = filterRequest("token_code");
// Check if the phone number and token code match
$sql = "SELECT `id`, `phone_number`, `token_code`, `expiration_time`, `is_verified`, `created_at` FROM `phone_verification_passenger` WHERE `phone_number` = '$phone_number' AND `token_code` = '$token_code' AND `is_verified` = 0 AND `expiration_time` > NOW()";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetch();
if ($result) {
// $id = $result["id"];
$sql = "UPDATE `phone_verification_passenger` SET `is_verified` = 1 WHERE `phone_number` = $phone_number";
$stmt = $con->prepare($sql);
$stmt->execute();
printSuccess($message = "Your phone number has been verified.");
} else {
printFailure($message = "Your phone number could not be verified. Please try again.");
}
?>

View File

@@ -0,0 +1,30 @@
<?php
include "../connect.php";
$email = filterRequest("email");
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
$headers .= "From: SEFER Team" . "\r\n";
// Create the email subject and body
$subject = 'Your SEFER account has been deleted';
$body = '
Dear passenger,
We are sorry to see you go, but we respect your decision to delete your SEFER account.
We would like to thank you for using our platform and for being a part of the SEFER community. We hope that you had a positive experience and that we were able to make your travels easier and more enjoyable.
If you have any questions or concerns, please do not hesitate to contact us.
Sincerely,
The SEFER Team
';
// Send the email
mail($email, $subject, $body);
?>

View File

@@ -0,0 +1,34 @@
<?php
include "../connect.php";
$email = filterRequest("email");
$token = filterRequest("token");
$admin='support@mobile-app.store';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
$headers .= "From: $admin" . "\r\n";
$subject = "Verify your email address";
$bodyEmail = "
<html>
<head>
<title>Verify your email address</title>
</head>
<body>
<p>Hi [$email],</p>
<p>We recently received a request to verify your email address for your account on Ride App.</p>
<p>To verify your email address, please write this to app .</p>
$token
<p>If you did not request to verify your email address, please ignore this email.</p>
<p>Thank you,</p>
SEFER Team.
</body>
</html>
";
mail($email, $subject, $bodyEmail, $headers);

View File

@@ -0,0 +1,72 @@
<?php
include "../connect.php";
$email = filterRequest("email");
$token = filterRequest("token");
$sql = "SELECT * FROM `email_verifications` WHERE `email` = '$email'";
$stmt = $con->prepare($sql);
$stmt->execute();
$rowCount = $stmt->rowCount();
$admin='support@mobile-app.store';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
$headers .= "From: $admin" . "\r\n";
$subject = "Verify your email address";
$bodyEmail = "
<html>
<head>
<title>Verify your email address</title>
</head>
<body>
<p>Hi [$email],</p>
<p>We recently received a request to verify your email address for your account on SEFER App.</p>
<p>To verify your email address, please write this to app .</p>
$token
<p>If you did not request to verify your email address, please ignore this email.</p>
<p>Thank you,</p>
SEFER Team.
</body>
</html>
";
if ($rowCount > 0) {
// The email already exists, so update the data
$sql = "UPDATE `email_verifications` SET `token` = '$token' WHERE `email` = '$email'";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// The update was successful
printSuccess($message = "Email verification data updated successfully");
mail($email, $subject, $bodyEmail, $headers);
} else {
// The update was unsuccessful
printFailure($message = "Failed to update email verification data");
}
} else {
// The email does not exist, so insert the data
$sql = "INSERT INTO `email_verifications` (`email`, `token`) VALUES ('$email', '$token')";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// The insertion was successful
printSuccess($message = "Email verification data saved successfully");
mail($email, $subject, $bodyEmail, $headers);
} else {
// The insertion was unsuccessful
printFailure($message = "Failed to save email verification data");
}
}
?>

View File

@@ -0,0 +1,64 @@
<?php
include "../connect.php";
$phone = filterRequest("phone");
$email = filterRequest("email");
$first_name = filterRequest("first_name");
$last_name = filterRequest("last_name");
$password = filterRequest("password");
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);
$gender = filterRequest("gender");
$birthdate = filterRequest("birthdate");
$site = filterRequest("site");
$id = filterRequest("id");
// Check if the phone number or email address already exists in the database
$sql = "SELECT * FROM passengers WHERE phone='$phone' OR email='$email'";
$stmt = $con->prepare($sql);
$stmt->execute();
$results = $stmt->fetchAll();
if (count($results) > 0) {
// The phone number or email address already exists in the database
// Print a message and exit
printFailure($message="The email or phone number is already registered.");
exit;
} else {
// The phone number or email address does not exist in the database
// Insert a new record
$sql = "INSERT INTO `passengers` (
`id`,
`phone`,
`email`,
`password`,
`gender`,
`birthdate`,
`site`,
`first_name`,
`last_name`
) VALUES (
'$id',
'$phone',
'$email',
'$hashedPassword',
'$gender',
'$birthdate',
'$site',
'$first_name',
'$last_name'
)";
$stmt = $con->prepare($sql);
$stmt->execute();
}
// Check if the record was successfully saved
if ($stmt->rowCount() > 0) {
// Print a success message
printSuccess($message = "success to save passenger data");
} else {
// Print a failure message
printFailure($message = "Failed to save passenger data");
}
?>

View File

@@ -0,0 +1,28 @@
<?php
include "../../connect.php";
$sql = "SELECT
*
FROM
`smsSender`
WHERE
id = '1'";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
printSuccess($data = $result);
} else {
printFailure($message = "No driver order data found");
}
?>

View File

@@ -0,0 +1,33 @@
<?php
// Include the database connection file
include "../../connect.php";
// Filter and validate the phone number input
$phone_number = filterRequest("phone_number");
// Prepare the SQL query using a parameterized query to prevent SQL injection
$sql = "UPDATE phone_verification SET is_verified = 1 WHERE phone_number = :phone_number";
// Prepare the statement
$stmt = $con->prepare($sql);
// Bind the phone number parameter
$stmt->bindParam(":phone_number", $phone_number);
// Execute the query
$stmt->execute();
// Get the number of affected rows
$affectedRows = $stmt->rowCount();
// Check if the update was successful
if ($affectedRows > 0) {
// Return a success response
printSuccess($data = ["message" => "Phone number verified successfully"]);
} else {
// Return a failure response
printFailure($message = "No phone number found or verification failed");
}
?>

View File

@@ -0,0 +1,33 @@
<?php
// Include the database connection file
include "../../connect.php";
// Filter and validate the phone number input
$phone_number = filterRequest("phone_number");
// Prepare the SQL query using a parameterized query to prevent SQL injection
$sql = "UPDATE phone_verification_passenger SET verified = 1 WHERE phone_number = :phone_number";
// Prepare the statement
$stmt = $con->prepare($sql);
// Bind the phone number parameter
$stmt->bindParam(":phone_number", $phone_number);
// Execute the query
$stmt->execute();
// Get the number of affected rows
$affectedRows = $stmt->rowCount();
// Check if the update was successful
if ($affectedRows > 0) {
// Return a success response
printSuccess($data = ["message" => "Phone number verified successfully"]);
} else {
// Return a failure response
printFailure($message = "No phone number found or verification failed");
}
?>

View File

@@ -0,0 +1,39 @@
<?php
include "../../jwtconnect.php";
$captainId = filterRequest('captain_id');
$newToken = filterRequest("token");
$fingerPrint = filterRequest("fingerPrint");
if (!$captainId || !$newToken || !$fingerPrint) {
echo json_encode([
"status" => "failure",
"message" => "Missing required fields"
]);
exit;
}
try {
// بدون أي تشفير: خزّن التوكن كما هو
$tokenPlain = $newToken;
$stmt = $con->prepare("UPDATE driverToken SET token = ?, fingerPrint = ?, updated_at = NOW() WHERE captain_id = ?");
$ok = $stmt->execute([$tokenPlain, $fingerPrint, $captainId]);
if ($ok && $stmt->rowCount() > 0) {
echo json_encode([
"status" => "success",
"message" => "Driver token updated successfully"
]);
} else {
echo json_encode([
"status" => "failure",
"message" => "Captain not found or no update performed"
]);
}
} catch (PDOException $e) {
echo json_encode([
"status" => "failure",
"message" => "Database error: " . $e->getMessage()
]);
}

View File

@@ -0,0 +1,46 @@
<?php
require_once "../../jwtconnect.php"; // يحتوي $con و $encryptionHelper و filterRequest()
header('Content-Type: application/json; charset=utf-8');
$passengerId = filterRequest('passengerID');
$newToken = filterRequest('token');
$fingerPrint = filterRequest('fingerPrint');
if (!$passengerId || !$newToken || !$fingerPrint) {
echo json_encode([
"status" => "failure",
"message" => "Missing required fields"
]);
exit;
}
try {
// تشفير التوكن قبل التخزين
// $tokenEncrypted = $encryptionHelper->encryptData($newToken);
// تحديث سجل الراكب
$stmt = $con->prepare("
UPDATE tokens
SET token = ?, fingerPrint = ?
WHERE passengerID = ?
");
$ok = $stmt->execute([$newToken, $fingerPrint, $passengerId]);
if ($ok && $stmt->rowCount() > 0) {
echo json_encode([
"status" => "success",
"message" => "Passenger token updated successfully"
]);
} else {
echo json_encode([
"status" => "failure",
"message" => "Passenger not found or no update performed"
]);
}
} catch (PDOException $e) {
echo json_encode([
"status" => "failure",
"message" => "Database error: " . $e->getMessage()
]);
}

View File

@@ -0,0 +1,39 @@
<?php
include "../connect.php";
$email = filterRequest("email");
$token = filterRequest("token");
$sql = "SELECT `id`, `email`, `token`, `created_at`, `updated_at`, `verified` FROM `email_verifications` WHERE `email` = '$email' AND `token` = '$token'";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetch();
if ($result) {
$id = $result["id"];
$sql = "UPDATE `email_verifications` SET `verified` = 1 WHERE `id` = $id";
$stmt = $con->prepare($sql);
$stmt->execute();
$admin='support@sefer.com';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
$headers .= "From: $admin" . "\r\n";
$subject = " Verify your email address";
$bodyEmail="Subject: Verify your email address
Hi [$email],
Your email address has been verified.
Thank you,
SEFER Team";
mail($email, $subject, $bodyEmail, $headers);
printSuccess($message = "Your email address has been verified.");
} else {
printFailure($message ="Your email address could not be verified. Please try again.");
}
?>

View File

@@ -0,0 +1,33 @@
<?php
include "../connect.php";
$phone_number = filterRequest("phone_number");
$token_code = filterRequest("token");
// Check if the phone number and token code match
$sql = "SELECT
`id`,
`phone_number`,
`token`,
`expiration_time`,
`verified`,
`created_at`
FROM
`phone_verification_passenger`
WHERE
`phone_number` = '$phone_number' AND `token` = '$token_code' AND `expiration_time` > NOW()";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetch();
if ($result) {
// $id = $result["id"];
$sql = "UPDATE `phone_verification_passenger` SET `verified` = 1 WHERE `phone_number` = $phone_number";
$stmt = $con->prepare($sql);
$stmt->execute();
printSuccess($message = "Your phone number has been verified.");
} else {
printFailure($message = "Your phone number could not be verified. Please try again.");
}
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Some files were not shown because too many files have changed in this diff Show More