Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. Kinda. Mostly I'm saying to start using associative arrays. Your earlier version $universiteiten = array( $uniAmsterdamVan = array('uniNaam' =>'Universiteit van Amsterdam', 'uniID' => 'uva'), $uniAmsterdamVrij = array('uniNaam' =>'Vrije Universiteit Amsterdam', 'uniID' => 'vu'), is not (well, half not) associative. Those extra $uniX variables are just complicating things. You should be accessing everything like $universiteiten[name]["uniNaam" or "uniID" or "hURL"]
  2. That header tells whatever is downloading the file what type of file it is (and thus what should be done with it). If you're going there with your browser and it doesn't know how to handle that content-type then it'll do its default action: download it. From the ten seconds of searching I just did, what you need is to embed the viewer in a page and point the viewer to wherever the pptx comes from. Google's thing then downloads the file and displays it.
  3. As before, you're dealing with copies of values, not values themselves. Do away with all those $uniX variables and use array keys. $universiteiten = array( "uniAmsterdamVan" => array('uniNaam' =>'Universiteit van Amsterdam', 'uniID' => 'uva'), "uniAmsterdamVrij" => array('uniNaam' =>'Vrije Universiteit Amsterdam', 'uniID' => 'vu'), echo $universiteiten["uniUtrecht"]["uniURL"];
  4. As long as there is at least one school, $hURL should work. However it'll be the very last one found. But where's $uniUtrecht coming from? I don't see it defined anywhere.
  5. Okay. Can you see where the problem is?
  6. Perhaps BASE_URL=/? Because $returnToPage will have a leading slash.
  7. It's working for me. Did you Ctrl+F5 after updating the .htaccess?
  8. $universiteit is actually a copy, not the original. When you add the hURL you're only adding it to the copy. You could use references but they can backfire if you don't know exactly how it all works. So use the array's keys and update $universiteiten: foreach( $universiteiten as $universiteitkey => $universiteit ) { $universiteiten[$universiteitkey]['uniURL'] = $hURL; echo 'Hodex URL: ' . $hURL . ' '; // why bother with the array when you have the value?
  9. Another option is using something like PHPMailer which takes care of many of the things that tend to get emails flagged as spam.
  10. Eww, GoDaddy. Throw a FileETag All in your .htaccess and see if that changes anything. If not, is there a URL you can share so we can see it for ourselves?
  11. The image itself is being cached, not the webpage displaying it. Your server should be set up to send correct caching headers with images. Normally they are by default but apparently not yours. What web server are you using?
  12. First, I have a question to you: what if there's already a file named with that random number?
  13. Is it consistently X/5? Hint: it's consistently X/5. define("AMOUNT_PER_STAR", 5); define("MAX_AMOUNT_FOR_STARS", 400); // you said 600, but $80*5=400 define("MIN_AMOUNT_FOR_STARS", 15); if ($user["amount"] >= MIN_AMOUNT_FOR_STARS) { $amount = min($user["amount"], MAX_AMOUNT_FOR_STARS); $user["max_stars"] = floor($amount / AMOUNT_PER_STAR); } Normally I don't litter my code with lots of constants but for some reason I felt like it this time.
  14. You didn't do anything wrong. The thing with joining a table against itself is that you'll come across the same row twice: once on the left side of the JOIN, once on the right side. It's like multiplying: you can get to 15 by multiplying 3*5, but 5*3 does it too. Put in a condition that compares the two teams in such a way that only one combination is valid. For instance, only where the left team's ID is less than the right team's ID. Unless there's something in particular you'd like to see (eg, alphabetical, or the home team must be on the left, or the loser on the right) the actual condition itself doesn't matter.
  15. Yes. And I'm having a hard time coming up with situations where that question, even out of context, would get a different answer. Srsly. Chaining hashes is like multiplying by 0.999. Doing it once or twice leaves you with something comparable to the original, but the more you do it the weaker your result will be.
  16. requinix

    UTF8

    Do you need "transparent character encoding filter for the incoming HTTP queries, [to perform] detection and conversion of the input encoding to the internal character encoding"? The manual
  17. If the choice is between "good" and "bad" then only one of those answers was the "good" answer. That wasn't to say it wasn't correct or right, but as far as I'm concerned it wasn't good. But now I'm just splitting hairs.
  18. Your answer is right, it's the best way to build a string like that without having a trailing comma that needs to be removed. I'm just saying that using something like json_encode(), which is for situations exactly like this one, is better.
  19. I have a question for you. If you also believe that it should be done another way, and I'm sure you've seen that OP is trying to learn that better way, why did you give him/her the bad answer?
  20. Construct a multidimensional array that looks like what you want, then json_encode it.
  21. ... The idea you have of creating files for every single thing is bad. Very bad. Don't do it. There is absolutely no reason whatsoever that anyone should ever need to do it. Do you want to know how you should be doing it?
  22. You can't write to the middle of a file without overwriting whatever came after. You'd "have" to read in the whole file, make your change to the string in memory, then write it out.
  23. requinix

    UTF8

    Multibyte Support enabled There's your answer.
  24. requinix

    UTF8

    Is the extension not enabled already? It's one of the most common extensions and thus often is.
  25. I'll say it now: there could be an extension that'll help do this. Such as mod_macro. Yes, there is some flexibility with configuration, but I'm not sure it extends all the way to directives like ServerName and DocumentRoot.
×
×
  • 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.