Guestbook Flash+XML+PHP
Tengo un guestbook en flash xml y php pero funciona en un solo servidor, pero en otro no,... ambos hosting soportan php, en el host que funciona soporta PHP 4.4.7 y en el otro es PHP 4.4.2
los codigos son
XML
<code>
<xml><guestbook><entry><myText>Lorem ipsum </myText></entry><entry><myText>hola</myText></entry><entry><myText>hahhaa</myText></entry><entry><myText>SSSS</myText></entry></guestbook></code>
PHP
<code>
$file = fopen("nsq.xml", "w+") or die("No se puede abrir XML");
$xmlString = $HTTP_RAW_POST_DATA;
if(!fwrite($file, $xmlString)){
print "Error escribiendo en XML";
}
print $xmlString."\n";
fclose($file);
</code>
El codigo en FLASH, es el principal codigo:
<code>
var currPage = 0;
var showAmount = 10; // set this to the amount of entries you want to view at a time
previous._visible = false;
createMessage._visible = false;
createButton.onRelease = function(){
this._visible = false;
this._parent.createMessage._visible = true;
if (createMessage.nameField.text == ""){
Selection.setFocus(createMessage.nameField);
}
else if (createMessage.messageField.text == ""){
Selection.setFocus(createMessage.messageField);
}
}
// **** Load XML ****************************
myXML = new XML();
myXML.ignoreWhite = true;
receiverXML = new XML();
myXML.onLoad = function(success){
myXML.contentType = "text/xml";
if (success){
this.showXML();
}
else{
trace("Error loading XML file");
}
}
myIdentifier=Math.round(Math.random()*10000);
myXML.load("guestbook.xml?uniq="+myIdentifier);
receiverXML.onLoad = function(){
this.contentType = "text/xml";
_root.currPage = 0;
this.showXML();
}
createMessage.closeButton.onRelease = function(){
this._parent._visible = false;
createButton._visible = true;
}
createMessage.sendButton.onRelease = function(){
var myName = this._parent.nameField.text;
var myMessage = this._parent.messageField.text;
if (myName == ""){
this._parent.errorField.text = "please fill out your name";
Selection.setFocus(this._parent.nameField);
}
else if (myMessage == ""){
this._parent.errorField.text = "please leave a message";
Selection.setFocus(this._parent.messageField);
}
else {
myXML.firstChild.appendChild(myXML.createElement("entry"));
myXML.firstChild.lastChild.attributes.myName = myName;
myXML.firstChild.lastChild.appendChild(myXML.createElement("myText"));
myXML.firstChild.lastChild.lastChild.appendChild(myXML.createTextNode(myMessage));
myXML.sendAndLoad("processXML.php", receiverXML);
this._parent._visible = false;
createButton._visible = true;
}
}
XML.prototype.showXML = function(){
myGuestbook.scroll = 1;
myGuestbook.htmlText = "";
var numItems = this.firstChild.childNodes.length;
var firstItem = numItems - (currPage*showAmount);
if (currPage == 0) previous._visible = false;
var lastItem = firstItem - showAmount ;
if (lastItem<0>= lastItem; i--){
myGuestbook.htmlText += "<B>" + this.firstChild.childNodes[i].attributes.myName + "</B> wrote:\n";
myGuestbook.htmlText += this.firstChild.childNodes[i].firstChild.firstChild.nodeValue + "\n\n";
}
}
previous.onRelease = function(){
currPage--;
myXML.showXML();
next._visible = true;
}
next.onRelease = function(){
currPage++;
myXML.showXML();
previous._visible = true;
}
</code>
Queria saber que cambios tendria que hacer para que funcione en el servidor de PHP 4.4.2, pues es en ese que necesito que funcione,...
Gracias....
rokotto
a que te refieres?..... cuales global?
zigotica
ojo con los global en off