Jump to content

scootstah

Staff Alumni
  • Posts

    3,858
  • Joined

  • Last visited

  • Days Won

    29

Everything posted by scootstah

  1. So you have a table of persons and then a table for storing their gender? Can you post your database schema for all relevant tables using the output from this query: SHOW CREATE TABLE tablename. Change "tablename" to each of your tables.
  2. Your form controls need to be an array, instead of just a single value. You do that by using [] notation in the name. By the way, you are not using radio controls properly. All radio controls that are part of the same set need to have the same name, otherwise they just act like permanent checkboxes. Change your form to something like: <td><input type="radio" name="gender[<?php echo $row['id'] ?>]" value="male"> Male </td> <td><input type="radio" name="gender[<?php echo $row['id'] ?>]" value="female"> Female </td> <td><input type="radio" name="gender[<?php echo $row['id'] ?>]" value="transgender"> Transgender </td> <td><input type="radio" name="gender[<?php echo $row['id'] ?>]" value="gay"> Gay </td> <td><input type="radio" name="gender[<?php echo $row['id'] ?>]" value="lesbian"> Lesbian </td>Notice I have renamed "op" to "gender", because it makes more sense. Note also that I have changed the values to correspond to the way you're storing them. By the way, the way you're storing them is not very efficient, but I'll ignore that for now. Then to process it you'd do something like: if (!empty($_POST)) { $genders = $_POST['gender']; foreach ($genders as $id => $gender) { $sql = sprintf( "UPDATE table SET gender='%s' WHERE id=%s", mysqli_real_escape_string($gender), intval($id) ); mysqli_query($sql); } }Not the most efficient method, and does not handle error conditions, but that should get you started.
  3. Okay, this gives UTC +2. http://jsfiddle.net/6qc9crh3/ The reason it's not working for you is because you need to put the script just before the closing </body> tag. The timer element does not exist yet at the time the Javascript is executed.
  4. What URL is it trying to load? Look in the network tab on Chrome Developer Tools.
  5. Not to mention that because Git is decentralized, you basically get a free code backup every time you push to a remote repo. And, it's pretty damn hard to do something to your repo that causes you to lose work. Git has saved my ass on several occasions. In this day and age, if you are still using FTP to deploy a site, you're doing it wrong! Also, if you're going to use Git, I highly recommend that you start learning by only using the command line. Don't touch GUI stuff. GUI tools are great for making simple commits, and making simple pushes. Sometimes merging is smooth, depending on the tool. But, when you need to do something complicated, or when something bad happens, they just get in the way or simply can't handle it - in my experience anyway. You can use GUI tools later once you are comfortable with the command line, just to make it easy on yourself. This is what I do, I use PHPStorm's Git integration tools for most things these days. The diff viewer and merger is really nice.
  6. Returning a 404 in the case that a resource does not exist is perfectly valid. If $_GET['f'] acts as a resource identifier, then a 404 in this case is fine. But from a UX point of view I agree that a message is better.
  7. It counts down but it is a completely wrong time. Your countdown logic is fundamentally flawed. What is it even counting down to? And why is it starting with the current system time? https://jsfiddle.net/huj30t4f/ This demo takes the current system date and counts down to 0:00 using correct UTC time.
  8. Performance has nothing to do with it. Having a new line character or not is going to make exactly zero difference on execution times. You either have a \n or a \r\n character.
  9. Yes, unquestionably. Once you start using version control you'll never want to work without it ever again. It's far too much headache to try to remember what you changed, when you changed it, why you changed it, and how to unchange it when something unexpected breaks. It is silly to work that way. Even for personal projects where you are the only developer, version control is still an indispensable tool.
  10. You should be storing a pointer to the file in your database, and then you can just run unlink. You can use glob to display/search through files in a directory.
  11. Sure, those are all good ideas. MIME type cannot be faked, though it is possible to embed code inside of an otherwise valid file. This can't really do anything by itself, and is only nasty when whatever is using the file executes that code.
  12. You need to check the MIME type, not the file extension. The file extension is just a meaningless part of the file name. You can check the MIME type with PHP's Fileinfo class.
  13. It sounds like he wants to be able to store a username/password to later send to other remote servers. There is going to be an inherent risk in what you want to do. Your only real option is to use encryption, since you'll need to retrieve the password again. Hopefully you fully disclose to your users that you are storing their credentials. Unfortunately this is one of those things that if you have to ask, you're not qualified to implement it safely.
  14. What was wrong with requinix's one liner? Isn't that what you wanted to do?
  15. To spread malware or gather user information.
  16. Yeah, that's why I said that extra logic was causing an incorrect time. Remove this: if (h >= 24) { h -= 24; } h = (23 - h); m = (59 - m);
  17. Replace var m = (d.getMinutes()); var h = (d.getHours());Withvar m = (d.getUTCMinutes()); var h = (d.getUTCHours());
  18. Yeah, private repo if you're worried. You can always invite an employer to view it.
  19. You can use getUTCMinutes() and getUTCHours() to ignore local time settings. What is the purpose of this logic? Because it produces incorrect time: if (h >= 24) { h -= 24; } h = (23 - h); m = (59 - m);
  20. Can you post some code please?
  21. So what is the problem you're having?
  22. Don't do that. That is an XSS exploit waiting to happen. See here: http://forums.phpfreaks.com/topic/294115-json-encode-is-not-a-security-feature-or-how-to-pass-php-values-to-javascript/
  23. The first question is, why do you want to do that? What's wrong with leaving HTTPS on for that folder? If you put your directory-excluding rewrite before the other one, with [L] flag, then it should not execute further rewrites if that one matches.
  24. str_replace preg_replace
  25. You had it backwards. RewriteRule ^galeria/a1/([^-]*)$ galeria/a1_files/vlb_images1/$1 [L,NC]
×
×
  • 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.