Jump to content

requinix

Administrators
  • Posts

    15,071
  • Joined

  • Last visited

  • Days Won

    414

Everything posted by requinix

  1. Load the HTML into DOMDocument, use getElementsByTagName to get all the H2s and loop over them, and for each one set the "id" attribute to whichever value you want according to its textContent. DOMDocument
  2. pv can only act like cat, and you can't use that to copy a directory structure either. How about doing a cp -v to see each file being copied? Or maybe... uh, tar c to stdout, piped to pv, piped to tar x from stdin? But doing this might even slow down the copy. As for rsync, -v and/or --progress should work. No pv.
  3. The REQUEST_URI includes the query string too. $page_url_rewrite will be either "test" or "?p=test". Dump out $_SERVER and look for a more appropriate value to use...
  4. I take it you're not talking about the Find Content button in a user's profile?
  5. What does phpinfo() say about whether the soap extension is loaded?
  6. That response is all messed up. JSON and a PHP dump? Wrong Content-Type? Or maybe it's just what you posted here? json_decode the response body.
  7. mcrypt_create_iv() and openssl_random_pseudo_bytes() can both do it. Unless Jacques says something, in which case I won't come back in here.
  8. None of that makes any sense. Are you in the right thread?
  9. What's onEventDeleted? Something is firing off that event and that is where you need to put the confirmation dialog.
  10. If you don't manage the server then there's nothing you can do. As for how to use cURL, here is a basic example.
  11. The page is being refreshed because of that location.reload(), so if you don't want that to happen then don't put that code in there. Is the .alert-success (which you should probably put an ID on rather than relying on just the class name) visible? As in it doesn't have a display:none or something? If it is, and probably should be, then you need to .show() it too.
  12. Is mail() returning true or false? Have you checked your spam/junk folders? Try using a library like PHPMailer to send emails instead. It is much more sophisticated than simply calling mail() and with it your emails have a higher likelihood of not being detected as spam anyways.
  13. If you need to process that file on your server then you'll need to get a copy of it to your server somehow. Even if that copy is just in memory, there's no way around retrieving the contents. As for disk space, if you download a copy to a file then there's no reason why you can't delete the file when you're done with it. Try using cURL to see if it behaves differently.
  14. You want to give them a URL to your site but have it download files from some other site? Would it be enough to support the URL on your site but do a redirect, which most people won't know or care about? You can if you put them in [code] tags. I've already done it for you.
  15. There are two root problems here that you can't really solve: 1. The Kp index is not completely accurate, in the sense that you cannot state "a rising value indicates a possible aurora" nor "a falling value indicates an aurora is ending" - the alternative meanings probably being due to random fluctuations and/or margins of error*. 2. Given two "high" Kp values, you don't know for sure whether they correspond to two different (chances of) auroras. For example, a change from 5->7 could indicate an increasing chance of the same aurora (such as 3->5->7) or the chance of a second aurora (as in 7->5->7). Consider that the rising or falling Kp value is not an event itself but rather the symptom of an event. That is, after all, what it actually represents. What you want to do is notify users of the aurora event (or more precisely, a particular likelihood of an aurora in the near future), and do to so you use the Kp index to decide when one might start and when one might have ended. As such the question is not whether you should send a notification at a certain Kp value but whether the new measurement does/does not belong to a particular aurora event that has/has not had a notification sent. Follow that? Honestly, I would pick a method, go for it, and see how it performs. Maybe you offer different options to the user so they can decide how they want their notifications? My first attempt would be with your last option: define the beginning of aurora event as being a series of consecutive Kp values above some threshold for some period of time and the ending as consecutive Kp values below some threshold for some period of time. Here are two examples of that approach: a) Auroras begin with Kp >= 5 for 10 minutes; auroras end with Kp b) Auroras begin with Kp >= 6 for 20 minutes; auroras end with Kp Also note that the second example has a buffer of uncertainty, where the Kp value can fall 6->5 for a while without being considered the end of an aurora. * Speaking of margins of error, you may want to round the figures you receive. Like to the nearest tenth? Fifth? Because the hundredth between 6.99 and 7.00 shouldn't be treated as a significant difference.
  16. LanceL, are you looking to hire/pay somebody to solve this for you? Or were you looking more for help with PHP so you can do it yourself?
  17. What are you doing to advance the time? If you did that part properly then the date would advance when it should automatically.
  18. Please don't make me lock this thread, guys. Yes, we could have easily answered the question. I (or anyone) could have posted the answer, you would have copied it, seen it working, and been on your way. But would you have learned anything? Not really. Well, maybe: it's possible you're one of those types who will take code given to them and try to understand what it does, but in my experience the majority (not everyone) of people who ask programming questions on the internet are not like that. So I gave you a couple bits of code that will (should) get you most of the way to the answer. rwhite35 talked about putting variables in strings. Jacques1 suggested you use a templating engine so you don't have to deal with embedding PHP code into HTML. But not even all of that combined would not have given you the complete solution. And that's the point. The normal process is that someone posts some code to help, OP comes back saying it doesn't work, we ask how it doesn't work and what their code is, they post, we tell them what they're missing, they figure it out, and we're done. Sometimes repeating those last couple steps a few times. Hopefully OP learned what was going on so that next time they come across a similar problem they will be able to say "oh, I recognize this situation from a problem I had earlier - I wonder if the same sort of solution will work for it too". We avoid giving out answers not because we want to annoy but because we want people to learn, and being fed answers doesn't really do it. Unfortunately not everyone understands that, and those people will spend months or years coming back asking simple questions because they aren't learning - or worse they quit after a couple threads because we didn't tell them the answer and they get frustrated and ragequit. You seem to get that we're trying to help you learn. Yes, sometimes threads get sidetracked and sometimes the discussion gets heated and sometimes people get offended. It happens because we're human. How about we take a step back, reconsider what this thread is supposed to be about, and go back to where we left off in that normal process? You have some code that isn't working. If you only put the code I posted into what you had then you're still missing something to make it work. So: what is the code you have now and how is it not working?
  19. Load the XML into SimpleXML $xml = new SimpleXMLElement("http://steamcommunity.com/profiles/76561198283429063/?xml=1", 0, true);then use SimpleXML's "simple" means of accessing information. Keep in mind that most of what you get from it will be objects and not strings so you'll probably want to (string)-typecast stuff. If you have a problem with something in particular then post your code and an explanation of what's going wrong.
  20. Remember that code I posted yesterday? Have you tried to do anything with it? If you're still wondering where to put it then you should think about what the code is doing and where it would make sense for it to go.
  21. Without any error checking, $h = fopen("file.txt", "rt"); while (!feof($h)) { $title = trim(fgets($h)); $url = trim(fgets($h)); // output } fclose($h);
  22. Try dumping the $_SESSION in the Admin page where it fails the login check. Apparently something is different between the two page loads and what's in (or not) the session may explain that. If your session data isn't too complex then you can error_log(json_encode($_SESSION));Or to the screen, but then the header redirect won't work (which would be fine for this).
  23. Is it possible that the login code is executing after those checks?
  24. requinix

    Json help

    Forget that for a moment and focus on the error message. And on fixing whatever caused it.
×
×
  • 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.