Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 11

Discussione: Guestbook php+xml

  1. #1

    Guestbook php+xml

    Salve a tutti, qualcuno puo' aiutarmi ad inserire nel guestbook, che per ora stampa sulla pagina solo questo:
    Nome
    Marcello
    Messaggio
    Ci vediamo presto
    anche la data subito prima del nome?
    Il codice del file flash è questo
    function pulisciTesto($campoTesto){
    $campoTesto = str_replace("<","",$campoTesto);
    $campoTesto = str_replace(">","",$campoTesto);
    $campoTesto = stripslashes($campoTesto);
    return $campoTesto;
    }

    $nome = pulisciTesto($_POST['nome']);
    $messaggio = pulisciTesto($_POST['messaggio']);

    if($_POST['nome']){
    $giorno = date("j");
    $mese = date("n");
    $anno = date("Y");
    $settimana = date("w");
    $giornosettimana = array ("Domenica", "Lunedi", "Martedi", "Mercoledi","Giovedi", "Venerdi", "Sabato");
    $nomemese = array(1 => "01","02","03","04","05","06","07","08","09","10", "11","12");
    ($giorno < 10) ? $giorno = "0".$giorno : '';
    // View
    $ladata = $giornosettimana[$settimana].","." ".$giorno."-".$nomemese[$mese]."-".$anno;


    $firma = "<firma ladata='".$ladata."' nick='".$nome."'>".$messaggio."</firma>";

    $fileXML = "guestbook.xml";

    //leggi file xml
    $fp = fopen($fileXML, "r");
    if($fp)
    {
    $contenuto = fread($fp,filesize($fileXML));
    $messaggi = str_replace("</guestbook>","",$contenuto);
    fclose($fp);

    $nuovaFirma = $messaggi.$firma."</guestbook>";
    //scrivi file xml
    $fp = fopen($fileXML, "w");
    if($fp)
    {
    if(fwrite($fp, $nuovaFirma)){
    print "&risultato=ok";
    }
    // chiudo il file
    fclose($fp);
    }
    }
    }

    Grazie mille

  2. #2

  3. #3

  4. #4
    Per piacere....è urgentino!

  5. #5

  6. #6

  7. #7
    uhm ...veramente mi pare che tu abbia postato il php per creare il file xml ...
    Non è bello ciò che e bello ...
    Ma che bello che bello che bello ...

  8. #8
    Ops...scusatemi...che stupido
    Ecco il codice
    stop();
    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("Errore");
    }
    }
    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 = "Inserisci il tuo nome";
    Selection.setFocus(this._parent.nameField);
    }
    else if (myMessage == ""){
    this._parent.errorField.text = "Scrivi il messaggio";
    Selection.setFocus(this._parent.messageField);
    }
    else {
    myXML.firstChild.appendChild(myXML.createElement(" entry"));
    myXML.firstChild.lastChild.attributes.myName = myName;
    myXML.firstChild.lastChild.appendChild(myXML.creat eElement("myText"));
    myXML.firstChild.lastChild.lastChild.appendChild(m yXML.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 = 0;
    next._visible = false;
    }
    myCount.text = "Messaggi Totali: " + numItems;
    if (firstItem == lastItem+1) nowShowing.text = "Messaggi " + firstItem;
    else nowShowing.text = "Messaggi dal " + firstItem + " al " + (lastItem + 1);
    for (i=(firstItem-1); i>= lastItem; i--){
    myGuestbook.htmlText += "<FONT COLOR='#5F624D'></FONT><FONT COLOR='#FF6600'>Nome:
    </FONT><FONT COLOR='#000000'>" + this.firstChild.childNodes[i].attributes.myName + "</FONT>\n";
    myGuestbook.htmlText += "<FONT COLOR='#5F624D'></FONT><FONT COLOR='#FF6600'>\nMessaggio:</FONT>\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;
    }

  9. #9

  10. #10

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.