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?
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?
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
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.
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
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.
Ok, good.Yes, 3 & 4 I have done.
How does your PHP integrate with the computer's login? I don't understand. PHP usually operates on a web server.There is a login system; the user is logged in when they sign on to any computer.
Same here-- I don't understand. Is this a webpage? A compiled .exe set to run at startup?And the PHP I am putting together pops up on the screen right away.
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?The XML filename is the same for everyone.
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