Jump to content

davidannis

Members
  • Posts

    627
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by davidannis

  1. I don't think so. HTTP is stateless and you need to store the order someplace. The only other solution I can think of is to use an old pseudo random number generator that does not automatically seed and creates the same sequence if given the same seed and then have the teacher distribute the seed to the students. Hardly seems worth it to me, easier just to store the sequence. Also, storing it allows the teacher to have a copy of the questions in the correct order when reviewing it with students, etc. even if she reused the test.
  2. You should mark the issue solved - there will be a button on Ch0cu3r's post that says "mark sloved" and maybe hit Like on the posts of those who have helped you.
  3. It is possible that the data is in a database. So, if for example we are displaying a product page the rwo in the database for the product might have fields like this: Product_name: Flying pig. Price: 9.99 Product_desc: A pig with wings. meta_desc: The only place to buy this. Not yet available. Will become available when pigs fly. keywords: OMG, Way Cool, pig, pork, feathers You first read the db, then render the page.
  4. I think that type="int" is not valid for html. Also, if you have multiple elements in the same form it will only use the last one unless you make them an array <input name="myvarname[]"> (notice the square brackets).
  5. If it were my server I think I'd hire a service to scan. http://sucuri.net/signup https://www.sitelock.com/website-scanning.php http://www.qualys.com/enterprises/qualysguard/web-application-scanning/ there's also 6scan.com Not endorsing any of these. They are just examples.
  6. Sorry, I omitted the source on that last quote. You can find it at http://msdn.microsoft.com/en-us/magazine/dd188562.aspx
  7. Jacques, I know that I said I wouldn't continue to argue but one final post. Eliminating http round trips is not "micro-optimization" to squeeze out "the last bit of performance" If you read the quote I posted earlier (emphasis added): This is so important for a simple reason -- latency once you are off the local machine and onto the network is 6 or 7 orders of magnitude higher than it is on the server. (see http://www.slideshare.net/guest22d4179/latency-trumps-all and http://www.slideshare.net/guest22d4179/latency-trumps-all ) You state that Well, writing proper code, includes writing code that is optimized for the real world, a world in which operations that require data to leave your datacenter have a much higher latency than operations that do not. Furthermore, in most web applications you can't just "then check the performance" because you don't know in advance where all your users will be or the route that packets will take to get there. Finally, you are not "saving a single roundtrip" Here's another credible source that explains how it works (emphasis added) So, trying to minimize the "most significant contributing factor in long page load times" is IMHO "writing proper code" not "micro-optimization" that you deal with only after you deploy the application and only if your users have problems that you become aware of. Google, Microsoft, and Yahoo seem to agree with me.
  8. Jacques, I'm not going to argue with you. Perhaps I (and Google's best practices and many other sources I've read) are wrong. Perhaps paddy-fields users are all on his 100GBps local area network a single hop from the server. I will, however, point out to you that comments like: and serve only to personalize a disagreement and that it might be more productive not to do that.
  9. The message that the OP was trying to suppress when the back button was hit is designed to prevent people from accidentally submitting the same data again. If resubmission of the same data is a serious problem there are better ways to avoid it than using extra redirects (such as a nonce).
  10. From Google developer best practices https://developers.google.com/speed/docs/best-practices/rtt?hl=fr-FR which was updated less than two years ago.
  11. I am not sure why you want to allow the back button on a form. There are a couple of possible reasons that I can think of: 1) to allow the user to start again or 2) to allow the user to correct a mistake. However, in case (1) you can provide an button to clear /reset <input type="reset"> and in the event of an error (2) you can redisplay the form with values prefilled based on the submitted data: <?php $myfield = $_POST['myfield'] //validate data if ($myfield!=$myexpectedvalue){ $errors['myfield']='I expected something else'; } //don't forget to sanitize data even though I don't in this example if (!isset($errors)){ // write to db or whatever here //display success message and optionally go on to next step }else{ //redisplay form ?> .... <?php if (isset($errors['myfield']) {echo $errors['myfield'] ;}?><input name="myfield" value="<?php if (isset($myfield) echo $myfield;?>"> <input type="reset'> .... My objection to the redirects is that you pay a high price in performance for every user because each header() requires a round trip from server to browser to save someone from seeing a dialogue box in the rare instance that they hit the back button.
  12. I second ginerjm. It allows me to clear a lot of session data at once without removing all of the session data. For example, on a language learning site I structure $_SESSION as a multi-dimensional array. I have some things like login data that I don't want cleared but I want to clear data on the deck of flashcards that the user is working on. unset ($_SESSION['card_deck']); clears all the data on the flashcards while leaving everything else alone.
  13. I use it to quickly clear part of an array. For example, if I have $myarray['category']['subcategory']['itemtype']['item'] I can unset($myarray['Honda']['Accord']);
  14. I have not had experience with PHPWord but have had a great deal of success using OpenTBS to produce word docs.
  15. People don't want to code for you. If you make an attempt and have specific problems they will help. While not every question I have asked has been answered, I've received a great deal of assistance here.
  16. Sorry, I missed the manual creation. I believe that whether manually created or in a database, for the OPs purpose there needs to be an other box with the ability to put in freeform text if the box is checked. There is no way to compile a complete list of skills and keep it up to date.
  17. Gingerjm gave you an excellent strart. I think that you will should store a default set of the skills in a database (you could hardcode them in the form but I would recommend against that) and produce the initial checkboxes from your list rather than from POST data. You'll still need a text input because you can't possibly anticipate everything.
  18. Perhaps I am missing something but you deal with two cases if USER_IS_LOGGED_IN is defined and if USER_IS_NOT _LOGGED_IN is defined. There is a third case, neither is defined - I would guess either that this is the first page request for a non-logged in user or that an error occurred. When I code for logins, I just check for LOGGED_IN and if not treat the user as not logged in.
  19. Please sanitize your data using mysqli_real_escape_string before sending it to the database: $value = $_POST['Name']; should be: $value = mysqli_real_escape_string ( $link , $_POST['Name'] ); where link is the link to your DB. Same for all the variables you write to your database. Not doing so leaves your site wide open to attacks by hackers.
  20. If you allow anonymous comments make sure that you don't allow links or you'll be overrun with postings by bots and spammers.
  21. I doubt I would do it that way, instead I would have a table with three columns: item, value, and language: Item Value Language title Greetings en title あいさつ jp description A Page about greetings en description なにか jp That allows you to just change the select by adding WHERE language='xx' and leave all other logic the same and allows you to easily add a third language.
  22. Take a look at these: http://www.phpshare.org/articles/Piping-Incoming-Mail-with-PHP http://www.phpclasses.org/blog/package/2/post/1-Process-incoming-email-messages-using-PHP.html
  23. Depends on the Operating System that you are using. You can code from scratch (just listen on the SMTP ports) but I have seen programs that allow unix mail to receive the email and just monitor the directories where the mail is kept to process the messages received. I'm sure there are a million ways to accomplish the task and the best way probably depends on the volume, how critical that you be up, what OS you use, how portable you want the code to be, etc.
  24. Yes, I am using PhpMyAdmin to change the databases. On this particular project there is no personal data to speak of so that wouldn't be an issue. Writing scripts would be less convenient than using PHPMyAdmin but perhaps that is the solution.
×
×
  • 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.