Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. Have you taken a look at the part of the manual which covers it? http://php.net/file-upload
  2. Daniel0

    Login

    Yes. Doesn't that work?
  3. Or you could just use urlencode().
  4. <?php $array = array(); // ... if(!in_array($value, $array)) $array[] = $value; // ... $search = array_search($value, $array); if($search !== false) { unset($array[$search]); } ?>
  5. If the file links are stored in the DB then you could just change a column named is_downloaded or something like that. Sort of like flipping a switch.
  6. . means the current directory and .. means the parent directory.
  7. The server or the mod_php module can fail and serve .php files in plain text. I've seen that happen numerous times.
  8. It can be stored inside the document root, but for security reasons it's better to store it at a place which is not publicly accessible.
  9. You could use scandir() or the DirectoryIterator object in the SPL to find get the files in the folder. Whether you need to include them or not depends on how you've designed your code.
  10. Alternatively there is also mysql_list_tables().
  11. Store it in a session variable: $_SESSION['username'] = $_POST['username']; Remember to run session_start(); before that and before outputting anything.
  12. UPDATE songs SET hits = hits + 1 WHERE id = 5;
  13. <?php $filename = 'something.somethingElse.ext'; $without_extension = preg_replace('/\.[a-z0-9]+$/i', '', $filename); ?>
  14. I suppose so (at least in the code you provided), but it would make it less readable for you (after some time where you've forgotten what that specific code does) and for other people.
  15. Add an overflow. pre, code { overflow:auto; }
  16. If the problem is that it extends to the side (horizontally) then try to add a width as well.
  17. And what's the problem with that?
  18. No, we're not here to do the work for you.
  19. Try to take a look at the code I posted here. The code isn't tested as it was purely as an example that you didn't have to manually filter every single thing. Also, the code is for an INSERT, but it's sort of the same logic you need to apply and you need to add an additional $where argument.
  20. If you are afraid of filename collisions then just prepend it with the current timestamp (time()). Storing the filename would be just like storing any other data, just use an INSERT into a table called images or something.
  21. You can use CSS: tr.nth-child(odd) { background: #CCC; } tr.nth-child(even) { background: #FFF; } However, most browsers do not support that yet so you can use Javascript or PHP to do it yourself. <?php $even = false; for ($i = 0; $i <= 10; $i++) { if ($even == false) { $bg = '#CCC'; $even = true; } else { $bg = '#FFF'; $even = false; } echo "<tr style='background:{$bg};'>"; // do more stuff } ?> If you want to use Javascript then just run through all the tr tags and set it sort of like I did server-side with PHP in the above example.
  22. Use strtotime() to make it into a timestamp. Then just use the regular lower than and greater than operators.
  23. If you wish to do that then you'll have to create a method which gets a new instance. <?php class Test { public function __construct($argA) { // do stuff } public static function getNewInstance($argA) { return new self($argA); } public function someSortOfFunction() { echo 'Called ' . __METHOD__; return $this; } } $obj = Test::getNewInstance('testing')->someSortOfFunction(); ?>
  24. The by far easiest way would be to use native PHP and run your template files through eval(). You can then catch the output using output buffering.
×
×
  • 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.