prepare('select * from assets where AssetID = :gid'); $FindGames->execute(['gid' =>(int) $_GET["id"]]); $row = $FindGames->fetch(PDO::FETCH_ASSOC); if($row['AssetType'] === 9){ header("Location: /games/".$row['AssetID']."/".ucwords(str_replace(" ", "-", $row['Name']))); } $Find1 = $pdo->prepare('select * from users where UserId=:uid'); $Find1->execute(['uid'=>$row['CreatorID']]); $creator = $Find1->fetch(PDO::FETCH_ASSOC); } if(!$row) { exit("item doesnt exist"); } function returnName($assetType){ global $asset_types; return $asset_types[$assetType] ?? "Unknown"; } function timeAgo($timestamp) { $time = time() - $timestamp; $units = [ 31536000 => 'year', 2592000 => 'month', 604800 => 'week', 86400 => 'day', 3600 => 'hour', 60 => 'minute', 1 => 'second' ]; foreach ($units as $unitSeconds => $unitName) { if ($time >= $unitSeconds) { $numUnits = floor($time / $unitSeconds); return $numUnits . ' ' . $unitName . ($numUnits > 1 ? 's' : '') . ' ago'; } } return 'Just now'; } function doesUserOwnAsset($id, $userId = null){ global $pdo; $stmt = $pdo->prepare("SELECT userId FROM inventory WHERE userId = ? and assetId = ?"); $stmt->bindParam(1, $userId, PDO::PARAM_INT); $stmt->bindParam(2, $id, PDO::PARAM_INT); $stmt->execute(); if ($stmt->rowCount() >= 1){ return true; }else{ return false; } } if(getuserinfo($_COOKIE['_ROBLOSECURITY'])){ $ownership = boolval(doesUserOwnAsset($_GET["id"],getuserinfo($_COOKIE['_ROBLOSECURITY'])['UserId'])); } ?>