Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    [PHP] Problema con controlli

    CIao a tutti,

    sono a dire poco molto confuso su come fare funzionare questa mia funzione, non riesco a capire come devo impostare i controlli:


    Codice PHP:
    // Funzione cambia password

    function newPass() {
    if(isset(
    $newpass1) && isset($newpass2)) {
        
        
    $newpass1 $_POST['newPass1'];
        
    $newpass2 $_POST['newPass2'];
            if(
    $newpass1 == $newpass2) {
            include
    "config.inc.php";
            
    mysql_select_db($database_name$conn) or die (mysql_error());
            
    $sql "UPDATE tb_login SET lg_pwd = '" md5($newpass1) ."' WHERE lg_id = '" $_GET['usr'] . "'";
            
    $query mysql_query($sql) or die (mysql_error());
            
    $msg_pwd "Password cambiata con successo";
            
    } else {
            
    $msg_pwd "la password non corrisponde";
        }
    } else {
    $msg_pwd "errore";
    }
    echo 
    "<form name='form1' method='post' action=''>";
    echo 
    "<table width='500' border='0' align='center' cellpadding='0' cellspacing='0'>";
    echo 
    "<tr>";
    echo 
    "<td colspan='3' class='Text'></td>";
    echo 
    "</tr>";
    echo 
    "<tr>";
    echo 
    "<td colspan='3' class='Text'></td>";
    echo 
    "</tr>";
    echo 
    "<tr>";
    echo 
    "<td width='200' class='Text'>New Password:</td>";
    echo 
    "<td width='150' class='Text'><input type='text' name='newPass1' id='newPass1'></td>";
    echo 
    "<td class='Text'>

    </p></td>"
    ;
    echo 
    "</tr>";
    echo 
    "<tr>";
    echo 
    "<td class='Text'>Confirm New Password:</td>";
    echo 
    "<td class='Text'><input type='text' name='newPass2' id='newPass2'></td>";
    echo 
    "<td class='Text'></td>";
    echo 
    "</tr>";
    echo 
    "<tr>";
    echo 
    "<td class='Text'></td>";
    echo 
    "<td class='Text'><input type='submit' name='newpwd' id='newpwd' value='Submit'></td>";
    echo 
    "<td class='Text'></td>";
    echo 
    "</tr>";
    echo 
    "<tr>";
    echo 
    "<td class='Text'></td>";
    echo 
    "<td class='Text'></td>";
    echo 
    "<td class='Text'></td>";
    echo 
    "</tr>";
    echo 
    "<tr>";
    echo 
    "<td colspan='3' class='Text'>";
    if (isset(
    $msg_pwd)) { echo $msg_pwd; }
    echo 
    "</td>";
    echo 
    "</tr>";
    echo 
    "</table>";
    echo 
    "</form>";

    Non funziona correttamente mi da sempre errore??

    Mi dareste una mano gentilmente!

    Grazie Michel
    PHP THE BEST

  2. #2
    dovresti rivedere la tua funzione. Usi dei valori su variabili che non passi alla funzione stessa per cui non hanno la dovuta visibilita' e manca poi il return di un qualcosa dalla funzione stessa.

    http://it.php.net/manual/it/language...s.user-defined

    Il silenzio è spesso la cosa migliore. Pensa ... è gratis.

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 © 2024 vBulletin Solutions, Inc. All rights reserved.