Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Making a games site


  • Please log in to reply
4 replies to this topic

#1 rajjaak24

rajjaak24

  • Members
  • 46 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:04:50 AM

Posted 20 October 2012 - 10:42 AM

Hi there I am currently making the base code for my games site(as a hobby) before it was so that I had to make each page for a game by hand which was time consuming. checkout what Ive done so far http://legit-gaming.x10.mx/games/
I'm using a flat login system as I don't intend to have the site turn into something huge, as there are thousands of games websites out there.

USERNAME: demo
Password: bleepingcomputer


read this after testing the site
Before if you clicked a link on the page it would just open the SWF file which is fine but boring. So now when you click a link it uses

fileviewer.php:
<?php

if(isset($_GET['c']) && isset($_GET['f']) && $_GET['c'] == md5('mysaltstring' . $_GET['f']) && file_exists(urldecode($_GET['f']))){
//the checks are passed
   $file = urldecode($_GET['f']); 
   $output = file_get_contents($file);
}

?> 

TEST HEADER
<body>
<h1>Hello World</h1>
<div id="fileoutput">
<?php
   echo $output;
?>
</div>
TEST FOOTER
</body>
</html>

This allows me to add graphics to the page but eliminating the need to make a separate GAMENAME.inc.php file (which is what I did for v2 of the site for 50 games...)

The SWF dimensions will be done with getimagesize() or a javascript code that I found again eliminating more manual labor. When I tried to echo the embed code I just kept getting "unexpected t_string expecting , or;" on line 17 which is where the embed code started. Any help? Thanks

EDIT:
Should I define $output as the embed code?

Edited by rajjaak24, 20 October 2012 - 10:44 AM.


BC AdBot (Login to Remove)

 


#2 Cydrobolt

Cydrobolt

  • Members
  • 19 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:11:50 PM

Posted 06 November 2012 - 02:05 PM

What I think you should do, is use a CMS (Wordpress, Drupal, Joomla, etc), and embed the SWFs in pages/posts.

#3 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:10:50 PM

Posted 06 November 2012 - 03:20 PM

You're in luck! Have a free, professional review of your code.

Never ever do this:

if(isset($_GET['c']) && isset($_GET['f']) && $_GET['c'] == md5('mysaltstring' . $_GET['f']) && file_exists(urldecode($_GET['f'])))

In two weeks when you come back to tweak your code, you will not remember what index 'c' or 'f' represent. You will remember
'fileName' and 'encodedPassword' represent. Therefore you will not have to hunt back through the code to figure out what they represent. You also know that if you dump out a variable called fileName, and it is a bunch of numbers, then something is wrong. It gives you a debugging point.

********

As far as your issue, there is nothing on line 17 of that code that in anyway would affect the embedding. The real problem is that 'get_file_contents' returns the file contents as a string. All you are going to get is a bunch of garbage if you try to echo it out. You could try doing a print_r(file_get_contents($file)), but I don't think that will work either. Media files are not meant to be treated as strings.

Using HTML5, you can do something like this to embed your swf:
http://englishblog.flepstudio.org/tutorials/flash-cs3/mix/embed-swf-into-html-5-pages-and-flashvars/

#4 rajjaak24

rajjaak24
  • Topic Starter

  • Members
  • 46 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:04:50 AM

Posted 17 November 2012 - 09:32 AM

Thanks for replying. I've decided to scrap the idea and go back to the drawing board.

#5 ronifinder

ronifinder

  • Members
  • 9 posts
  • OFFLINE
  •  
  • Local time:11:50 PM

Posted 19 November 2012 - 12:12 AM

Thanks to share this useful informative blog..now i want to do this...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users