/
home
/
u820193700
/
domains
/
throtllr.in
/
public_html
/
Upload File
HOME
<?php $host = 'localhost'; $user = 'u820193700_reown'; $pass = 'Avahan@123'; try { // Connect without database $pdo = new PDO("mysql:host=$host", $user, $pass); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Create database if it doesn't exist $pdo->exec("CREATE DATABASE IF NOT EXISTS reown_db"); $pdo->exec("USE reown_db"); // Read and execute schema.sql $sql = @file_get_contents('schema.sql'); if ($sql !== false) { $pdo->exec($sql); echo "Database setup successfully.<br>"; // Seed bikes if table is empty $bikeCount = $pdo->query("SELECT COUNT(*) FROM bikes")->fetchColumn(); if ($bikeCount == 0) { $bikes = [ [ 'reference_id' => 'RE-001', 'model_name' => 'Royal Enfield Classic 350', 'price' => 185000.00, 'year' => 2021, 'registration_year' => 2021, 'km_driven' => 12500, 'ownership' => '1st', 'insurance_status' => 'Active', 'location' => 'Bangalore', 'colour' => 'Stealth Black', 'engine_capacity' => '350', 'description' => 'Meticulously maintained Royal Enfield Classic 350 in Stealth Black color. Single owner, regular dealership service, and absolute zero issues.', 'image_url' => 'https://images.unsplash.com/photo-1558981806-ec527fa84c39?q=80&w=800' ], [ 'reference_id' => 'RE-002', 'model_name' => 'Royal Enfield Himalayan 411', 'price' => 215000.00, 'year' => 2022, 'registration_year' => 2022, 'km_driven' => 8200, 'ownership' => '1st', 'insurance_status' => 'Active', 'location' => 'Bangalore', 'colour' => 'Gravel Grey', 'engine_capacity' => '411', 'description' => 'Ready for adventure. Highly capable tourer with pannier stays and crash guards already installed.', 'image_url' => 'https://images.unsplash.com/photo-1558981420-c5f9899a28bc?q=80&w=800' ], [ 'reference_id' => 'RE-003', 'model_name' => 'Royal Enfield Interceptor 650', 'price' => 295000.00, 'year' => 2023, 'registration_year' => 2023, 'km_driven' => 4500, 'ownership' => '1st', 'insurance_status' => 'Comprehensive', 'location' => 'Bangalore', 'colour' => 'Canyon Red', 'engine_capacity' => '650', 'description' => 'Smooth parallel-twin interceptor in pristine condition. Custom exhaust fitted for a rumble.', 'image_url' => 'https://images.unsplash.com/photo-1605810731210-909289260c6c?q=80&w=800' ], [ 'reference_id' => 'RE-004', 'model_name' => 'Royal Enfield Meteor 350', 'price' => 195000.00, 'year' => 2022, 'registration_year' => 2022, 'km_driven' => 9800, 'ownership' => '1st', 'insurance_status' => 'Active', 'location' => 'Bangalore', 'colour' => 'Fireball Yellow', 'engine_capacity' => '350', 'description' => 'Comfortable cruiser with cruising windshield and backrest. Perfect for city commutes.', 'image_url' => 'https://images.unsplash.com/photo-155898120-c5f9899a28bc?q=80&w=800' ], [ 'reference_id' => 'RE-005', 'model_name' => 'Royal Enfield Bullet 350', 'price' => 95000.00, 'year' => 2018, 'registration_year' => 2018, 'km_driven' => 28000, 'ownership' => '2nd', 'insurance_status' => 'Active', 'location' => 'Chennai', 'colour' => 'Standard Black', 'engine_capacity' => '350', 'description' => 'The legend itself. Heavy flywheel and original thump sound. Kept in vintage condition.', 'image_url' => 'https://images.unsplash.com/photo-1558980394-4c7c9299fe96?q=80&w=800' ], [ 'reference_id' => 'RE-006', 'model_name' => 'Royal Enfield Thunderbird 350', 'price' => 98000.00, 'year' => 2017, 'registration_year' => 2017, 'km_driven' => 32000, 'ownership' => '2nd', 'insurance_status' => 'Active', 'location' => 'Chennai', 'colour' => 'Lightning Grey', 'engine_capacity' => '350', 'description' => 'Ultimate tourer Thunderbird with projector headlights and massive fuel tank.', 'image_url' => 'https://images.unsplash.com/photo-1558980663-3685c65f80b8?q=80&w=800' ], [ 'reference_id' => 'RE-007', 'model_name' => 'Royal Enfield Continental GT 650', 'price' => 325000.00, 'year' => 2023, 'registration_year' => 2023, 'km_driven' => 3200, 'ownership' => '1st', 'insurance_status' => 'Comprehensive', 'location' => 'Bangalore', 'colour' => 'British Racing Green', 'engine_capacity' => '650', 'description' => 'A true cafe racer. Clip-on handlebars, single-seat cowl, and British Racing Green body color.', 'image_url' => 'https://images.unsplash.com/photo-1558981806-ec527fa84c39?q=80&w=800' ], [ 'reference_id' => 'RE-008', 'model_name' => 'Royal Enfield Scram 411', 'price' => 175000.00, 'year' => 2023, 'registration_year' => 2023, 'km_driven' => 6100, 'ownership' => '1st', 'insurance_status' => 'Active', 'location' => 'Bangalore', 'colour' => 'Skyline Blue', 'engine_capacity' => '411', 'description' => 'Urban scrambler based on the Himalayan platform. Nimble and fun in city traffic.', 'image_url' => 'https://images.unsplash.com/photo-1558981420-c5f9899a28bc?q=80&w=800' ] ]; $stmtBike = $pdo->prepare("INSERT INTO bikes (reference_id, model_name, price, year, registration_year, km_driven, ownership, insurance_status, location, colour, engine_capacity, description, status, is_featured) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'available', TRUE)"); $stmtImg = $pdo->prepare("INSERT INTO bike_images (bike_id, image_url, is_main) VALUES (?, ?, TRUE)"); foreach ($bikes as $b) { $stmtBike->execute([ $b['reference_id'], $b['model_name'], $b['price'], $b['year'], $b['registration_year'], $b['km_driven'], $b['ownership'], $b['insurance_status'], $b['location'], $b['colour'], $b['engine_capacity'], $b['description'] ]); $bikeId = $pdo->lastInsertId(); $stmtImg->execute([$bikeId, $b['image_url']]); } echo "Seeded " . count($bikes) . " mock Royal Enfield bikes.<br>"; } } else { echo "Could not read schema.sql.<br>"; } // Add subject column just in case schema.sql was an older version try { $pdo->exec("ALTER TABLE enquiries ADD COLUMN subject VARCHAR(255) AFTER phone"); echo "Added subject column.<br>"; } catch(PDOException $e) { // Ignore if column exists } echo "Setup complete. Database seeded."; } catch (PDOException $e) { echo "Connection failed: " . $e->getMessage(); }