// ak hladany vyraz nieje FALSE
if (!empty($_GET['search_string'])) {
// ak hladany vyraz ma menej ako 3 znaky
if (strlen($_GET['search_string']) < 3) {
echo "search word must have at least three signs";
} else {
include '/home/funnygames/public_html/newfg/includes/function/inc_fun_db_query.php';
include '/home/funnygames/public_html/newfg/includes/function/inc_fun_str_rating.php';
include '/home/funnygames/public_html/newfg/includes/function/inc_fun_check_new.php';
include '/home/funnygames/public_html/newfg/includes/function/inc_fun_calcul_rating.php';
include '/home/funnygames/public_html/newfg/includes/function/inc_fun_url_full_game.php';
include '/home/funnygames/public_html/newfg/includes/function/inc_konvert_name_on_url.php';
echo "Search results for '" . $_GET['search_string'] . "'
";
// GAMES
echo "
I DID MY BEST AND FOUND THESE GAMES:
";
$cfg['new_content_date'] = 7;
$searchString = '%' . strtolower($_GET['search_string']) . '%';
$query = "
SELECT
A.file_name,
A.name_img,
A.name,
A.title,
IF(A.`datetime_activation` > DATE_SUB(NOW(), INTERVAL ? DAY), 1, 0) as new,
B.score,
B.votes
FROM
fg_content_online_game as A
LEFT JOIN
fg_rating as B
ON
B.id_sort = 1 AND B.id_content = A.id_row
WHERE
A.status = 1
AND
LOWER(A.name) LIKE ?
";
$stmt = $con->prepare($query);
$stmt->bind_param('is', $cfg['new_content_date'], $searchString);
$stmt->execute();
$result = $stmt->get_result();
$stmt->close();
// ak je pocet zaznamov nula...
if (mysqli_num_rows($result) == 0) {
echo "Not found";
} // end if..
While ($arr = mysqli_fetch_array($result)) {
$temp_rating = calcul_rating($arr['votes'], $arr['score']);
echo"
" . $arr['name'] . "
" . check_new($arr['new']) . "" . $arr['title'] . "
Current rating:
" . str_rating($temp_rating, 1) . " Game (" . $temp_rating . "% - based on " . $arr['votes'] . " votes)
";
} // end while..
// CARTOONS
echo "
I DID MY BEST AND FOUND THESE CARTOONS:
";
$cfg['new_content_date'] = 7;
$searchString = '%' . strtolower($_GET['search_string']) . '%';
$query = "
SELECT
A.file_name,
A.name_img,
A.name,
A.title,
IF(A.`datetime_activation` > DATE_SUB(NOW(), INTERVAL ? DAY), 1, 0) as new,
B.score,
B.votes
FROM
fg_content_cartoon as A
LEFT JOIN
fg_rating as B
ON
B.id_sort = 4 AND B.id_content = A.id_row
WHERE
A.status = 1
AND
LOWER(A.name) LIKE ?
";
$stmt = $con->prepare($query);
$stmt->bind_param('is', $cfg['new_content_date'], $searchString);
$stmt->execute();
$result = $stmt->get_result(); // This returns a mysqli_result object
$stmt->close();
// ak je pocet zaznamov nula...
if (mysqli_num_rows($result) == 0) {
echo "Not found";
} // end if..
While ($arr = mysqli_fetch_array($result)) {
$temp_rating = calcul_rating($arr['votes'], $arr['score']);
echo"
" . $arr['name'] . "
" . check_new($arr['new']) . "" . $arr['title'] . "
Current rating:
" . str_rating($temp_rating, 1) . " Cartoon (" . $temp_rating . "% - based on " . $arr['votes'] . " votes)
";
} // end while..
// VIDEOS
echo "
I DID MY BEST AND FOUND THESE VIDEOS:
";
$cfg['new_content_date'] = 7;
$searchString = '%' . strtolower($_GET['search_string']) . '%';
$query = "
SELECT
A.id_row,
A.file_name,
A.page_name,
A.name,
A.title,
IF(A.`datetime_activation` > DATE_SUB(NOW(), INTERVAL ? DAY), 1, 0) as new,
B.score,
B.votes
FROM
fg_content_video as A
LEFT JOIN
fg_rating as B
ON
B.id_sort = 5 AND B.id_content = A.id_row
WHERE
A.status = 1
AND
LOWER(A.name) LIKE ?
";
$stmt = $con->prepare($query);
$stmt->bind_param('is', $cfg['new_content_date'], $searchString);
$stmt->execute();
$result = $stmt->get_result(); // This returns a mysqli_result object
$stmt->close();
// ak je pocet zaznamov nula...
if (mysqli_num_rows($result) == 0) {
echo "Not found";
} // end if..
While ($arr = mysqli_fetch_array($result)) {
$temp_rating = calcul_rating($arr['votes'], $arr['score']);
echo"
" . $arr['name'] . "
" . check_new($arr['new']) . "" . $arr['title'] . "
Current rating:
" . str_rating($temp_rating, 1) . " Video (" . $temp_rating . "% - based on " . $arr['votes'] . " votes)
";
} // end while..
// PICTURES
echo "
I DID MY BEST AND FOUND THESE PICTURES:
";
$cfg['new_content_date'] = 7;
$searchString = '%' . strtolower($_GET['search_string']) . '%';
$query = "
SELECT
A.id_row,
A.file_name,
A.page_name,
A.name,
A.title,
IF(A.`datetime_activation` > DATE_SUB(NOW(), INTERVAL ? DAY), 1, 0) as new,
B.score,
B.votes
FROM
fg_content_picture as A
LEFT JOIN
fg_rating as B
ON
B.id_sort = 6 AND B.id_content = A.id_row
WHERE
A.status = 1
AND
LOWER(A.name) LIKE ?
";
$stmt = $con->prepare($query);
$stmt->bind_param('is', $cfg['new_content_date'], $searchString);
$stmt->execute();
$result = $stmt->get_result(); // This returns a mysqli_result object
$stmt->close();
// ak je pocet zaznamov nula...
if (mysqli_num_rows($result) == 0) {
echo "Not found";
} // end if..
While ($arr = mysqli_fetch_array($result)) {
$temp_rating = calcul_rating($arr['votes'], $arr['score']);
echo"
" . $arr['name'] . "
" . check_new($arr['new']) . "" . $arr['title'] . "
Current rating:
" . str_rating($temp_rating, 1) . " Picture (" . $temp_rating . "% - based on " . $arr['votes'] . " votes)
";
} // end while..
// JOKES
echo "
I DID MY BEST AND FOUND THESE JOKES:
";
$cfg['new_content_date'] = 7;
$searchString = '%' . strtolower($_GET['search_string']) . '%';
$query = "
SELECT
file_name,
name,
title,
IF(`datetime_activation` > DATE_SUB(NOW(), INTERVAL ? DAY), 1, 0) as new
FROM
fg_content_joke
WHERE
status = 1
AND
LOWER(name) LIKE ?
";
$stmt = $con->prepare($query);
$stmt->bind_param('is', $cfg['new_content_date'], $searchString);
$stmt->execute();
$result = $stmt->get_result(); // This returns a mysqli_result object
$stmt->close();
$mysqli->close();
// ak je pocet zaznamov nula...
if (mysqli_num_rows($result) == 0) {
echo "Not found";
} // end if..
While ($arr = mysqli_fetch_array($result)) {
echo"
";
} // end while..
} // end if..
} else {
echo "
Please enter your search keywords!
";
} // end if.. else..
?>