/* Native professional filter helpers. Kept separate from legacy functions. */ function onehd_filter_build_where($types, $years, $countries, $genres, $rating, $keyword) { $clauses = array('1=1'); $bindTypes = ''; $params = array(); $types = array_values(array_unique(array_filter(array_map('intval', (array) $types), function ($value) { return in_array($value, array(1, 2), true); }))); if (!$types) $types = array(1, 2); $clauses[] = 'type IN (' . implode(',', array_fill(0, count($types), '?')) . ')'; foreach ($types as $value) { $bindTypes .= 'i'; $params[] = $value; } $years = array_values(array_unique(array_filter(array_map('intval', (array) $years), function ($value) { return $value >= 1900 && $value <= ((int) date('Y') + 2); }))); if ($years) { $clauses[] = 'year IN (' . implode(',', array_fill(0, count($years), '?')) . ')'; foreach ($years as $value) { $bindTypes .= 'i'; $params[] = $value; } } foreach (array('country' => (array) $countries, 'genre' => (array) $genres) as $column => $values) { $values = array_values(array_unique(array_filter(array_map('trim', $values), function ($value) { return $value !== '' && mb_strlen($value, 'UTF-8') <= 80; }))); if ($values) { $or = array(); foreach ($values as $value) { $or[] = "FIND_IN_SET(?, REPLACE(`$column`, ', ', ',')) > 0"; $bindTypes .= 's'; $params[] = $value; } $clauses[] = '(' . implode(' OR ', $or) . ')'; } } $rating = max(0, min(10, (float) $rating)); if ($rating > 0) { $clauses[] = 'COALESCE(NULLIF(imdbratingcount, \'\'), 0) >= ?'; $bindTypes .= 'd'; $params[] = $rating; } $keyword = trim((string) $keyword); if ($keyword !== '') { $keyword = mb_substr($keyword, 0, 100, 'UTF-8'); $clauses[] = 'name LIKE ?'; $bindTypes .= 's'; $params[] = '%' . $keyword . '%'; } return array(implode(' AND ', $clauses), $bindTypes, $params); } function onehd_filter_bind($stmt, $types, &$params) { if ($types === '' || !$params) return; $args = array($types); foreach ($params as $index => $value) { $args[] = &$params[$index]; } call_user_func_array(array($stmt, 'bind_param'), $args); } function onehd_count_filter_data($types, $years, $countries, $genres, $rating, $keyword, $conn) { list($where, $bindTypes, $params) = onehd_filter_build_where($types, $years, $countries, $genres, $rating, $keyword); $stmt = $conn->prepare('SELECT COUNT(*) FROM movies WHERE ' . $where); if (!$stmt) return 0; onehd_filter_bind($stmt, $bindTypes, $params); $stmt->execute(); $stmt->bind_result($count); $stmt->fetch(); $stmt->close(); return (int) $count; } function onehd_get_filter_data($types, $years, $countries, $genres, $rating, $keyword, $sort, $order, $conn, $offset, $limit) { list($where, $bindTypes, $params) = onehd_filter_build_where($types, $years, $countries, $genres, $rating, $keyword); $sortMap = array( 'latest' => 'date_posted', 'rating' => 'imdbratingcount', 'year' => 'year', 'title' => 'name' ); $sortColumn = isset($sortMap[$sort]) ? $sortMap[$sort] : 'date_posted'; $direction = strtolower((string) $order) === 'asc' ? 'ASC' : 'DESC'; $offset = max(0, (int) $offset); $limit = max(1, min(100, (int) $limit)); $sql = "SELECT * FROM movies WHERE $where ORDER BY `$sortColumn` $direction, id DESC LIMIT ?, ?"; $stmt = $conn->prepare($sql); if (!$stmt) return array(); $bindTypes .= 'ii'; $params[] = $offset; $params[] = $limit; onehd_filter_bind($stmt, $bindTypes, $params); $stmt->execute(); $result = $stmt->get_result(); $rows = array(); while ($row = $result->fetch_assoc()) $rows[] = $row; $stmt->close(); return $rows; } 1HD | Watch best United States of America movies and series HD
HiAnime - Watch Anime Free

United States of America Movies, TV Series

HD
Bill Burr: Paper Tiger
HD
Polaroid

Polaroid

Movie 2019
HD
The Cheerleader Escort
HD
Keys to the City

Keys to the City

Movie 2019
HD
Narrowsburg

Narrowsburg

Movie 2019
HD
Forever in My Heart

Forever in My Heart

Movie 2019
HD
Candy Corn

Candy Corn

Movie 2019
HD
Monster Force Zero

Monster Force Zero

Movie 2020
HD
The Weekend

The Weekend

Movie 2019
HD
The Sound of Silence
HD
Deviant Love

Deviant Love

Movie 2019
HD
The Favorite

The Favorite

Movie 2019
HD
Depraved

Depraved

Movie 2019
HD
Clown Nightmare

Clown Nightmare

Movie 2019
HD
Imprisoned

Imprisoned

Movie 2019
HD
Modern Prodigal

Modern Prodigal

Movie 2019
HD
After Midnight

After Midnight

Movie 2019
HD
Mayday

Mayday

Movie 2019
HD
American Confederate
HD
Senior Love Triangle
HD
Witnesses

Witnesses

Movie 2019
HD
Famous and Fatal

Famous and Fatal

Movie 2019
HD
The Wrong Cheerleader
HD
Ready for War

Ready for War

Movie 2019
HD
I Am Not Alone

I Am Not Alone

Movie 2019
HD
The Giant

The Giant

Movie 2019
HD
The Dark Crystal

The Dark Crystal

Movie 1982
HD
My Best Friend's Famous
HD
Christmas Break-In

Christmas Break-In

Movie 2019
HD
Blackbird

Blackbird

Movie 2019
HD
Next Level

Next Level

Movie 2019
HD
Nineteen Summers

Nineteen Summers

Movie 2019
HD
Holiday Hell

Holiday Hell

Movie 2019
HD
Red Penguins

Red Penguins

Movie 2019
HD
Dads

Dads

Movie 2019