Jump to content

PHP + XML HELP


tready29483

Recommended Posts

Hey,

 

I'm of course a newbie at php and i have a question about getting information from an XML file.  Here is my xml file:

 

<?xml version="1.0"?>
<users>
<user>
	<username>[email protected]</username>
	<password>password</password>
</user>
<user>
	<username>[email protected]</username>
	<password>password</password>
</user>
<user>
	<username>[email protected]</username>
	<password>password</password>
</user>
</users>

 

And What I want to do is use this as part of my login script.  The site I work for is non profit so we have a linux hosting environment with no mysql access.  So I'd like to authenicate users via this xml structure.  I can do it in sql syntax but I'm lost when it comes to searching through an XML file.  Can anyone help or point me in the right direction??  please let me know.

Link to comment
https://forums.phpfreaks.com/topic/45412-php-xml-help/
Share on other sites

Ugh.

 

Why don't you have MySQL? Change hosts would be my answer. You'll end up reinventing so much. It'll end up costing you or the non profit so much in coding time it won't be worth it. Say your time is $15 an hour (to you) and you end up playing with XML for 10-20 hours? Someone is losing out big time, and I suspect that would be you. You time would be better spent on other things.

 

Ugh.

 

monk.e.boy

Link to comment
https://forums.phpfreaks.com/topic/45412-php-xml-help/#findComment-220527
Share on other sites

http://us2.php.net/xml

 

User Contributed Notes

XML Parser Functions

Sheer Pullen

14-Mar-2007 07:27

I took the code posted by forqoun and modified it to be somewhat more readable (by me), somewhat more friendly to the idea of parsing multiple files with the same object, and to be compatable with a HTTP POST of XML data. Anyone who's interested in my version of associated array output can check it out at http://www.sheer.us/code/php/xml-parse-to-associative-array.phpsrc

 

Be nice to me, this is my first published php code

 

Use that code to get your xml file into an array and use it for verification, remember to store the passwords as md5 hashes or some type of encryption to prevent security being compromised.

 

Also I would even set the xml file to be a php file and do a check to make sure that the file is being requested from your server and not just some on-looker. IE:

 

<?php
header("content-type:text/xml"); // replace this with what you need to
if (isset($_REQUEST['fromsite'])) {
   die("You should not be here");
}
if (!$fromSite) {
   die("You Should not be here!");
}
?>
<?xml file here ?>

 

<?php
// request xml file
$fromSite = true;
$file = include('xmlData.php');
?>

 

I am not 100% sure that will work how it is, but it can be manipulated to work right. Just some ideas for ya.

Link to comment
https://forums.phpfreaks.com/topic/45412-php-xml-help/#findComment-220543
Share on other sites

I'm doing this for free for them.  IE they are non-profit and its for charity.  They have limited funds and have to spend it elsewhere.  Guess I'll take my question elsewhere....geez :-\

 

That's my point. You could earn them far more money by writing code for a company at $15 an hour and giving them that money.

 

Do you see what I'm saying?

 

You could work for me for $20 an hour, then after 20 hours you could buy a better server with MySQL on it. Then spend 10 hours building a wicked ass site and in total you have spent 30 hours.

 

Now try to build a wicked ass site using XML and not re-using code, you end up spending 60 hours. That's 30 hours of wasted money and time.

 

See what I'm saying now? It's not that complicated. I just hate seeing non-profits throwing money (time=money) away.

 

monk.e.boy

Link to comment
https://forums.phpfreaks.com/topic/45412-php-xml-help/#findComment-220576
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.