require_once __DIR__ . '/database_config.php'; require_once __DIR__ . '/Database.php'; /* ----------------------------- DB Bootstrap ----------------------------- */ if (!defined('DATABASE_HOST')) { die('FATAL: database_config.php missing DATABASE_* constants.'); } $database = new Database( DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME ); if (!$database) { die('FATAL: $database not initialized.'); } /* ----------------------------- Request Vars ----------------------------- */ $viewerId = isset($_SESSION['id']) ? (int)$_SESSION['id'] : 0; $viewerName = isset($_SESSION['name']) ? (string)$_SESSION['name'] : 'Guest'; $post_number = isset($_GET['id']) ? preg_replace('/\D+/', '', (string)$_GET['id']) : ''; $ownerId = isset($_GET['OwnerId']) ? (int)$_GET['OwnerId'] : 0; if ($post_number === '') { die('Missing post id'); } $baseImg = "http://sfbay.metropolitanclassifieds.com/"; /* -------------------------- Fetch Listing Record ------------------------- */ $qry_urgent = " SELECT ad_posted.*, user_registration.pk_id AS reg_pk_id, user_registration.firstname, user_registration.lastname, user_registration.city AS reg_city, user_registration.state AS reg_state, user_registration.ProfilePicture, user_registration.dob_year, user_registration.dob_month, user_registration.dob_day FROM ad_posted LEFT JOIN user_registration ON user_registration.pk_id = ad_posted.user_id WHERE ad_posted.category = 'mentowoman' AND ad_posted.post_number = '" . $database->sanitize($post_number) . "' LIMIT 1 "; $qry_data = $database->fetch_one_data($qry_urgent); if (!is_array($qry_data) || empty($qry_data)) { die('Listing not found.'); } /* Use ownerId from URL if provided; otherwise derive from ad record */ if ($ownerId <= 0 && !empty($qry_data['user_id'])) { $ownerId = (int)$qry_data['user_id']; } /* ------------------------------ View Tracking ----------------------------- */ if ($viewerId > 0 && $ownerId > 0) { $database->insert_to_database('ViewProfileHistory', array( 'ProfileViewOf' => $ownerId, 'ProfileViewBy' => $viewerId, 'ActionType' => 'View', 'ViewDateTime' => date('Y-m-d H:i:s') )); } /* ----------------------------- Sidebar Users ----------------------------- */ $users = array(); if ($viewerId > 0) { $users = $database->get_array_rs( "SELECT * FROM user_registration WHERE pk_id != '" . $database->sanitize($viewerId) . "' ORDER BY pk_id DESC LIMIT 15" ); } /* ----------------------------- Images / Gallery --------------------------- */ $profileImg = "default.png"; if (!empty($qry_data['image_filename'])) { $profileImg = $baseImg . ltrim($qry_data['image_filename'], '/'); } $photos = array(); for ($i = 2; $i <= 26; $i++) { $key = 'image_filename' . $i; if (!empty($qry_data[$key])) { $photos[] = $baseImg . ltrim($qry_data[$key], '/'); } } /* ------------------------------ Activity Info ---------------------------- */ $last_activity = array(); if ($ownerId > 0) { $last_activity = $database->fetch_one_data( "SELECT UNIX_TIMESTAMP(ViewDateTime) AS last_active_ts FROM ViewProfileHistory WHERE ProfileViewBy = '" . $database->sanitize($ownerId) . "' ORDER BY ViewDateTime DESC LIMIT 1" ); if (!is_array($last_activity)) $last_activity = array(); } /* ------------------------------- Helpers -------------------------------- */ function timespan($seconds, $time = '') { if (!is_numeric($time)) $time = time(); $seconds = ($time <= $seconds) ? 1 : ($time - $seconds); $years = floor($seconds / (365.25 * 24 * 60 * 60)); if ($years > 0) return ($years == 1) ? 'a year ago' : $years . ' years ago'; $months = floor($seconds / ((365.25 / 12) * 24 * 60 * 60)); if ($months > 0) return ($months == 1) ? 'a month ago' : $months . ' months ago'; $weeks = floor($seconds / (7 * 24 * 60 * 60)); if ($weeks > 0) return ($weeks == 1) ? 'a week ago' : $weeks . ' weeks ago'; $days = floor($seconds / (24 * 60 * 60)); if ($days > 0) return ($days == 1) ? 'Yesterday' : $days . ' days ago'; $hours = floor($seconds / (60 * 60)); if ($hours > 0) return ($hours == 1) ? 'an hour ago' : $hours . ' hours ago'; $minutes = floor($seconds / 60); if ($minutes > 0) return ($minutes == 1) ? 'a minute ago' : $minutes . ' minutes ago'; return 'Today'; } function GetAge($yy = "1970", $mm = "-01", $dd = "-01") { $curMonth = (int)date("m"); $curDay = (int)date("j"); $curYear = (int)date("Y"); $yy = (int)$yy; $mm = (int)$mm; $dd = (int)$dd; $age = $curYear - $yy; if ($curMonth < $mm || ($curMonth == $mm && $curDay < $dd)) $age--; return $age; } $fullName = trim(($qry_data['firstname'] ?? '') . ' ' . ($qry_data['lastname'] ?? '')); $age = (!empty($qry_data['dob_year']) ? GetAge($qry_data['dob_year'], $qry_data['dob_month'], $qry_data['dob_day']) : ''); $city = $qry_data['reg_city'] ?? ($qry_data['city'] ?? ''); $state = $qry_data['reg_state'] ?? ($qry_data['state'] ?? ''); $lastSeen = (!empty($last_activity['last_active_ts']) ? timespan((int)$last_activity['last_active_ts']) : 'Unknown'); $title = $qry_data['title'] ?? 'Profile'; $desc = $qry_data['description'] ?? ''; $lookingFor = $qry_data['description_lookingfor'] ?? ''; /* For message link, use the profile owner pk_id if present */ $chatUserId = !empty($qry_data['reg_pk_id']) ? (int)$qry_data['reg_pk_id'] : $ownerId; ?> <br /> <b>Warning</b>: Undefined variable $title in <b>/home/ck36l2nqi40p/public_html/mentowoman_ads.php</b> on line <b>213</b><br /> <br /> <b>Deprecated</b>: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/home/ck36l2nqi40p/public_html/mentowoman_ads.php</b> on line <b>213</b><br /> | Metropolitan Classifieds
Metropolitan Classifieds

