Jump to content

PHP AND XML?


Gayner

Recommended Posts

i want to use this code inside my rofl.php ..

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<gt>
<status><![CDATA[2]]></status>
</gt>

 

my rofl.php:

 

<?php
// Load and Start IPB SDK
require_once "ipbsdk/ipbsdk_class.inc.php";
$SDK =& new IPBSDK();
global $ibforums;
echo $_GET["s"];
mysql_query("UPDATE ibf_members SET s = '". mysql_real_escape_string($_GET["s"]) ."' WHERE id='{$ibforums->member["id"]}'");
?>

 

how?

 

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

That's a ruddy good questuin - how do you want to use that code in your rolf.php?

 

using this:

 

function njAJAX() {
this.callback = 0;
this.waitingResponse = 0;
this.url = "";
this.method = "GET";
this.params = null;
this.errorCallback = 0;
this.xmlObj = 0;

this.getPage = function(pageURL, pageCallback) {
	if(this.waitingResponse) return;
	if(pageURL) this.url = pageURL;
	if(pageCallback) this.callback = pageCallback;

	try {
		this.xmlObj = new XMLHttpRequest();
	} catch (error) {
		try {
			this.xmlObj = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (error) {
		}
	}
	if(!this.xmlObj) return;
	var o = this;
	this.xmlObj.onreadystatechange = function() {
		if(o.xmlObj && o.xmlObj.readyState == 4 && o.xmlObj.status == 200) {
			if(!o.xmlObj.responseXML && o.errorCallback) o.errorCallback();
			o.waitingResponse = 0;

			if(o.callback) o.callback(o);
		}
	}
	this.xmlObj.open(this.method, this.url, true);
	this.xmlObj.send(this.params);
	this.waitingResponse = 1;
}

this.getElementNodeValue = function(eName, eIndex) {
	var e = this.xmlObj.responseXML.getElementsByTagName(eName);
	if(!eIndex) eIndex = 0;
	if(e && e[eIndex] && e[eIndex].childNodes && e[eIndex].childNodes[0]) return e[eIndex].childNodes[0].nodeValue;
}
}

 

Sir please ?

Link to comment
https://forums.phpfreaks.com/topic/174040-php-and-xml/#findComment-917419
Share on other sites

Sorry but you have not explained what you want to achieve.

 

Nobody is going to read through your code (php OR javascript) to decipher what you are trying to communicate.

 

EXPLAIN in such a manner that no one will have to ask you a question in order to understand your problem.

Link to comment
https://forums.phpfreaks.com/topic/174040-php-and-xml/#findComment-917421
Share on other sites

Sorry but you have not explained what you want to achieve.

 

Nobody is going to read through your code (php OR javascript) to decipher what you are trying to communicate.

 

EXPLAIN in such a manner that no one will have to ask you a question in order to understand your problem.

 

I made a new post, sorry for posting that javascript.

 

Look above ur post..

Link to comment
https://forums.phpfreaks.com/topic/174040-php-and-xml/#findComment-917422
Share on other sites

are you saying that when you go to /forums/rofl.php?&s=hey

 

you want to parse that xml and replace the 2 with what ever $_GET['s'] is then print that out?

 

OMG yes,lol

 

so far i have this:

 

 

<?php
header('Content-Type: text/xml; charset=UTF-8');
// Load and Start IPB SDK
require_once "ipbsdk/ipbsdk_class.inc.php";
$SDK =& new IPBSDK();
global $ibforums;
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<gt>
<s><![CDATA[2]]></s>
</gt>';
mysql_query("UPDATE ibf_members SET s = '". mysql_real_escape_string($_GET["s"]) ."' WHERE id='{$ibforums->member["id"]}'");
?>

 

im calling <s> from: my javascript here:

 

var o = this;
	this.xmlObj.onreadystatechange = function() {
		if(o.xmlObj && o.xmlObj.readyState == 4 && o.xmlObj.s == 200) {
			if(!o.xmlObj.responseXML && o.errorCallback) o.errorCallback();
			o.waitingResponse = 0;

			if(o.callback) o.callback(o);
		}
	}

Link to comment
https://forums.phpfreaks.com/topic/174040-php-and-xml/#findComment-917430
Share on other sites

NOT the best solution in the world but quick and nasty...

 

<?php
header('Content-Type: text/xml; charset=UTF-8');
// Load and Start IPB SDK
require_once "ipbsdk/ipbsdk_class.inc.php";
$SDK =& new IPBSDK();
global $ibforums;
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<gt>
<s><![CDATA[' . $_GET['s'] . ']]></s>
</gt>';
mysql_query("UPDATE ibf_members SET s = '". mysql_real_escape_string($_GET["s"]) ."' WHERE id='{$ibforums->member["id"]}'");
?>

Link to comment
https://forums.phpfreaks.com/topic/174040-php-and-xml/#findComment-917433
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.