Jump to content

davej

Moderator
  • Posts

    3,988
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by davej

  1. Frames are obsolete. You should try to stop using them in any new designs. You can use iframes. http://www.w3schools.com/tags/tag_iframe.asp
  2. davej

    Handling file uploads

    I see the problem. Your code has $FILES rather than $_FILES. But also the uploads directory must exist, as I mentioned above.
  3. Somebody in the Php world must feel there is a security issue since Php provides filter_input() and filter_has_var(). Netbeans seems to get the blame for providing a warning about this, but Netbeans didn't write those Php functions. Based on some postings such as https://www.phparch.com/2010/07/never-use-_get-again/ (which is an old article dated way back in 2010) it seems that the basic idea is that this approach is intended to prevent any occasional, accidental, lack of sanitizing. Has this idea died and if so, did it die for a good reason?
  4. Yeah, I don't understand it. Are they saying an evil script could be inserted inside a conditional...? if ( evil_script() ){ }
  5. So am I to understand that rather than using... if ($_SERVER['REQUEST_METHOD'] == 'POST'){ } ...or... if(isset($_POST['submit')){ } ...I am supposed to instead use... $in = filter_input(INPUT_SERVER,'REQUEST_METHOD',FILTER_SANITIZE_STRING); if ($in == "POST") { } ...and... $in = filter_has_var(INPUT_POST, 'submit'); if($in == TRUE)) { } ???
  6. davej

    Handling file uploads

    I'm beginning to suspect that Php is written by mentally ill people. That MAX_FILE_SIZE suggestion is straight from their recommended approach here... http://php.net/manual/en/features.file-upload.post-method.php ...where they then say... No it isn't a "convenience feature" -- it is "a stupid suggestion."
  7. davej

    Handling file uploads

    What if ../uploads does not exist? --update edit-- Yes, this would definitely cause a failure. $target_dir = "../uploads/"; if (!file_exists($target_dir)){ mkdir($target_dir); } if (move_uploaded_file($FILES['the_file']['tmp_name'],"{$target_dir}{$_FILES['the_file']['name']}")) {
  8. davej

    Handling file uploads

    It seems silly to me to have a hidden input specify MAX_FILE_SIZE. You should put enforced limits and validation in your Php code where they will be safe from any possibility of external manipulation. I see you do have a php.ini limit. Where do you test the file type?
  9. There are various plugins available. https://wordpress.org/plugins/search.php?q=job You might need to inquire on a WordPress-specific forum for advice. https://wordpress.org/support/
  10. That is a very inflexible scheme. You could have a table containing just symbol, date-time, and price.
  11. If you have two html files in the same folder then the name of the files is all you need. <a href="otherfile.html">Jump to other file</a>
  12. Comment out your Php and then use the validator. There are various HTML errors. https://validator.w3.org/
  13. Seems to me that you need to simplify this question. See... http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_ajax_ajax Are you saying that "result" isn't a variable? http://www.w3schools.com/jquery/ajax_ajax.asp
  14. I still don't understand. Where is the rest of the code? What code are you are basing this on?
  15. I don't understand this at all. Are you working from an example somewhere? See... https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Basic_animations
  16. Reddish purple? Anyway a real web-design expert would take those background patterns into Photoshop or a similar graphics editor and edit them so that a much smaller image could be used. In other words the pattern would be altered so that it would repeat cleanly both horizontally and vertically.
  17. They need to be stored on an 8-inch floppy disk. http://www.cnn.com/2016/05/26/us/pentagon-floppy-disks-nuclear/ --updated with link--
  18. The style block should be in the head, and you have a lot of styling that seems irrelevant to your html content. In fact you use a lot of line breaks in your paragraph that should not be needed if you styled it appropriately. Maybe you should apply some margins to the paragraph? A good way to test your code is to open it directly with several browsers. You could take a look at the css tutorial. http://www.w3schools.com/css/default.asp And remember to use the validator. https://validator.w3.org/#validate_by_input
  19. I'm sure you can find many sets of card images if you search the web. You deleted the joker. See the revised code above.
  20. Here is a basic text example of a random card draw... <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Cards</title> <script> window.onload = init; function init(){ document.getElementById('btn1').onclick = drawc; document.getElementById('btn2').onclick = shuffle; } var str = ""; var cards = ['Ace','Two','Three','Four','Five','Six','Seven','Eight','Nine','Ten','Jack','Queen','King']; var suit = ['Clubs','Diamonds','Hearts','Spades']; var cardcount = suit.length * cards.length; var facecount = cards.length; var i = 0; function drawc() { var n; var f; var c; if (i >= cardcount){ return; } do{ f = Math.floor(facecount * Math.random()); n = Math.floor(4 * Math.random()); c = cards[f] + ' of ' + suit[n]; }while(str.indexOf(c) != -1); i++; str = i + ' ' + c + '<br/>' + str; document.getElementById("out1").innerHTML = str; } function shuffle(){ document.getElementById("out1").innerHTML = ""; str = ""; i = 0; } </script> </head> <body> <p>Click the button to display a random card.</p> <button id="btn1">Draw Card</button> <button id="btn2">Shuffle Cards</button><br/><br/> <div id="out1"></div> </body> </html>
  21. Wouldn't it make more sense to put the image at the bottom of the div containing the unordered list? </ul> <!--ul class="nav navbar-nav navbar-right"> <!--li><a href="#"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li> <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li--> <!--img src="../images/uahLogo.png" class="img-rounded" --> <!--/ul--> <span class="uahImg pull-right"><img src="../images/uahLogo.png" height="100" alt="alt"></span> </div>
  22. Here is a version that gets rid of the absolute positioning everywhere except inside the buttons. <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="author" content="Captain James Purcell"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>The Diaries of James Purcell</title> <style> *{margin:0; padding:0;} p{margin:16px 0 10px 10px;} body{ background-image: url("image/01.jpg");/* purple pattern */ } .wrap{ background-image: url("image/Bluetablet.png");/* blue pattern with gold rings */ background-repeat: no-repeat; margin-left: 28px; margin-top: 20px; padding-bottom: 100px; overflow: auto; } .content{ background-image: url("image/content.png"); /* gray page */ background-repeat: no-repeat; width: 700px; margin-left: 15px; margin-top: 160px; padding-bottom: 6px; overflow: auto; } .Button1,.Button1:link,.Button1:visited,.Button2,.Button2:link,.Button2:visited{ background-image:url('image/wp023622a1_06.png'); /* yellowed paper */ background-position:-7px -80px; height:38px; width:64px; /*border:1px solid #555;*/ margin-left:20px; display:block; float:left; cursor:pointer; position:relative; } .Button1 span,.Button2 span{ color:#3d3d3d; text-align:center; font-size:11px; font-family:Arial,sans-serif; font-weight:normal; text-decoration:none; text-transform:none; font-style:normal; position:absolute; /* this is absolute inside relative */ bottom:3px; left:0; right:0; } .Button2,.Button2:link,.Button2:visited{ background-position:-7px 0px; height:25px; width:64px; margin-left:10px; outline-style:none; } .Button2:hover{height:38px;background-position:-7px -80px;} .Button2:active{height:38px;background-position:-7px -80px;} .menu{margin:0 0 0 12px;} .firstp{clear:both;margin-top:46px;} </style> </head> <body> <div class="wrap"> <div class="content"> <div class="menu"> <a href="index.html" id="nav_1_B1" class="Button1"><span>Home</span></a> <a href="http://purbry.wordpress.com" id="nav_1_B2" class="Button2"><span>Blog</span></a> <a href="Books.html" id="nav_1_B3" class="Button2"><span>Books</span></a> <a href="Downloads.html" id="nav_1_B4" class="Button2"><span>Downloads</span></a> <a href="Links.html" id="nav_1_B5" class="Button2"><span>Links</span></a> <a href="Shop.html" id="nav_1_B6" class="Button2"><span>Shop</span></a> <a href="About.html" id="nav_1_B7" class="Button2"><span>About</span></a> </div> <p class="firstp">Welcome to The Diaries of James Purcell.</p> <p>The Diaries of James Purcell are a collection of works covering the life of James Purcell based on personal diaries and records starting in 1872.</p> <p>These records when written into something that those inexperience in his hand writing can read, will show both the highs and lows of his life and that of his friends.</p> </div> </div> </body> </html>
  23. My initial thought is: "...another absolute positioning mess." But then -- I am not a css guru.
×
×
  • Create New...