Warning: Undefined variable $viewerName in /home/ck36l2nqi40p/public_html/mentowoman_ads.php on line 461

Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /home/ck36l2nqi40p/public_html/mentowoman_ads.php on line 461

Warning: Undefined variable $viewerId in /home/ck36l2nqi40p/public_html/mentowoman_ads.php on line 462
Login Back to Results


Warning: Undefined variable $fullName in /home/ck36l2nqi40p/public_html/mentowoman_ads.php on line 500

Warning: Undefined variable $fullName in /home/ck36l2nqi40p/public_html/mentowoman_ads.php on line 500

Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /home/ck36l2nqi40p/public_html/mentowoman_ads.php on line 500


Warning: Undefined variable $age in /home/ck36l2nqi40p/public_html/mentowoman_ads.php on line 502

Warning: Undefined variable $age in /home/ck36l2nqi40p/public_html/mentowoman_ads.php on line 503
0 years old
Warning: Undefined variable $city in /home/ck36l2nqi40p/public_html/mentowoman_ads.php on line 505

Warning: Undefined variable $state in /home/ck36l2nqi40p/public_html/mentowoman_ads.php on line 505

Warning: Undefined variable $lastSeen in /home/ck36l2nqi40p/public_html/mentowoman_ads.php on line 509

Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /home/ck36l2nqi40p/public_html/mentowoman_ads.php on line 509
• Last activity:

Warning: Undefined variable $chatUserId in /home/ck36l2nqi40p/public_html/mentowoman_ads.php on line 513
Back

Listing Details

Category
Title
Location
Posted

About


Warning: Undefined variable $desc in /home/ck36l2nqi40p/public_html/mentowoman_ads.php on line 535

Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /home/ck36l2nqi40p/public_html/mentowoman_ads.php on line 535

Warning: Undefined variable $lookingFor in /home/ck36l2nqi40p/public_html/mentowoman_ads.php on line 538

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/ck36l2nqi40p/public_html/mentowoman_ads.php on line 538
© 2026 Metropolitan Classifieds