Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Someone
Sunday, June 17th, 2007 at 4:32:04am MDT 

  1. <?
  2. if($logged[username]){
  3.  
  4.  if(!$_POST['upload']){ ?>
  5. <form method="post" enctype="multipart/form-data">
  6.   Title:
  7.   <input name="title" type="text" id="title" size="25" maxlength="50">
  8.   <br />
  9.   Description:
  10.   <textarea name="description" cols="25" rows="3"></textarea>
  11.   <br>
  12.   Flash
  13.   :
  14.    <input type="file" name="data">
  15.    <br />
  16.    Has a thumbnail:
  17.    <input type="checkbox" name="thumbnail" value="checkbox" />
  18.    <br />
  19.    Thumbnail*
  20.    <input name="thumb" type="file" id="thumb" />
  21.    <br />
  22.    Width:
  23.    <input name="width" type="text" id="width" size="5" />
  24.    <br />
  25.    Height:
  26.    <input name="height" type="text" id="height" size="5" />
  27.    <br />
  28.    <input type="submit" name="upload" value="Upload File">
  29. * Thumbnail must be 50x50
  30. </form>  
  31. <? }
  32. if($_POST['upload']){
  33. $title = safe($_POST['title']);
  34. $author = $logged[username];
  35. $text = safe($_POST['description']);
  36. $checkbox = $_POST['thumbnail'];
  37. $width =safe($_POST['width']);
  38. $height =safe($_POST['height']);
  39. if($width == NULL)
  40. {
  41. die('Please go back and fill out the Width  of your flash');
  42. }
  43. if($height == NULL)
  44. {
  45. die('Please go back and fill out the height  of your flash');
  46. }
  47. if($checkbox== "checkbox"){
  48. $checkbox= "yes";
  49. }
  50. else{
  51. $checkbox= "no";
  52.  
  53. }
  54. if (!isset($_FILES['data']['name']) || $_FILES['data']['name'] == '' ) {
  55. die('No input file specified. Please go back and select a file to upload.');
  56. }
  57. if ($text ==NULL) {
  58. die(' Please go back and enter a description.');
  59. }
  60. $max_filesize = 5242880;
  61. $filetype = 'application/x-shockwave-flash';
  62. $upload_path = '/flash/';
  63. if ( !is_dir ($_SERVER['DOCUMENT_ROOT'] . $upload_path) ) {
  64. exit ( 'Directory '.$upload_path.' does not exist!' );
  65. }
  66.  
  67. if ($_FILES['data']['size'] > $max_filesize) {
  68. die('Your filesize is too large. Please make your filesize smaller than 5 Megabytes.');
  69. }
  70.  
  71. if ($_FILES['data']['type'] != $filetype) {
  72. die('Sorry, your file was not of the ' . $filetype . ' mimetype (yours was ' . $_FILES['data']['type'] . ').');
  73. }
  74.  
  75. $size = $_FILES['data']['size'];
  76.  
  77. $copy_to = $_SERVER['DOCUMENT_ROOT'] . $upload_path . $_FILES['data']['name'];
  78. $copy_over = $_SERVER['DOCUMENT_ROOT'] . $upload_path . $_FILES['thumb']['name'];
  79. $link = $upload_path . $_FILES['data']['name'];
  80. $image = $upload_path . $_FILES['thumb']['name'];
  81.  
  82.  
  83. $upload = move_uploaded_file($_FILES['data']['tmp_name'], $copy_to);
  84. $upload = move_uploaded_file($_FILES['thumb']['tmp_name'], $copy_over);
  85.  
  86. $sql = "INSERT INTO TABLE (title, author, text, size, link, image, box, w, h) VALUES ('$title', '$author', '$text', '$size', '$link', '$image', '$checkbox', '$width', '$height' )";
  87.  
  88. $upload = mysql_query($sql)
  89. or die(mysql_error());
  90.  
  91. $flash = mysql_fetch_array(mysql_query("SELECT * FROM TABLE WHERE username='$author'"));
  92. $flash = $flash['flashes'];
  93. $newflash = ($flash + 1);
  94. $update = mysql_query("UPDATE TABLE SET flashes=$newflash WHERE username='$author'");
  95.  
  96.  
  97. if (!$upload) {
  98. die('Sorry, your file could not be uploaded.');
  99. }else{ echo " Congradulations, Your flash has been uploaded";
  100. }
  101. }}else{
  102. echo" You Must Be Logged In To Upload";}
  103.  ?>

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

worth-right
worth-right