Jump to content

pleek

Members
  • Posts

    135
  • Joined

  • Last visited

Everything posted by pleek

  1. sry and thank you webster, that is exactly what i needed. thanks for the help!
  2. um that pretty much does the same thing. What im talking about is like a input form. you type in your name and then click "change text" and the text changes to what you typed in.
  3. ok i found this code <script type="text/javascript"> function changeText(){ document.getElementById('boldStuff').innerHTML = 'Fred Flinstone'; } </script> <p>Welcome to the site <b id='boldStuff'>dude</b> </p> <input type='button' onclick='changeText()' value='Change Text'/> Now my question is how can i change that so i can input what i want the id "boldStuff" to say? I want to be able to enter in say my name, click "Change Text" and it change dude to my name. Thanks in advanced.
  4. ok so ive been searching the internet for almost an hour and i can't find anything. All i want is a paypal donation form that gets the users email, name, and how much they want to donate. Then it checks them out at paypal. Anybody know how to do this, or a site that has a tutorial on how to?
  5. yeah!!! that fixed it, thanks a lot man.
  6. ok so i have this function in my forum function hiliteItem($item) { $action = $_REQUEST['action']; $active = ' class="active_menu"'; if (strtolower($item) == strtolower($action)) { return $active; } elseif (strtolower($item) == "home" && $action == "") { return $active; } what it does is highlight the correct tab (the one currently being used). But sense the homepage is just index.php there is no "action" for it go get. This makes it spit out errors galore saying that "action" is undefined. Can this be edited so that if the "action" == "" it doesn't make an error? again this only a cures when the url is "index.php"
  7. your script works, thanks for pointing out my error.
  8. ah, ok. i have to go right now but ill try that tomorrow and check. Thanks a lot man!
  9. ok so i have a working html script that changes the action of the form on the page. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD> <TITLE>Untitled</TITLE> <META NAME="GENERATOR" CONTENT="MAX's HTML Beauty++ 2004"> </HEAD> <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript"> function changeAction() { document.myform.action = "upload.php?FN=3DWORLD"; } </SCRIPT> <BODY> <A HREF="javascript:changeAction()">change the action</A> <form name="myform" action="uploader.php" method="POST" enctype="multipart/form-data"> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" NAME="change" value="Upload File"> </form> </BODY> </HTML> But when i expanded it and changed to php it doesn't work anymore. Any clue y? I have looked over the script at least 15 times and i can't find anything wrong. <?php echo' <HTML> <HEAD> <TITLE>Form</TITLE> <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript"> function DWORLD() { document.myform.action = "uploader.php?FN=3DWORLD"; } function 10yard() { document.myform.action = "uploader.php?FN=10yard"; } function 1942() { document.myform.action = "uploader.php?FN=1942"; } function 1943() { document.myform.action = "uploader.php?FN=1943"; } function 720() { document.myform.action = "uploader.php?FN=720"; } function 8eyes() { document.myform.action = "uploader.php?FN=8eyes"; } </SCRIPT> </HEAD> <BODY> <TABLE> <TR> <TD>'; if (file_exists('Games/10yard.NES')) { echo ''; }else{ echo '<A HREF="javascript:10yard()">10-Yard Fight</A><BR>'; } if (file_exists('Games/1942.NES')) { echo ''; }else{ echo '<A HREF="javascript:1942()">1942</A><BR>'; } if (file_exists('Games/1943.NES')) { echo ''; }else{ echo '<A HREF="javascript:1943()">1943</A><BR>'; } if (file_exists('Games/3DWORLD.NES')) { echo ''; }else{ echo '<A HREF="javascript:DWORLD()">3-D WorldRunner</A><BR>'; } if (file_exists('Games/720.NES')) { echo ''; }else{ echo '<A HREF="javascript:720()">720°</A><BR>'; } if (file_exists('Games/8eyes.NES')) { echo ''; }else{ echo '<A HREF="javascript:8eyes()">8 Eye\'s</A><BR>'; } echo' </TD> <TD> <form name="myform" action="uploader.php" method="POST" enctype="multipart/form-data"> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" NAME="change" value="Upload File"> </form> </TD> </TR> </TABLE> </BODY> </HTML>'; ?>
  10. now that you explained that both checks are working. thanks a lot guys!!!!! <?php $target_path = "Games/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); $file = "3DWORLD.NES"; if($_FILES['uploadedfile']['name'] == $file) { echo'the files are the same<BR>'; } if ($_FILES['uploadedfile']['type'] == "application/octet-stream") { echo "the file is a .NES<BR>"; } if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } ?>
  11. ahhhh, ok thank you very much. I really appreciate you being pacient with me. I think i now have it figure out and i will post what i come up with or if i have any more problems. Thank you again.
  12. i understand how to use var but i don't know how to check it with the file that is being uploaded. $filename = game.nes $filecheck = THE UPLOADED FILE NAME WITH EXTENSION if ( $filecheck != $filename) { echo' Only .nes games can be uploaded'; } what i don't know is how to get the name and extension of the file that is being uploaded to set it to $filecheck. Now do you get where im stuck? and by "in the manual" do you mean the $_file link post earlier? cause when i tried $_FILES['userfile']['type'] i was told i was doing something wrong and not setting the var correctly.
  13. so can you give me a working example? Im having a problem following what you guys are telling me. I understand what your telling me and how its supposed to work. But i can't figure out the code. thanks for the help.
  14. Does the filename have to br a specific game? I am confused. The code I posted above will verify that the extension is .nes no matter the case. Is that not what you wanted? As far as verifying that the file is a true .nes and not just some text file I uploaded, you can check that octet stream, but yea. I am not sure how you would go about verifying that. To that, no the the filename does not have to be a specific game. I added your code to my script and it didn't work. Current code... <?php $target = "Games/"; $target = $target . basename( $_FILES['uploaded']['name']) ; //This is our limit file type condition if (!preg_match("/.*\.nes$/i", $type)) { echo "Only .NES files are allowed.<br>"; echo "<pre>"; print_r($_FILES); } //If everything is ok we try to upload it else { if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else { echo "Sorry, there was a problem uploading your file."; } } ?> Um. ok then what should i check? I was going by what was posted earlier about $_file that linked me to http://us3.php.net/features.file-upload
  15. i tried the code you posted and i get the same results Only .NES files are allowed. Array ( [uploadedfile] => Array ( [name] => 3DWORLD.NES [type] => application/octet-stream [tmp_name] => /tmp/php7s7TE1 [error] => 0 [size] => 262160 ) ) and as for "Why not just check the filename?" that would be fine as long as i can check the file name and extension. so like "if file = game.nes"
  16. thank you for that, and your first post correctly told me the type Array ( [uploadedfile] => Array ( [name] => 3DWORLD.NES [type] => application/octet-stream [tmp_name] => /tmp/phpyQzpdv [error] => 0 [size] => 262160 ) ) so i changed my code to <?php $target = "Games/"; $target = $target . basename( $_FILES['uploaded']['name']) ; //This is our limit file type condition if ($_FILES['userfile']['type'] != "application/octet-stream") { echo "Only .NES files are allowed.<br>"; echo "<pre>"; print_r($_FILES); } //If everything is ok we try to upload it else { if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else { echo "Sorry, there was a problem uploading your file."; } } ?> but it still doesn't work. Any other suggestions?
  17. ok, i think that means try it. lol, i did and it didn't work. here's my upload script. <?php $target = "Games/"; $target = $target . basename( $_FILES['uploaded']['name']) ; //This is our limit file type condition if ($uploaded_type != "application/x-nes-rom") { echo "Only .NES files are allowed.<br>"; } //If everything is ok we try to upload it else { if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else { echo "Sorry, there was a problem uploading your file."; } } ?> now what....
  18. so according to the first reply the correct $uploaded_type is "application/x-snes-rom" correct? so for a NES it would be "application/x-nes-rom" right?
  19. ok quick question, does anybody know what a rom that is .nes would be as an upload type? i tried application/nes but that didn't work.
  20. grrr. all i need is a secure form that will only upload the specified file size and extension. please somebody help me!!!!!!! lol but i do need help.
  21. ok, so i check out the swfupload and it was pretty cool. But not really what i need. So i did a little more google searching and i found this php code which does allow you to check the files extension before uploading. I can modify this to work but i need to know is it secure enough for an admin section in my script? form.php <form action="upload.php" method="post" ENCTYPE="multipart/form-data"> File: <input type="file" name="file" size="30"> <input type="submit" value="Upload!"> </form> upload.php <?php // ============== // Configuration // ============== $uploaddir = "uploads"; // Where you want the files to upload to - Important: Make sure this folders permissions is 0777! $allowed_ext = "jpg, gif, png, pdf"; // These are the allowed extensions of the files that are uploaded $max_size = "50000"; // 50000 is the same as 50kb $max_height = "100"; // This is in pixels - Leave this field empty if you don't want to upload images $max_width = "100"; // This is in pixels - Leave this field empty if you don't want to upload images // Check Entension $extension = pathinfo($_FILES['file']['name']); $extension = $extension[extension]; $allowed_paths = explode(", ", $allowed_ext); for($i = 0; $i < count($allowed_paths); $i++) { if ($allowed_paths[$i] == "$extension") { $ok = "1"; } } // Check File Size if ($ok == "1") { if($_FILES['file']['size'] > $max_size) { print "File size is too big!"; exit; } // Check Height & Width if ($max_width && $max_height) { list($width, $height, $type, $w) = getimagesize($_FILES['file']['tmp_name']); if($width > $max_width || $height > $max_height) { print "File height and/or width are too big!"; exit; } } // The Upload Part if(is_uploaded_file($_FILES['file']['tmp_name'])) { move_uploaded_file($_FILES['file']['tmp_name'],$uploaddir.'/'.$_FILES['file']['name']); } print "Your file has been uploaded successfully! Yay!"; } else { print "Incorrect file extension!"; } ?>
  22. ok, thanks for that site man. Im trying out that right now. Ill get back to you if i have any more problems. thanks!
  23. to the first question, no it does not have to be exe. but i would like to be able to set which extentions are allowed. to the second post, yes i know. thats what one thing i need help with.
  24. ok sorry, here is the code im currently using. Just a generic code that works to upload any file up to 100kb to the "game" dir. Yes i know its not very safe but its only open to me right now. upload form <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="1000000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> upload.php <?php $target_path = "Games/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } ?> And if you need javascript to do this that would be fine. This is what i need, i am using games as a generic term for what we're uploading... 1. First you select the name of the game you want to upload - i select "bike_game" as my game. 2. Then the upload form appears (optional). 3. Then when you select browse you can only select/upload so i would only be able to upload "bike_game.exe"\ if you still have questions please ask.
  25. Hello, i am designing a website for my own personal use but im having trouble with upload forms. I found out how to upload the a directory on my site but heres the problem. I need a form that when you select (from a drop down box) the name of the file to be uploaded, when you browes it will only let you upload the file with the exact name and extenction. So like if i want to upload only .jpg's and i select "game" from the menu. The form will only allow "game.jpg" to be uploaded. Thanks in advance, Pleek
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.