Visualizzazione dei risultati da 1 a 7 su 7

Discussione: login in PHP da un SWF

  1. #1

    login in PHP da un SWF

    Salve a tutti.

    Ho una pagina di login in php con 2 campi (username e password) e un tasto "INVIA".

    Ho creato un analogo swf con i 2 campi e il tasto INVIA con associato questo codice:
    codice:
    on (press, keyPress "<Enter>" ) {
    	invia=new LoadVars();
    	invia.Username=_root.Username;
    	invia.Pass=_root.Pass;
    	invia.send("login.php", "_blank", "POST");
    }
    Quando dall'swf inserisco username e password e premo "invia", mi si apre correttamente la pagina php e nei campi ci sono scritti l'username e la password ke ho inserito dall'swf. Il problema è ke devo premere "INVIA" anke dalla pagina php per proseguire con il login!

    Riassumendo grossolanamente: l'swf mi manda correttamente le variabili ma non mi preme "INVIA" nel php

    Dove sbaglio?

    MAYDAY

  2. #2
    Utente di HTML.it
    Registrato dal
    Jun 2002
    Messaggi
    1,476

    Data stellare 031020041507

    come è fatta la pagina php?



    dies

  3. #3
    Premetto 2 cose:
    uno, ci capisco molto poco di PHP
    due, questa pagina non l'ho fatta io ma fa parte di un sito ke ho acquistato.

    codice:
    <?php
    	if (!empty($_POST['Submit']))
    	{
    		include ($_SERVER['DOCUMENT_ROOT']."/libs/logging.php");
    		include ($_SERVER['DOCUMENT_ROOT']."/system/generalconf.php");
    		$aLogging=new Logging;
    		if ($aLogging->Loggin($_POST))
    		{
    			session_start();
    			header("Location: http://".$_SERVER['HTTP_HOST']
                          .dirname($_SERVER['PHP_SELF'])
                          ."/console.php?".session_name()."=".session_id());
    					
    			exit;
    		}
    		if(!empty($aLoggin->Error))
    		{
    			$Error=$aLoggin->Error;
    			include ($_SERVER['DOCUMENT_ROOT']."/admin/error_report.php");
    			exit;
    		}
    	}
    	$InputError=$aLogging->InputError;
    	$UsernameClass="cell7";
    	$PassClass="cell7";
    	include ($_SERVER['DOCUMENT_ROOT']."/system/key_words.php");
    	include ($_SERVER['DOCUMENT_ROOT']."/system/key_sent.php");
    	include ($_SERVER['DOCUMENT_ROOT']."/system/messages.php");
    	include ($_SERVER['DOCUMENT_ROOT']."/system/generalconf.php");
    ?>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Login utenti</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link href="http://<?php echo $_SERVER['HTTP_HOST']."/cssstyles/".$CONSOLE_STYLE; ?>" rel="stylesheet" type="text/css">
    <style type="text/css">
    <!--
    .style3 {color: #FF9900}
    -->
    </style>
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_goToURL() { //v3.0
      var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
      for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
    }
    //-->
    </script>
    </head>
    
    <body class="BodyClass" onLoad="javascript: document.form1.Username.focus()">
      <table width="574" border="0" align="center" cellpadding="1" cellspacing="1" class="tablebg1">
      <form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
      <tbody>
        <tr>
          <td width="570"><table width="570" border="0" cellpadding="0" cellspacing="0" class="tablebg1">
              <tr class="cell7">
                <td height="20" colspan="2"><?php
    if (!empty($InputError))
    {
    	if(!empty($InputError['Username']))
    	{
    		$UsernameClass="cell5";
    	}
    	if(!empty($InputError['Pass']))
    	{
    		$PassClass="cell5";
    	}
    	$content ='<table width="570" border="0" cellpadding="0" cellspacing="0" class="tablebg1">';
    	$content.='<tr><td height="20" colspan="2" class="cell12">';
    	$content.=$WARNING_WORD.'</td></tr>';
    	$content.='<tr><td height="20" colspan="2" class="cell1"></td></tr>';
    	$content.='<tr><td height="20" width="40" align="center" class="cell7">[*]</td>';
    	if($InputError['Pass'] == 1)
    	{
    		$content.='<td height="20" width="530" align="center "class="cell7">'.$ERR_MESSAGE[5].'</td></tr>';
    	}
    	if($InputError['Status'] == 1)
    	{
    		$content.='<td height="20" width="530" align="center "class="cell7">'.$ERR_MESSAGE[6].'</td></tr>';
    	}
    	$content.='<tr><td height="20" colspan="2" class="cell7"></td></tr>';
    	$content.='<tr><td height="20" colspan="2" class="cell7">';
    	if(!empty($InputError['Status']))
    	{
    		$content.='Login failed</td></tr>';
    
    	}
    	else
    	{
    		$content.=''.$ERR_MESSAGE[4].'</td></tr>';
    	}
    	$content.='<tr><td height="20" colspan="2" class="cell1"></td></tr>';
    	$content.="</table>
    ";
    	echo $content;
    	if(!empty($InputError['Status']))
    	{
    		$str='</tr>
      </table>
    </form>
    </body>
    </html>';
    	echo $str;
    		exit;;
    	}
    }
    ?></td>
              </tr>
              <tr class="cell7">
                <td width="170" height="25" align="right" class="<?php echo $UsernameClass; ?>">Username:</td>
                <td width="400" height="25" class="cell7"> <input name="Username" type="text" class="input1" id="Username" value="<?php echo $_POST['Username']; ?>" maxlength="32"></td>
              </tr>
              <tr class="cell7">
                <td width="170" height="25" align="right" class="<?php echo $PassClass; ?>">Password:</td>
                <td width="400" height="25" class="cell7">
                <input name="Pass" type="password" class="input1" id="Pass" value="<?php echo $_POST['Pass']; ?>"></td>
              </tr>
              <tr class="cell7">
                <td height="20" colspan="2"></td>
              </tr>
              <tr align="center" class="cell7">
                <td height="20" colspan="2"><input name="Submit" type="submit" class="button1" value=" INVIA "></td>
              </tr>
              <tr class="cell7">
                <td height="20" colspan="2"></td>
              </tr>
          </table></td>
          </tr>
    	</tbody>
    	</form>
      </table>
    </body>
    </html>
    un tantino corposa vero?

  4. #4
    Utente di HTML.it
    Registrato dal
    Jun 2002
    Messaggi
    1,476

    Re: login in PHP da un SWF

    Originariamente inviato da JeanLucPicard
    ....
    codice:
    on (press, keyPress "<Enter>" ) {
    	invia=new LoadVars();
    	invia.Username=_root.Username;
    	invia.Pass=_root.Pass;
    //aggiungi questa riga.
            invia.Submit = true;
    	invia.send("login.php", "_blank", "POST");
    }
    Quando dall'swf inserisco username e password e premo "invia", mi si apre correttamente la pagina php e nei campi ci sono scritti l'username e la password ke ho inserito dall'swf. Il problema è ke devo premere "INVIA" anke dalla pagina php per proseguire con il login!

    Riassumendo grossolanamente: l'swf mi manda correttamente le variabili ma non mi preme "INVIA" nel php

    Dove sbaglio?
    Aggiungi allo script del pulsante la riga in GRASSETTO.


    dies

  5. #5
    VVoVe:

    GRAZIE!!!

  6. #6
    Utente di HTML.it
    Registrato dal
    Jun 2002
    Messaggi
    1,476
    funziona?






    dies

  7. #7
    sisisisi!
    grazie ancora!

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.