Jump to content

requinix

Administrators
  • Posts

    15,227
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. You sure you have the right URL? What is the path to the file on the server? I mean the actual filesystem path.
  2. I'm not sure what the problem is. What output did you expect to see? [edit] By the way, if you want something unique for each item, please try to use its instead of its title. That's exactly what it's for.
  3. I only see one feed in there... Do you mean the items in the feed? Only look at the first one? foreach($RSS_DOC->channel->item as $RSSitem) That's the loop. Remove it, the {, the associated }, and save yourself from changing variable names by substituting in $RSSitem = $RSS_DOC->channel->item[0]; (which assumes that the feed always has at least one item in it).
  4. Here's how I would probably do it. No formal database? Fine. Make your own rudimentary version: keep a JSON array in a file that holds all the alerts and their expiration times. Like $alerts = array( array(time() + 3600, "This alert will expire in one hour"), array(time() + 86400, "This alert will expire in 24 hours"), array(mktime(23, 59, 59), "This alert will expire at the end of today") ); [[1354304622,"This alert will expire in one hour"],[1354387422,"This alert will expire in 24 hours"],[1354348799,"This alert will expire at the end of today"]] To add an alert, 1. Read in the file and json_decode() it back into an array 2. Filter out the alerts that have expired 3. Add the new alert at the end 4. json_encode() the array and write it back into the file To show the alerts, 1. Read in the file and json_decode() it back into an array 2. Show the alerts that have not expired
  5. One table is definitely the way to go.
  6. "0:0"? All I see in the Java code you posted is just "0". What I'm saying is that if $out="0" then $out!=true. The way around it is exactly what I said.
  7. It's really unusual to search all the tables in the database. Surely you want to search a specific subset of tables?
  8. You bin2hex'd the return value from encrypt().
  9. Perhaps an explanation of what these alerts are and when they're displayed is in order?
  10. Think of it not in terms of clearing the file but whether you show its contents. - When you display the alerts, if the file is too old then don't show anything - When you display the alerts, if the file is not too old then do show it - When you add alerts, if the file is too old then overwrite everything - When you add alerts, if the file is not too old then append into it Get how that works?
  11. It's not. You can't authenticate on behalf of the browser and you can't tell the browser what the credentials are (short of putting them in the URL which is a bad idea). If you want to automatically authenticate people then you'll need to write/find something to let you do that, and it won't involve the server built-in authentication. Though you can store the credentials in a .htpasswd file if you so wish (so long as you don't use it to lock down the directory in Apache).
  12. Yes. That is a very bad thing to write and one of the numerous reasons why goto is bad. Don't use goto. Use a database for this, not a file. That will give you much more control over how these alert things work and it's much easier to deal with since you don't have to worry about all the little gotchas about dealing with files.
  13. I assume you saw the note on step 4? (link added) Without going into details I don't know, COM objects are all registered in Windows. PHP itself doesn't have to know where the actual object DLL is. Are you sure the method is called "DeviceStatus" and not "devicestatus" like I see in the article?
  14. Why do you need to convert it? It has a perfectly good UTF-8 representation already.
  15. No, I'm saying you put the quotes in the wrong place. Compare where the quotes are in the examples I posted with where the quotes are in your code.
  16. The DOCUMENT_ROOT doesn't include a trailing slash. IIRC never does. include ($_SERVER['DOCUMENT_ROOT'] . "/index.php");
  17. Right idea, wrong place. Quotes around the strings you're inserting. The list of fields you're inserting into don't always have to be quoted, but if you do then use backticks ` for them. Regular double " and single ' quotes are strictly (and necessary) for string values. INSERT INTO table (field1, field2, field3) VALUES ("string 1", "string 2", "string 3") INSERT INTO table (`field`, `field2`, `field3`) VALUES ('string 3', 'string 4', 'string 5')
  18. Strings in SQL need quotes.
  19. Taking a guess since I can't see the rest of the Java code, but the server will send "0". However if $out="0" then the while loop will stop (because "0"==false) and you don't get the output. Try more like while (($out = socket_read($socket, 2048) != "") {
  20. You're running a web server at work and you don't want anyone to know about it? Sounds awful suspicious. Leave Apache at its defaults and make sure your firewall doesn't allow external connections to port 80 and/or the Apache. Actually, when you first started Apache you may have gotten a notification from Windows' firewall asking whether to allow or block connections.
  21. Looking at the docs on ResultSet and a bunch of results in Google suggests it's not possible. Which is understandable because there are cases where mysql_num_rows() doesn't work; it's only because mysql_query() buffers the results that you can use it. Try buffering the results yourself, or rework your logic so that you don't need to know how many rows there are ahead of time (if at all).
  22. As the comments in that file say, Listen is about what address and port Apache itself listens on. That has absolutely nothing to do with where the user is located. See the "allow from all" in your vhost configuration? Try changing that. Anybody else trying the site will get a 403.
  23. You don't have short_tags enabled. Use <?php for all your opening tags.
  24. Well, what was the change?
  25. Because you put it in the URL. $_GET is how to get to that data. Just because it's a DELETE doesn't mean that's handled differently.
×
×
  • 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.