Advanced Search

Results 1 to 6 of 6

Thread: Php/xml

  1. #1
    Join Date
    Jul 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Php/xml

    I am putting together a PHP file to pull an XML file.
    The XML file is going to be similar, but different depending on the logged in user.

    How would I write in PHP code that I want the XML file belonging to the current user?

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,154
    Thanks
    261
    Thanked 690 Times in 678 Posts

    Default

    It's hard to answer the question abstractly. Are you asking how to parse XML? How to find the file? How to read its contents? All of these things are possible in PHP, though, and with a more specific question I think we can help.

    As a broad question, why this method? It's possible it might be better as a database. So before you do too much work, look at alternatives like that.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jul 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I can parse the XML file pertaining to myself in PHP and it displays just fine.
    But what if a different user is logged in? How will the PHP know to load their XML file and not mine?
    Hope this helps.

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,154
    Thanks
    261
    Thanked 690 Times in 678 Posts

    Default

    First, you need to identify each of the separate steps involved. Then you can solve each individually. For us, it will be easier to help with a specific step.

    From what you just said, there are least 4 major steps:
    1. A user login system of some sort.
    2. A way to identify the user and use that information to get a specific file.
    3. A way to get a specific XML file.
    4. A way to load the information from that XML file.

    You said you have (3) and (4) solved, is that correct? What about (1)? Do you have a user login system? The answer to (2) will depend a lot on that.

    As a short answer: 1. get the username for who is logged in; 2. relate that username to a filename (maybe it's "[username].xml"?); 3. Load the file with that name.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Jul 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes, 3 & 4 I have done.
    There is a login system; the user is logged in when they sign on to any computer. And the PHP I am putting together pops up on the screen right away.
    The XML filename is the same for everyone.

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,154
    Thanks
    261
    Thanked 690 Times in 678 Posts

    Default

    Yes, 3 & 4 I have done.
    Ok, good.

    There is a login system; the user is logged in when they sign on to any computer.
    How does your PHP integrate with the computer's login? I don't understand. PHP usually operates on a web server.

    And the PHP I am putting together pops up on the screen right away.
    Same here-- I don't understand. Is this a webpage? A compiled .exe set to run at startup?
    The XML filename is the same for everyone.
    How/why? If it's the same file, then it will always have the same information. Or do the contents vary on different computers? For example, on my computer it would say "djr33" and on yours it would say "rbush". But I still have to ask how/why. Are you trying to use PHP to read part of the system information?



    Overall, what is your project? This is, as far as I can tell, not a typical PHP project.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •