Jump to content

requinix

Administrators
  • Posts

    15,227
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. cURL would be the best place to go. Check out the examples in the various functions' page; you'll need the CURLOPT_POST and CURLOPT_POSTFIELDS options at a minimum.
  2. So where is $userLevel defined?
  3. Well that's funny. Because when I click that link I posted I arrive immediately at Maybe your Internet isn't the same as my Internet...
  4. What I meant was for you to click the link and read what it pointed to. That's why I put it there.
  5. I think it would involve writing some code, but don't quote me on that.
  6. Try REPLACE.
  7. Wrong syntax. Use $this-> like you would for most everything else. But No. That's not what inheritance is about. The only time you would do this is if the user was a type of database. Which it isn't. If the user class needs access to database stuff then give it access to database stuff. Don't try to force an inheritance hierarchy that doesn't make sense.
  8. Nothing says you have to use SimpleXML. You can build it normally like it was HTML (if that's what you're doing with it): '; ?> MRSS Playlist title); ?> description); ?> duration; ?> start; ?>
  9. You don't have to change anything in that class. Instead of $db->foo use db::instance()->foo.
  10. The "1969 error" (as I call it) happens when you give date() something that isn't a Unix timestamp, or when you give strtotime() something that it can't parse as a date string. If you want to reformat the date string and you can't store it as a timestamp to begin with, run it through strtotime() first. date("format", strtotime($date_string))
  11. Depends on your code. Which is what, exactly?
  12. Any idea what the "default" time for this is, if any? Most of my problems is that images are not updated as soon as i've uploaded them. Lets say that i do some minor changes on a picture in the header, the new one wont appear untill i make a hard refresh. What i've noticed though is that if i wait like 24 hours or so "without a hard refresh", the new picture will appear automatically. So it has to be some kind of timespan somewhere? I don't know for IIS, but I believe Apache uses ETags by default. Those don't use dates or times: 1. Browser requests something for the first time 2. Server sends it and includes an ETag header with an identifier 3. Next time, the browser asks the server for the same thing but includes a condition that says "only send it if the ETag is not $identifier" 4. If it changed the server sends it (and the new identifier), otherwise it responds saying there were no changes and the browser uses its cache What you're describing sounds like time-based caching (be that an Expires or something else). To find out what's really going on you need something like Firebug or Chrome's Inspector or something that lets you view HTTP request and response headers. It is not every day i change the .css file, but it happens some times When that day comes, is the code that i posted earlier a good choice then? That code is only good for PHP scripts. To fix it for normal files you'd configure the web server to use caching as you want. For Apache you can stick a FileETag All in a .htaccess. But again, what you do depends on what's going on with the server and why it's doing what it's doing.
  13. For static files the web server (like Apache or IIS) should handle caching automatically. Sometimes they need a nudge in the right direction but they'll do it. That leaves the dynamic content (like PHP scripts). Often they won't specify caching behavior themselves, so without any advice to go on the browsers shouldn't be caching the pages and a Ctrl+F5 shouldn't be necessary. In my experience caching problems are almost always the result of the web server not handling caching for static files, like scripts and stylesheets, as you expect. Like they'll send Expires headers* that last a long time, or generate ETags** using limited information. Both of those can be fixed quite easily but you only need to do so if you discover a problem. Odds are you won't have problems, but just in case you should do a bit of testing early on and find out if there's anything to fix. * Tells the browser that it doesn't need to "refresh" until a certain date and time. Meanwhile they won't pull down new content - won't even try to. ** Identifiers generated by the server that change whenever the content changes, however you define that. For example, if an identifier depends solely on file size then browsers will only refresh if your edits also change the file size.
  14. You really shouldn't be sticking that many items in an array... Use an insertion sort when you add to the array: keep it sorted and insert the new addresses into the right position. When you're doing that you can also check for a duplicate.
  15. Since your code isn't really readable in its current state, if (quantity shipping = quantity * 7.00 } else { shipping = 2 * 7.00 + (quantity - 2) * 1.00 } [edit] But now it is. //get shipping for additional items above 3 if ($i $shipping = "0.00"; } else { $shipping = "1.00"; } Fix that.
  16. At the end of a script, when PHP closes handles and destroys any remaining objects, the working directory may (and probably will be) completely different from where it was during the rest of the script. That means "t.txt" won't be where you think it should be. Try looking in the main Apache directory. Don't use the destructor to write files. Do it normally: make a separate function for it and call that from your script when you want it to save the file.
  17. I think you should use whatever you want to use. Just do it consistently.
  18. Assuming there's just the one shop and there are an infinite number of non-tradeable items, Yes, have a table listing the items for sale. It'll surely have more columns: while items can have a base value I'd make the shop list its own value (which may very well be the same as the base value). When someone buys you "copy" the item to their inventory. I mention "infinite number" and "non-tradeable items" because if that's not the case then things are a bit different.
  19. Where is the code that calls get_thumbnail()? Does it look like ThumbnailHelper::get_thumbnail()
  20. Yes, they disappear too. The exception is sessions. HTTP is stateless: it does not keep track of the state between requests. PHP does not know what happened on the last page. That means every script has to start from scratch: there aren't any variables or classes or database connections from before. The solution is to have your scripts load what they need. Need a class defined? require_once() the file. Need a database connection? Create one. Need a value? Look it up.
  21. Inside classes you have to use $this-> for member variables and member functions. Without, PHP will look for a normal variable (inside the function) and normal function (global function). $two = $this->two(); $three = $this->three();
  22. CSS Help has @imported this topic. http://www.phpfreaks.com/forums/index.php?topic=356905.0
  23. With JavaScript? No way I can think of.
  24. Untested. function moveserial(self, to) { if (self.value.length == self.maxlength) { self.form[to].focus(); } } - -
  25. This topic has been remastered in brilliant HD quality in JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=356870.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.