Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 22nd, 2011, 2:35 PM   #1
MikeyS9607
Newbie
 
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:


<?php

   // 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.
   if(!in_array($ext,$allowed_filetypes))
      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.
   if(!is_writable($upload_path))
      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.

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

<?php 
$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?

http://www.mikeys9607.com/games.php
MikeyS9607 is offline   Reply With Quote
Reply

Bookmarks

« 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 5:28 AM
Do u know PHP Programming is Most Used Programming Language annaawills PHP 16 Aug 8th, 2010 6:26 PM
Using Flash and PHP also creating insite Search scrubbicus PHP 1 Feb 9th, 2009 2:32 PM
Php Tutorial 3 bulio PHP 4 Jul 16th, 2006 4:00 AM




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

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