Programming Forums
User Name Password Register

RSS Feed

Thread Tools Display Modes
Old Mar 22nd, 2011, 3:35 PM   #1
Join Date: Mar 2011
Posts: 1
Rep Power: 0 MikeyS9607 is on a distinguished road
Smile PHP View Flash

I have a lot of stuff done so far. I just want to know,
how can I make it so if you click on a link, php chooses an id given to the flash based on the fllashes name, both of which are in a MySQL table.

SWF's are given a random number as a file name when uploaded keep in mind. I want my system to be automatic so I don't have to upldate the page.

Please respond as soon as you can. Tell me if you need any more info.

Here's the page you get when you click the upload button:


   // Configuration - Your Options
      $allowed_filetypes = array('.swf'); // These will be the types of file that will pass the validation.
      $max_filesize = 10485760; // Maximum filesize in BYTES (currently 5MB).
      $upload_path = './files/'; // The place the files will be uploaded to (currently a 'files' directory).
   $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension).
   $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename.
   // Check if the filetype is allowed, if not DIE and inform the user.
      die('The file you attempted to upload is not allowed.');
   // Now check the filesize, if it is too large then DIE and inform the user.
   if(filesize($_FILES['userfile']['tmp_name']) > $max_filesize)
      die('The file you attempted to upload is too large.');
   // Check if we can upload to the specified path, if not DIE and inform the user.
      die('You cannot upload to the specified directory, please CHMOD it to 777.');
 // Find a random number that hasn't been used as a name yet, sequentials would take too long
$valid = FALSE;
while ($valid==FALSE) {
$rn = rand(10,100000);
if (!file_exists($upload_path . $rn . '.swf')) {
$valid = TRUE;
   // Upload the file to your specified path.
   if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $rn . '.swf'))
  echo 'Success! It can be seen <a href="' . $upload_path . $rn . '.swf' . '" title="Your File">here</a>'; // It worked.

         echo 'There was an error during the file upload.  Please try again.'; // It failed :(.

$flashname = $_POST["flashname"];
$email = $_POST["email"];
$firstname = $_POST["firstname"];
$description = $_POST["description"];
$largedes = $_POST["largedes"];
$audio = $_POST["audio"];

mysql_connect("localhost", "m552937_mikey", "$mypass") or die(mysql_error());
mysql_select_db("m552937_uploads") or die(mysql_error());
mysql_query("INSERT INTO info 
(flashname, email, firstname, description, largedes, audio, rn) VALUES('$flashname', '$email', '$firstname', '$description', '$largedes', '$audio', $rn) ") 
or die(mysql_error());  


Here is a link to my "games" page so far. Click Either "cheetahmen" or "cheetahmen 2" to see my best attempts at this. You'll notice that it shows the name of both games, Both Authors, Both Descriptions.
can you help me?
MikeyS9607 is offline   Reply With Quote


« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Some PHP Tips Paulette PHP 12 Jan 1st, 2014 6:28 AM
Do u know PHP Programming is Most Used Programming Language annaawills PHP 16 Aug 8th, 2010 7:26 PM
Using Flash and PHP also creating insite Search scrubbicus PHP 1 Feb 9th, 2009 3:32 PM
Php Tutorial 3 bulio PHP 4 Jul 16th, 2006 5:00 AM

DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:48 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC