Skip to content

sbatin2 #1657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
msbatin1 opened this issue Apr 10, 2025 · 0 comments
Open

sbatin2 #1657

msbatin1 opened this issue Apr 10, 2025 · 0 comments

Comments

@msbatin1
Copy link

mysql.example.com$wgDBserver = "mysql.example.com";
$wgDBname = "mywiki_db";
$wgDBuser = "mywiki_user";
$wgDBpassword = "securepassword";

setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // الحصول على عنوان IP الخاص بالزائر $ip_address = $_SERVER['REMOTE_ADDR']; // الحصول على عنوان URL للصفحة الحالية $page_url = $_SERVER['REQUEST_URI']; // إعداد استعلام SQL لإدخال البيانات $stmt = $conn->prepare("INSERT INTO page_visits (ip_address, page_url) VALUES (:ip, :url)"); $stmt->bindParam(':ip', $ip_address); $stmt->bindParam(':url', $page_url); // تنفيذ الاستعلام $stmt->execute(); } catch(PDOException $e) { // يمكنك تسجيل الخطأ هنا بدلاً من عرضه للمستخدم في بيئة الإنتاج error_log("Database Error: " . $e->getMessage()); } $conn = null; // إغلاق الاتصال بقاعدة البيانات ?>

CREATE TABLE IF NOT EXISTS page_visits (
id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
visit_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
ip_address VARCHAR(45) DEFAULT NULL,
page_url VARCHAR(255) DEFAULT NULL
);
$wgDBserver = "هنا ضع اسم مضيف قاعدة البيانات";
$wgDBname = "هنا ضع اسم قاعدة البيانات";
$wgDBuser = "هنا ضع اسم مستخدم قاعدة البيانات";
$wgDBpassword = "هنا ضع كلمة مرور قاعدة البيانات";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant