Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1479 connectés 

  FORUM HardWare.fr
  Programmation
  Flash/ActionScript

  [RESOLU] Problem avec Sendandload

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[RESOLU] Problem avec Sendandload

n°1654525
Muray
Posté le 07-12-2007 à 14:39:49  profilanswer
 

Bonjour a tous,
J'ai un problem pour recevoir mes données en PHP. Voici le code coté flash (repris d'un exemple)
 var result_lv:LoadVars = new LoadVars();
 var login_lv:LoadVars = new LoadVars();
 // copy the value of the two TextInput components into the login_lv LoadVars instance.
 login_lv.username = pseudo.text;
 login_lv.password = pwd.text;
 /* send the variables in the login_lv instance to the server-side script  
    using the POST method (send as Form variables rather than along the URL)
    and place the results returned in the result_lv instance. */
 login_lv.sendAndLoad("http://localhost/login.php", result_lv, "POST" );
 // When the results are received from the server...
 result_lv.onLoad = function(success:Boolean) {
  // If Flash is able to successfully send and load the variables from the server-side script...
  if (success) {
   // if the server returned the value of isValidLogin with a value of 1...
   if (this.isValidLogin == 1) {
    /* set the status_lbl Labal to a "success" message.  
       Typically here you'd do a gotoAndPlay or set any local variables  
       related to a successful login. */
    status_lbl.text = "login successful.";
    /* else the login information wasn't valid,  
       therefore display an error message in the status_lbl Label instance. */
   } else {
    status_lbl.text = "invalid user name / password.";
    // set the form focus to the pseudo TextInput instance and select the existing text.
    Selection.setFocus(pseudo);
    Selection.setSelection(0, pseudo.text.length);
   }
   /* this code is only executed if for some reason the SWF is
      unable to connect to the remote page defined in LoadVars.sendAndLoad */
  } else {
   status_lbl.text = "Unable to connect to login URL";
   pseudo.enabled = false;
   pwd.enabled = false;
//   submit_btn.enabled = false;
  }
  status_lbl.text = this.mess;
 
Je pense que le problem vient de PHP:
$pseudo = $_POST['pseudo'];  
 if($pseudo){
 parse("mess","OK" );
 }else{
 parse("mess","NOK" );
 }
 
Si j'affiche la page php j'ai une erreur avec le _POST, si je mets _GET c'est bon je n'ai plus d'erreur. Mais dans les deux cas je recupere coté flash NOK.
 
Merci de votre aide.


Message édité par Muray le 10-12-2007 à 10:44:19
mood
Publicité
Posté le 07-12-2007 à 14:39:49  profilanswer
 

n°1654802
graphix
Posté le 07-12-2007 à 20:54:15  profilanswer
 

et avec $_POST['username'] (c'est a dire le nom de la variable definit dans le loadVar)

n°1654803
graphix
Posté le 07-12-2007 à 20:56:14  profilanswer
 

Je pense aussi que tu devrais mettre le sendAndLoad apres la déclaration onLoad.

n°1655675
Muray
Posté le 10-12-2007 à 10:41:57  profilanswer
 

MErci graphix, perdre 2 jours la dessus...
c belle et bien le 'username'...
Merci


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Flash/ActionScript

  [RESOLU] Problem avec Sendandload

 

Sujets relatifs
[Resolu] UPDATE - Pb avec chaine de type '&chaine'[Résolu] Comment gérer les accès concurents ?
[resolu]passage de php4 à php5.... petit problème[RÉSOLU] Warning: mysql_fetch_row(): supplied argument
simuler l'autocomplétion en ligne de commande ? [RESOLU][Résolu] [WSQL] Besoin d'aide - Procedure
[Résolu] addslashes() vs mysql_escape_string()[résolu] Eclipse me crée des classes en ...$1.class
[Resolu] Php + plusieurs bases Accesstrier après une requète (résolu)
Plus de sujets relatifs à : [RESOLU] Problem avec Sendandload


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR