/
home
/
u551664935
/
domains
/
mechfactory.in
/
public_html
/
post_job
/
Upload File
HOME
<?php include '../config.php'; // Adjust path if config.php is in a different folder $success = ''; $error = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $company = $_POST['company_name']; $email = $_POST['email']; $pass = password_hash($_POST['password'], PASSWORD_DEFAULT); $mobile = $_POST['mobile']; $address = $_POST['address']; $gst_file = $_FILES['gst']['name'] ?? ''; $card_file = $_FILES['card']['name'] ?? ''; // File upload directory $uploadDir = "uploads/"; // Ensure uploads folder exists if (!file_exists($uploadDir)) { mkdir($uploadDir, 0777, true); } // Move uploaded files $gstPath = $uploadDir . basename($gst_file); $cardPath = $uploadDir . basename($card_file); if (!move_uploaded_file($_FILES['gst']['tmp_name'], $gstPath)) { $error = "Failed to upload GST Certificate."; } elseif (!move_uploaded_file($_FILES['card']['tmp_name'], $cardPath)) { $error = "Failed to upload Visiting Card."; } else { $stmt = $conn->prepare("INSERT INTO users1 (company_name, email, password, mobile, address, gst_certificate, visiting_card) VALUES (?, ?, ?, ?, ?, ?, ?)"); $stmt->bind_param("sssssss", $company, $email, $pass, $mobile, $address, $gst_file, $card_file); if ($stmt->execute()) { $success = "Registered successfully. <a href='login.php' class='underline text-blue-600'>Login Now</a>"; } else { $error = "Database Error: " . $stmt->error; } $stmt->close(); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Register - MechFactory</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="Register your mechanical job work company on MechFactory. Upload GST certificate and visiting card to list your business."> <meta name="keywords" content="mechanical job work, register company, job work portal"> <meta name="robots" content="index, follow"> <link rel="canonical" href="https://mechfactory.in/register.php"> <script src="https://cdn.tailwindcss.com"></script> </head> <body class="bg-gray-100 flex items-center justify-center min-h-screen"> <div class="bg-white shadow-lg rounded-lg w-full max-w-xl p-8"> <h2 class="text-3xl font-bold text-blue-700 text-center mb-6">Register as Job Worker Company</h2> <?php if (!empty($success)): ?> <div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded mb-4"> <?= $success ?> </div> <?php elseif (!empty($error)): ?> <div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4"> <?= $error ?> </div> <?php endif; ?> <form method="POST" enctype="multipart/form-data" class="space-y-5"> <div> <label class="block text-sm font-medium text-gray-700">Company Name</label> <input type="text" name="company_name" required class="w-full px-4 py-2 border border-gray-300 rounded focus:ring-blue-500 focus:outline-none"> </div> <div> <label class="block text-sm font-medium text-gray-700">Email Address</label> <input type="email" name="email" required class="w-full px-4 py-2 border border-gray-300 rounded focus:ring-blue-500 focus:outline-none"> </div> <div> <label class="block text-sm font-medium text-gray-700">Password</label> <input type="password" name="password" required class="w-full px-4 py-2 border border-gray-300 rounded focus:ring-blue-500 focus:outline-none"> </div> <div> <label class="block text-sm font-medium text-gray-700">Mobile Number</label> <input type="text" name="mobile" required class="w-full px-4 py-2 border border-gray-300 rounded focus:ring-blue-500 focus:outline-none"> </div> <div> <label class="block text-sm font-medium text-gray-700">Full Address</label> <textarea name="address" required rows="3" class="w-full px-4 py-2 border border-gray-300 rounded focus:ring-blue-500 focus:outline-none"></textarea> </div> <div> <label class="block text-sm font-medium text-gray-700">GST Certificate</label> <input type="file" name="gst" required class="w-full"> </div> <div> <label class="block text-sm font-medium text-gray-700">Visiting Card</label> <input type="file" name="card" required class="w-full"> </div> <button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-semibold py-2 px-4 rounded transition"> Register </button> </form> <p class="text-center text-sm text-gray-600 mt-6"> Already have an account? <a href="login.php" class="text-blue-600 hover:underline">Login</a> </p> </div> </body> </html>