Пример #1
0
 $userid = $_SESSION['userid'];
 if (isset($_POST['favourite'])) {
     yasDB_delete("DELETE FROM favourite WHERE userid='{$userid}' AND gameid = '{$_POST['gamedelete']}'", false);
 }
 $result = yasDB_select("SELECT gameid FROM favourite WHERE userid='{$_SESSION['userid']}'", false);
 $numrows = $result->num_rows;
 $result->close();
 if ($numrows == 0) {
     echo "<center><h3>You have no favorite games.</h3></center>";
 } else {
     $pageurl = new pagination($numrows, $setting['seo'], 'favourites', $setting['gperpage'], 3);
     $query = yasDB_select("SELECT * FROM favourite WHERE userid= '{$userid}' LIMIT " . $pageurl->start . ", " . $pageurl->limit);
     while ($row = $query->fetch_array(MYSQLI_ASSOC)) {
         $games = yasDB_select("SELECT * FROM games WHERE id = '{$row['gameid']}'");
         $games = $games->fetch_array(MYSQLI_ASSOC);
         $gameurl = prepGame($games['file']);
         $games['description'] = stripslashes($games['description']);
         if (strlen($games['description']) > 75) {
             $games['description'] = substr($games['description'], 0, 75) . "...";
         } else {
             $games['description'] = $games['description'];
         }
         if ($setting['seo'] == 'yes') {
             $gurl = $setting['siteurl'] . 'game/' . $games['id'] . '/' . $gameurl . '.html';
         } else {
             $gurl = $setting['siteurl'] . 'index.php?act=game&id=' . $games['id'];
         }
         if (file_exists($setting['sitepath'] . '/' . $games['thumbnail'])) {
             $thumbnail = $setting['siteurl'] . $games['thumbnail'];
             $thumbnail = urldecode($thumbnail);
         } else {
Пример #2
0
function get_mgffeed()
{
    global $mysqli;
    error_reporting(E_ALL ^ E_NOTICE);
    @ini_set("max_execution_time", 600);
    @ini_set("default_socket_timeout", 240);
    // create array of game tags for duplicate checking
    $query = yasDB_select("SELECT `uid` FROM `mgffeed`", false);
    $tags = array();
    $i = 0;
    while ($alltags = $query->fetch_array(MYSQLI_ASSOC)) {
        $tags[$i] = $alltags['uid'];
        $i++;
    }
    unset($alltags);
    $query->close();
    // This is the MGF feed url. For more info go here: http://www.mochigamefeed.com/feed.php
    $feedUrl = 'http://mochigamefeed.com/updatedfeed.php';
    $data = get_content_of_url($feedUrl);
    $json_data = json_decode($data, true);
    unset($data);
    $json_count = count($json_data);
    //$cat_array = array("puzzle", "action", "adventure", "sports", "shooter", "casino", "other", "girls", "education", "strategy", "jigsaw", "coloring", "driving", "fighting", "rhythm", "board game", "customize");
    $cat_array = array("puzzle", "action", "adventure", "sports", "shooter", "casino", "other", "dressup", "arcade", "strategy", "cartoon", "coloring");
    foreach ($json_data as $json) {
        if ($json['title'] == NULL) {
            break;
        }
        if (!in_array($json['id'], $tags)) {
            $cat = strtolower(yasDB_clean($json['category']));
            if (in_array($cat, $cat_array)) {
                $category = array_search($cat, $cat_array) + 1;
            } else {
                $category = 7;
                // if not found set category to other
            }
            $title = yasDB_clean($json['title']);
            $uid = intval($json['id']);
            $game_file = yasDB_clean($json['file']);
            $game_url = "http://www.mochigamefeed.com/view/" . intval($json['id']) . "/" . prepGame($title) . ".html";
            $width = intval($json['width']);
            $height = intval($json['height']);
            $description = yasDB_clean($json['description']);
            $instructions = yasDB_clean($json['instructions']);
            $small_thumburl = yasDB_clean($json['thumbnail']);
            $medium_thumburl = yasDB_clean($json['medthumb']);
            $large_thumburl = yasDB_clean($json['lgthumb']);
            $screen1 = yasDB_clean($json['screen1']);
            $screen1 = yasDB_clean($json['screen2']);
            $zip = yasDB_clean($json['zip']);
            $controls = yasDB_clean(stripslashes($json['controls']));
            $created = yasDB_clean($json['installdate']);
            $review = yasDB_clean($json['review']);
            $rating = yasDB_clean($json['rating']);
            $ads = yasDB_clean($json['ads']);
            $hsapi = yasDB_clean($json['hsapi']);
            $keywords = yasDB_clean($json['keywords']);
            $sql = "INSERT INTO mgffeed (`id`, `uid`, `title`, `controls`, `installdate`, `game_url`, `description`, `instructions`, `category`, `thumbnail`, `medthumb`, `lgthumb`, `file`, `zip`, `screen1`, `screen2`, `width`, `height`, `review`, `rating`, `ads`, `hsapi`, `keywords`,`installed`, `hidden`)\n      VALUES (NULL, {$uid}, '{$title}', '{$controls}', '{$created}', '{$game_url}', '{$description}', '{$instructions}', {$category}, '{$small_thumburl}', '{$medium_thumburl}', '{$large_thumburl}', '{$game_file}', '{$zip}', '{$screen1}', '{$screen2}', {$width}, {$height}, '{$review}', '{$rating}', '{$ads}', '{$hsapi}', '{$keywords}', '0', '0')";
            $return = yasDB_insert($sql, false);
            if (!$return) {
                break;
            }
            // if there is a db insert error just keep going.
        }
    }
    unset($json);
    unset($json_data);
    return true;
}
Пример #3
0
<div id="center">
<div class="container_box1">
<div class="header">Search Results for <?php 
echo $q;
?>
</div>   
<?php 
if (!ctype_digit($q)) {
    $query = yasDB_select("SELECT * FROM games WHERE title LIKE '%{$q}%' OR description LIKE '%{$q}%' ORDER BY (CASE WHEN title LIKE '%{$q}%' THEN 1 ELSE 0 END) DESC limit 20", false);
}
if ($query->num_rows == '0') {
    echo '<div id="text_box">No results!</div>';
    echo "";
}
while ($games = $query->fetch_array(MYSQLI_ASSOC)) {
    $gameurl = prepGame($games['title']);
    $games['description'] = substr($games['description'], 0, 140) . '...';
    $games['description'] = stripslashes($games['description']);
    $description = str_replace(array("\r\n", "\r", "\n", "'", '"'), ' ', $games['description']);
    if (strlen($games['title']) > 19) {
        $games['title'] = substr($games['title'], 0, 16) . '...';
    } else {
        $games['title'] = $games['title'];
    }
    if (file_exists($games['thumbnail'])) {
        $thumbnail = $games['thumbnail'];
        $thumbnail = urldecode($thumbnail);
    } else {
        $thumbnail = $setting['siteurl'] . 'templates/' . $setting['theme'] . '/skins/' . $setting['skin'] . '/images/nopic.jpg';
    }
    $pic_settings = array('w' => 130, 'h' => 100);