Jump to content

scootstah

Staff Alumni
  • Posts

    3,858
  • Joined

  • Last visited

  • Days Won

    29

Everything posted by scootstah

  1. The problem is here: @move_uploaded_file($_FILES["file"]["tmp_name"], $target . $filename); $file_location = $target . $filename; if(file_exists($file_location)){ echo "Uploaded to <a href='$file_location'>$filename</a> <br />"; } else { echo "There was a problem saving the file. <br />"; } Having the "if file_exists" bit after move_uploaded_file is entirely pointless, because the operation already happened. Regardless, even though you get this "error", it should still have overwritten the file. You need to remove the "if file_exists" block if you want to overwrite files with existing name.
  2. move_uploaded_file will overwrite existing files.
  3. Haha, I like that one. lol yeah, I've been with my girlfriend for just over a year so I've been familiar with that one for a while. Well, sucks to be you I guess. EDIT: lolz, no pun intended
  4. Haha, I like that one.
  5. What do you mean?
  6. Well played, Andy-H.
  7. I think you should check out this article on storing hierarchical data.
  8. The only thing is, is that you are essentially re-creating register globals. Which means you still suffer all of the problems from register globals. I realize (and hope) you are only doing this sort of thing with the $_SESSION array, but I feel it could still lead to unexpected bugs which may threaten the security of your application. It is a band-aid for outdated code, nothing more. The correct thing to do is go through the entire code base and update it as such that it no longer relies on register globals.
  9. So why not use recaptcha then?
  10. Instead of this: //to get all session variables foreach ($_SESSION as $key => $value) { $value=stripslashes(trim($value)); $$key=$value; } You can just do: extract($_SESSION);
  11. This is very easily accomplished with jQuery's Dialog widget.
  12. htmlspecialchars() will let you view the HTML as plaintext, and strip_tags() will remove them completely.
  13. There's a couple problems with using the ternary operator in this case. The first is that, it is sort of ugly when using an else-if. The second is that you have to set a value for when the condition fails. So you would have to do something like $var = condition1 ? 0 : condition2 ? 1 : someothervalue and then you would have to make sure it is one of the two values...which sort of defeats the purpose. Now, you could instead first check if print_change is set, and then use a ternary...which would be a lot cleaner. Something like: if (isset($_POST['print_change'])) { $reg_hardcopied = $_POST['print_change'] == 'no' ? 0 : 1; $query_print = "UPDATE tbl_registration SET reg_hardcopied = '$reg_hardcopied' WHERE reg_id = '$id_printed'"; mysql_query($query_print); }
  14. You could append the words to $output. foreach ($word as $words){ $output .= $words->text; }
  15. Remove the "&" before "new".
  16. I can't answer your question because I've never used that site, but I would like to add that the Regular Expressions Tester Firefox add-on is pretty awesome for that.
  17. serialize isn't going to magically validate it for you. In fact, serialize isn't going to validate anything at all. You need to do that before you begin to think about how to store it.
  18. foreach ($order as $index) { if ($middle[$index]['hide'] != 0) echo '<br>'.$middle[$index]['section']; } Something like that?
  19. Haha. If only Linux had better support for more mainstream Windows stuff.
  20. Because you're essentially saying "if this and this, OR this". See if this fixes it: elseif(($type == 2 && acc_status(getUsername()) > 1) && (!isset($_POST['title']) || !isset($_POST['content']))) This is saying "if this and this, AND this or this".
  21. I don't want my PC to look like my cell phone.
  22. Disregard the pattern in my first post, this one will work a lot better: $str = '<b><font color=green>Get me out please </font></b><a><font color=green>Get me out please </font></a>'; $pattern = '/<font.*?>(.*?)<\/font>/i'; if (preg_match_all($pattern, $str, $matches)) { print_r($matches[1]); /* Array ( [0] => Get me out please [1] => Get me out please ) */ } Using preg_match_all will grab values in multiple font tags.
  23. But what if a several users have hundreds of friends, and they all update at the same time? Now you are running 1000+ queries. I think this post on SO is what you want.
  24. That's not how IN works. IN will update every row where the row is "in" the IN clause. There's a thread on the front page with the same question. http://www.phpfreaks.com/forums/index.php?topic=355124.0
×
×
  • 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.