Jump to content

Omzy

Members
  • Posts

    314
  • Joined

  • Last visited

    Never

Everything posted by Omzy

  1. I've currently got a "Back to Previous Page" Link using $_SERVER['HTTP_REFERER'] but I only want this link to be displayed if the user got to the page by browsing to it from the site, and not through a direct link from another site.
  2. Omzy

    XPath and PHP

    Cheers, thanks for that. I've had a go at some of the different methods but the bit I'm struggling with is making it output a new file with the filtered data ONLY. I know we can use XSLT to have it DISPLAY certain data in a certain way, but the original XML data remains the same, which is not what I want.
  3. Thanks. Can XSLT be used to save the transformed data as a new XML file?
  4. Omzy

    XPath and PHP

    How can I use XPath to read in an XML document, run a query to filter out some of the data and then save the filtered data as a new XML file?
  5. How can I use XPath to read in an XML document, run a query to filter out some of the data and then save the filtered data as a new XML file?
  6. What about XPath? PHP includes a domxpath method.
  7. The question states: "Think about what technologies you will use to query the feed, whether you will leave the feed in its original format or need to convert it to another database format." Considering the data is coming from a database originally, it seems a bit odd to then re-insert it back in to another database so that we can query it. Which is why I said it would have been easier if we could interface directly to the original database. But perhaps that's just how it is. I've done some Googling on querying XML Data and it mentions something called XQuery. I'm wondering if this would be the best solution? However I've not managed to get it to run on my server - does XQuery require its own interpreter?
  8. I've just been set a university assignment, which goes something like this: A company provides a product feed in XML which contains thousands of items. The feed is generated from a back end database which stores details of all their products. I need to generate a web interface which will process this feed and return a new feed based on the parameters the user specifies in the form. So for example the user might only be interested in 'keyboards'. I don't need to write any code for this, just need to provide a solution to the problem. Now I would say that it's easier to just create an interface which connects directly to the back end database, queries it and generates a custom feed from there, rather than processing the main feed and generating a new feed from it. But I don't know if this is the answer they are after. If I was to take the raw "unfiltered" feed how would I go about running a query on this feed so that it can be filtered and a new feed be generated from it? Can it be done without using a database?
  9. Thanks mate, yes I think I need to use OR instead of AND. Cheers!
  10. Can this be simplified at all? SELECT * FROM customers WHERE category=cat1 AND category=cat2 AND category=cat3 AND category=cat4 AND category=cat5 This can just go on and on, so it would be ideal if there was a shorthand version. Thanks!
  11. Basically the 'ID' is got from the URL construct and there is a form on the page, clicking Submit will POST that form and it gets processed in the script as: if(isset($_POST['delete'])) { $query="DELETE FROM table WHERE id='$_GET['id']'"; //run the mysql_query } So is this safe enough? All the IDs in the database are INTs, do I need to do any intval() check or anything else?
  12. That code that I wrote above works fine though, the single quotes don't break the statement. All I'm trying to do now is make it more secure.
  13. Cheers for that mate. Is there any need to add any additional code to a standard delete statement: $query="DELETE FROM table WHERE id='$_GET['id']'";
  14. Cheers guys. Currently I've got: $query="INSERT INTO table (name) VALUES (' " .strip_tags($name)). " ')"; So what would be best to add to this - htmlspecialchars() or mysql_real_escape_string()?
  15. I just fixed it... fwrite($fp, ".html_entity_decode($data, ENT_QUOTES)."\n");
  16. I've got a script which first reads in raw XML data and then writes this data to a CSV file. However it doesn't seem to be converting the HTML entities back to their original characters, so for example it writes ' where there should be an apostrophe. So I inserted the html_entity_decode function as follows: fwrite($fp, ".html_entity_decode($data)."\n"); But that does not make any difference. Anybody have any ideas how I got about this?
  17. LOL I saw that and fixed it. But I think there is a problem in the function, which is why it's not working for me.. Is it possible to assign a variable within an ELSE IF statment, for example: instead of: $handle = fopen($url, "r"); if($handle) something like this: else if($handle=fopen($url, "r"))
  18. Cheers, that doesn't work though, it seems to be allowing invalid documents..
  19. Cheers MadTechie I will also give that a try. Can you see if you can help with my query regarding your earlier code?
  20. How can I put all that code in to an ELSE IF statement?
  21. Is there anything quicker than using fopen? It seems to take a long time for some sites and then eventually times out. I need something that will do a very quick check to see if the site is online, perhaps something that checks for header codes?
  22. what about: fopen($url, "r"); Is that sufficient?
  23. I've got a form with input fields and I've included the most common validation, for example strlen(), trim() and strip_tags(). Are there any other validation methods I should include? I am particularly trying to prevent SQL Injection attacks.
×
×
  • 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.