Ankündigung

Einklappen
Keine Ankündigung bisher.

passwort vergleich in Validierungs - class?

Einklappen

Neue Werbung 2019

Einklappen
X
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • passwort vergleich in Validierungs - class?

    Hallo an alle fleißigen,

    ich hab mal wieder ein Problem das ich nicht gelöst bekomme. Ich habe ein Formular das mittels Ajax und Php Validiert wird. Ich möchte nun die Eingabe der Passwörter vergleichen. Ich hab versucht eine Globale Variable anzulegen und die nach der Prüfung des ersten PW Feldes mit der übergebenen Variable zu "füttern", hab i net geschafft. Ich schaff es nicht zu Prüfen ob die beiden Felder übereinstimmen. Hab auch schon vversucht mit einer weiteren Session variablen zu arbeiten auch der Versuch leider negativ.

    Vielleicht kann mir ja einer von euch helfen. Hier mal Teile des Codes:


    PHP-Code:
    <?php
    // load database configuration and anti xss
    include('../include/anti_xss.inc.php5');
    require_once(
    '../configure/config.validate.inc.php5');

    $userpass = '';
      
    // Class supports AJAX and PHP web form validation 
    class Validate
    {
      var 
    $userpass;

      
    // stored database connection
      
    private $mMysqli;
      
      
    // constructor opens database connection
      
    function __construct()
      {
        
    $this->mMysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
      }

      
    // destructor closes database connection
      
    function __destruct()
      {
        
    $this->mMysqli->close();      
      }
        
      
    // supports AJAX validation, verifies a single value
      
    public function ValidateAJAX($inputValue, $fieldID)
      {
        
    // check which field is being validated and perform validation
        
    switch($fieldID)
        {
          
          
    // Check if the name is valid
          
    case 'txtName':
            return 
    $this->validateName($inputValue);
            break;
            
          
    // Check if the Vorname is valid
          
    case 'txtVorname':
            return 
    $this->validateVorname($inputValue);
            break;

    usw...
    ...
    ...

    HIER DIE STELLE MIT DER PRÜFUNG:

    // validate Pass
        
    private function validatePass($value)
      {
        
    // trim and escape input value    
        
    $value = trim($value);
        
    // empty user name is not valid
        
    if ($value){
          global 
    $userpass;
          
    $userpass = $value;
          return 
    1; // valid
        
    }
        else
          return 
    0; // not valid
      
    }

      
    // validate Pass2
        
    private function validatePass2($value)
      {
        
    // trim and escape input value    
        
    $value = trim($value);
        
    // empty user name is not valid
        
    global $userpass;
        if (
    $value && $value == $userpass) 
          return 
    1; // valid
        
    else
          return 
    0; // not valid
      
    }
    ?>
    Mein gedanke war halt nach Prüfung der ersten Eingabe diese in einer Variablen zu speichern. Ich schaff es nicht... Achso Google kenn ich und hab ich auch benutzt...

    Edit by Zergling: PHP-BBCode eingesetzt, bitte nächstes mal selbst machen.

  • #2
    Hallo,
    also die Problematik verstehe ich nicht. Wenn du Zugriff auf beide Variablen hast, kannst du strncasecmp() auf === 0 testen, denn dann sind beide übergebenen Strings gleich.

    Kommentar


    • #3
      Ägypten???

      Sorry mit der Aussage kann ich leider noch nichts anfangen.

      Kommentar


      • #4
        Schade. Verrätst du auch warum? Schlag die Funktion doch einfach mal im Handbuch nach ..

        Kommentar


        • #5
          strncasecmp()

          So ich hab mal nachgeschaut, ich glaub das bringt mir erst mal so nichts. Ich gebe in das erste PW Feld ein PW ein und beim verlassen(onblur="validate(this.value, this.id)) des Feldes wird geprüft (Ajax u Php) ob das Feld gefüllt ist. Es wird also meine Eingabe an das oben gezeigte script geschickt und geprüft. Ich habe keine Ahnung bzw ich habe noch nicht rausgefunden wie nach der Prüfung den eingegeben Wert in einer Variablen Speichern kann um dann nach onblur des zweiten PW Feldes diese Werte miteinander zu vergleichen. Ich hoffe das es jetzt verständlicher geworden ist was ich möchte.

          Kommentar


          • #6
            Du wirst doch wohl Zugriff auf die Formular-Eingaben bekommen!? Was benutzt du denn für ein Framework, wenn du damit nicht klarkommst?

            Kommentar


            • #7
              Re: strncasecmp()

              Zitat von rene.klatt
              onblur="validate(this.value, this.id)) des Feldes wird geprüft (Ajax u Php) ob das Feld gefüllt ist.
              Dieses Script hat mit dem oben gezeigten nicht viel zu tun, es der simple Aufruf einer JavaScript-Funktion. Hat vermutlich auch mit AJAX noch nicht viel zu tun.
              Wenn wir dir helfen sollen, musst du uns schon diese Script zeigen (Wäre allerdings vermutlich eher etwas zum Thema JS)

              Kommentar


              • #8
                Ich Benutze in diesem Fall gar keins. Wie soll ich denn aus dem Validierungsscript (php) auf die Formular eingaben auf der AnmeldeSeite zugreifen. Die daten werden asynchron an das Validierungsscript geschickt und dort geprüft und in diesem script heisst dann jede übergeben Variable $value, weil sie einzeln an das Validierungsscript beim verlassen des Feldes gesendet werden.

                Kommentar


                • #9
                  Den Teil mit dem js hab ich nur zur erklärung mit zu getan der Teil ist nicht mein Problem. Ich weis nicht wie ich an der Stelle wo der übergeben Wert geprüft wird(in PHP), den Wert in eine z.B. globale Variable der validierungs Klasse speichern kann.
                  Um dann bei der Prüfung des wdh Passwortes die beiden Werte zu vergleichen.

                  Kommentar


                  • #10
                    Zitat von rene.klatt
                    onblur="validate(this.value, this.id)) des Feldes wird geprüft (Ajax u Php) ob das Feld gefüllt ist.
                    Dieses Script hat mit dem oben gezeigten nicht viel zu tun, es der simple Aufruf einer JavaScript-Funktion. Hat vermutlich auch mit AJAX noch nicht viel zu tun.
                    Wenn wir dir helfen sollen, musst du uns schon diese Script zeigen (Wäre allerdings vermutlich eher etwas zum Thema JS)

                    Kommentar


                    • #11
                      Hier das Validierungsscript die betroffenen Stellen sind hervorgehoben:

                      PHP-Code:
                      <?php
                      class Validate
                      {
                        var 
                      $password;
                        
                      // stored database connection
                        
                      private $mMysqli;
                        
                        
                      // constructor opens database connection
                        
                      function __construct()
                        {
                          
                      $this->mMysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
                        }

                        
                      // destructor closes database connection
                        
                      function __destruct()
                        {
                          
                      $this->mMysqli->close();      
                        }
                          
                        
                      // supports AJAX validation, verifies a single value
                        
                      public function ValidateAJAX($inputValue, $fieldID)
                        {
                          
                      // check which field is being validated and perform validation
                          
                      switch($fieldID)
                          {
                            
                            
                      // Check if the name is valid
                            
                      case 'txtName':
                              return 
                      $this->validateName($inputValue);
                              break;
                              
                            
                      // Check if the Vorname is valid
                            
                      case 'txtVorname':
                              return 
                      $this->validateVorname($inputValue);
                              break;
                            
                            
                      // Check if the Position is valid
                            
                      case 'txtStrassePriv':
                              return 
                      $this->validateStrassePriv($inputValue);
                              break;
                            
                            
                      // Check if the Nummer is valid
                            
                      case 'txtNrPriv':
                              return 
                      $this->validateNrPriv($inputValue);
                              break;
                            
                            
                      // Check if the Plz is valid
                            
                      case 'txtPlzPriv':
                              return 
                      $this->validatePlzPriv($inputValue);
                              break;
                                  
                            
                      // Check if the Ort is valid
                            
                      case 'txtOrtPriv':
                              return 
                      $this->validateOrtPriv($inputValue);
                              break;
                                
                            
                      // Check if the Firma is valid
                            
                      case 'txtFirma':
                              return 
                      $this->validateFirma($inputValue);
                              break;
                            
                            
                      // Check if the Position is valid
                            
                      case 'txtPosition':
                              return 
                      $this->validatePosition($inputValue);
                              break;
                                        
                            
                      // Check if the username is valid
                            
                      case 'txtUsername':
                              return 
                      $this->validateUserName($inputValue);
                              break;
                            
                            
                      // Check if the Passwort is valid
                            
                      case 'txtPass':
                              return 
                      $this->validatePass($inputValue);
                              break;
                              
                            
                      // Check if the Passwort is valid
                            
                      case 'txtPass2':
                              return 
                      $this->validatePass2($inputValue);
                              break;
                                
                            
                      // Check if a gender was selected
                            
                      case 'selGender':
                              return 
                      $this->validateGender($inputValue);
                              break;
                              
                           
                      // Check if email is valid 
                            
                      case 'txtEmail':
                              return 
                      $this->validateEmail($inputValue);
                              break;
                              
                            
                      // Check if Web is valid 
                            
                      case 'txtWeb':
                              return 
                      $this->validateWeb($inputValue);
                              break;
                            
                            
                      // Check if "I have read the terms" checkbox has been checked
                            
                      case 'chkReadTerms':
                              return 
                      $this->validateReadTerms($inputValue);
                              break;
                          }
                        }
                        
                        
                      // validates all form fields on form submit
                        
                      public function ValidatePHP()
                        {
                          
                      // error flag, becomes 1 when errors are found.
                          
                      $errorsExist = 0;
                          
                      // clears the errors session flag    
                          
                      if (isset($_SESSION['errors']))
                            unset(
                      $_SESSION['errors']);
                          
                      // By default all fields are considered valid
                          
                      $_SESSION['errors']['txtName'] = 'hidden';
                          
                      $_SESSION['errors']['txtVorname'] = 'hidden';
                          
                      $_SESSION['errors']['txtStrassePriv'] = 'hidden';
                          
                      $_SESSION['errors']['txtNrPriv'] = 'hidden';
                          
                      $_SESSION['errors']['txtPlzPriv'] = 'hidden';
                          
                      $_SESSION['errors']['txtOrtPriv'] = 'hidden';
                          
                          
                      $_SESSION['errors']['txtFirma'] = 'hidden';
                          
                      $_SESSION['errors']['txtPosition'] = 'hidden';
                          
                          
                      $_SESSION['errors']['txtUsername'] = 'hidden';
                          
                      $_SESSION['errors']['txtPass'] = 'hidden';
                          
                      $_SESSION['errors']['txtPass2'] = 'hidden';
                          
                      $_SESSION['errors']['selGender'] = 'hidden';
                          
                      $_SESSION['errors']['txtEmail'] = 'hidden';
                          
                      $_SESSION['errors']['txtWeb'] = 'hidden';
                          
                          
                      $_SESSION['errors']['chkReadTerms'] = 'hidden';
                          
                          
                      // Validate name
                          
                      if (!$this->validateName($_POST['txtName']))
                          {
                            
                      $_SESSION['errors']['txtName'] = 'error';
                            
                      $errorsExist = 1;
                          }
                          
                          
                      // Validate Vorname
                          
                      if (!$this->validateVorname($_POST['txtVorname']))
                          {
                            
                      $_SESSION['errors']['txtVorname'] = 'error';
                            
                      $errorsExist = 1;
                          }
                          
                          
                      // Validate StrassePriv
                          
                      if (!$this->validateStrassePriv($_POST['txtStrassePriv']))
                          {
                            
                      $_SESSION['errors']['txtStrassePriv'] = 'error';
                            
                      $errorsExist = 1;
                          }
                          
                          
                      // Validate NummerPriv
                          
                      if (!$this->validateNrPriv($_POST['txtNrPriv']))
                          {
                            
                      $_SESSION['errors']['txtNrPriv'] = 'error';
                            
                      $errorsExist = 1;
                          }
                          
                          
                      // Validate PlzPriv
                          
                      if (!$this->validatePlzPriv($_POST['txtPlzPriv']))
                          {
                            
                      $_SESSION['errors']['txtPlzPriv'] = 'error';
                            
                      $errorsExist = 1;
                          }
                          
                          
                      // Validate OrtPriv
                          
                      if (!$this->validateOrtPriv($_POST['txtOrtPriv']))
                          {
                            
                      $_SESSION['errors']['txtOrtPriv'] = 'error';
                            
                      $errorsExist = 1;
                          }
                          
                          
                          
                      // Validate Firma
                          
                      if (!$this->validateFirma($_POST['txtFirma']))
                          {
                            
                      $_SESSION['errors']['txtFirma'] = 'error';
                            
                      $errorsExist = 1;
                          }
                          
                          
                      // Validate Position
                          
                      if (!$this->validatePosition($_POST['txtPosition']))
                          {
                            
                      $_SESSION['errors']['txtPosition'] = 'error';
                            
                      $errorsExist = 1;
                          }
                          
                          
                      // Validate username
                          
                      if (!$this->validateUserName($_POST['txtUsername']))
                          {
                            
                      $_SESSION['errors']['txtUsername'] = 'error';
                            
                      $errorsExist = 1;
                          }
                          
                          
                      // Validate Pass
                          
                      if (!$this->validatePass($_POST['txtPass']))
                          {
                            
                      $_SESSION['errors']['txtPass'] = 'error';
                            
                      $errorsExist = 1;
                          }
                          
                          
                      // Validate Pass2
                          
                      if (!$this->validatePass2($_POST['txtPass2']))
                          {
                            
                      $_SESSION['errors']['txtPass2'] = 'error';
                            
                      $errorsExist = 1;
                          }
                              
                          
                      // Validate gender
                          
                      if (!$this->validateGender($_POST['selGender']))
                          {
                            
                      $_SESSION['errors']['selGender'] = 'error';
                            
                      $errorsExist = 1;
                          }
                              
                          
                      // Validate email
                          
                      if (!$this->validateEmail($_POST['txtEmail']))
                          {
                            
                      $_SESSION['errors']['txtEmail'] = 'error';
                            
                      $errorsExist = 1;
                          }
                          
                          
                      // Validate Web
                          
                      if (!$this->validateWeb($_POST['txtWeb']))
                          {
                            
                      $_SESSION['errors']['txtWeb'] = 'error';
                            
                      $errorsExist = 1;
                          }
                            
                          
                      // Validate read terms
                          
                      if (!isset($_POST['chkReadTerms']) || 
                              !
                      $this->validateReadTerms($_POST['chkReadTerms']))
                          {
                            
                      $_SESSION['errors']['chkReadTerms'] = 'error';
                            
                      $_SESSION['values']['chkReadTerms'] = '';
                            
                      $errorsExist = 1;
                          }

                          
                      // If no errors are found, point to a successful validation page
                          
                      if ($errorsExist == 0)
                          {    
                          
                              
                      $gender         = kill_xss_ext($_POST['selGender']);
                              
                      $name             = kill_xss_ext($_POST['txtName']);
                              
                      $vorname         = kill_xss_ext($_POST['txtVorname']);
                              
                      $strassepriv     = kill_xss_ext($_POST['txtStrassePriv']);
                              
                      $nrpriv         = kill_xss_ext($_POST['txtNrPriv']);
                              
                      $plzpriv        = kill_xss_ext($_POST['txtPlzPriv']);
                              
                      $ort            = kill_xss_ext($_POST['txtOrtPriv']);
                              
                      $bthmonth        = kill_xss_ext($_POST['selBthMonth']);
                              
                      $bthday            = kill_xss_ext($_POST['selBthDay']);
                              
                      $bthyear        = kill_xss_ext($_POST['txtBthYear']);
                              
                              
                      $firma            = kill_xss_ext($_POST['txtFirma']);
                              
                      $position         = kill_xss_ext($_POST['txtPosition']);
                                      
                              
                      $user            = kill_xss_ext($_POST['txtUsername']);
                              
                      $pass            = kill_xss_ext($_POST['txtPass']);
                              
                      $pass            = md5($pass);
                              
                              
                      $email            = kill_xss_ext($_POST['txtEmail']);
                              
                      $web            = kill_xss_ext($_POST['txtWeb']);
                              
                              
                      $readterms        = kill_xss_ext($_POST['chkReadTerms']);
                              
                      $datum            = date('Ymd');
                                          
                              
                      $query = $this->mMysqli->query("INSERT INTO user (user, pw, gender, name, vorname, anm_datum) VALUES ('$user', '$pass', '$gender', '$name', '$vorname', '$datum')");

                              
                      $lastInsertID = $this->mMysqli->insert_id;

                              
                      $query2 = $this->mMysqli->query("INSERT INTO user_contact (user_id, strasse, nummer, plz, ort, email, website) VALUES ('$lastInsertID', '$strassepriv', '$nrpriv', '$plzpriv', '$ort', '$email', '$web')");
                              
                              
                      $query3 = $this->mMysqli->query("INSERT INTO user_firma_1 (user_id, firma, position) VALUES ('$lastInsertID',  '$firma', '$position')");
                              
                              
                          
                      $Empfaenger = $email;

                          
                      $header  = 'MIME-Version: 1.0' . "\r\n";
                          
                      $header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
                          
                      $header .= 'From: ###' . "\r\n";
                          
                      $header .= 'To: ' . $Empfaenger . "\r\n";
                          
                      $header .= 'X-Mailer: PHP/' . phpversion();
                          
                      $Mailnachricht = '<html>
                                          <head>
                                              <title>Mail - Berliner-Macher</title>
                                          </head>
                                          <body>
                                              <h2>Best&auml;tigungsmail von Berliner-Macher</h2>
                                              

                      Hallo ' 
                      . $vorname . ' ' . $name . '</p> 
                                              

                      Vielen Dank für Ihre Anmeldung bei ###.</p>
                                              

                      Diese Nachricht wurde automatisch am ' 
                      . date("d.m.Y") . ' um ' . date("H:i:s") . ' an Sie gesendet.</p>
                                              

                      Zur Aktivierung Ihres Accounts klicken Sie bitte auf diesen Link:

                                                  [url="###"]Anmeldung best&auml;tigen[/url]</p>
                                                  

                      Sollten Sie sich nicht bei Berliner-Macher angemeldet haben, klicken Sie bitte auf diesen Link:

                                                  [url="###"]Account L&ouml;schen[/url]</p>
                                                  

                                                  

                      Bitte antworten Sie nicht auf diese Mail, benutzen Sie die obenstehenden Links.</p>
                                              </body>
                                              </html>'
                      ;
                              
                      $Mailbetreff = 'Betreff: Anmeldung bei ###';
                              
                      mail($Empfaenger, $Mailbetreff, $Mailnachricht, $header);
                                  return 
                      '../regok.php5';
                          }
                          else
                          {
                            
                      // If errors are found, save current user input
                            
                      foreach ($_POST as $key => $value)
                            {
                              
                      $_SESSION['values'][$key] = $_POST[$key];
                            }
                            return 
                      '../anmeldung.php5';
                          }
                        }

                        
                      // validate name
                       
                        
                      private function validateName($value)
                        {
                          
                      // trim and escape input value    
                          
                      $value = trim($value);
                          
                      // empty user name is not valid
                         
                      if (!empty($value) && !is_numeric($value)) 
                            return 
                      1; // valid
                          
                      else
                            return 
                      0; // not valid
                        
                      }
                        
                        
                      // validate Vorname
                       
                        
                      private function validateVorname($value)
                        {
                          
                      // trim and escape input value    
                          
                      $value = trim($value);
                          
                          
                      // empty user name is not valid
                          
                      if (!empty($value) && !is_numeric($value)) 
                            return 
                      1; // valid
                          
                      else
                            return 
                      0; // not valid
                        
                      }
                        
                        
                      // validate StrassePriv
                          
                      private function validateStrassePriv($value)
                        {
                          
                      // trim and escape input value    
                          
                      $value = trim($value);
                          
                      // empty user name is not valid
                          
                      if (!empty($value) && !is_numeric($value)) 
                            return 
                      1; // valid
                          
                      else
                            return 
                      0; // not valid
                        
                      }
                        
                        
                      // validate NrPriv
                          
                      private function validateNrPriv($value)
                        {
                          
                      // trim and escape input value    
                          
                      $value = trim($value);
                          
                      // empty user name is not valid
                          
                      if (is_numeric($value) && !empty($value)) 
                            return 
                      1; // valid
                          
                      else
                            return 
                      0; // not valid
                        
                      }
                        
                        
                      // validate PlzPriv
                          
                      private function validatePlzPriv($value)
                        {
                          
                      // trim and escape input value    
                          
                      $value = trim($value);
                          
                      // empty user name is not valid
                          
                      if (is_numeric($value)){
                             return 
                      1; // valid
                          
                      }else{
                            return 
                      0; // not valid
                          
                      }
                        }
                        
                        
                      // validate OrtPriv
                          
                      private function validateOrtPriv($value)
                        {
                          
                      // trim and escape input value    
                          
                      $value = trim($value);
                          
                      // empty user name is not valid
                          
                      if (!is_numeric($value) && !empty($value)) 
                            return 
                      1; // valid
                          
                      else
                            return 
                      0; // not valid
                        
                      }
                        
                        
                        
                        
                      // validate Firma
                       
                        
                      private function validateFirma($value)
                        {
                          
                      // trim and escape input value    
                          
                      $value = trim($value);
                          
                      // empty user name is not valid
                          
                      if (!is_numeric($value) && !empty($value)) 
                            return 
                      1; // valid
                          
                      else
                            return 
                      0; // not valid
                        
                      }
                        
                        
                      // validate Position
                         
                      private function validatePosition($value)
                        {
                          
                      // trim and escape input value    
                          
                      $value = trim($value);
                          
                      // empty user name is not valid
                           
                      if (!is_numeric($value) && !empty($value)) 
                            return 
                      1; // valid
                          
                      else
                            return 
                      0; // not valid
                        
                      }
                        
                        
                      // validate user name (must be empty, and must not be already registered)
                        
                      private function validateUserName($value)
                        {
                          
                      // trim and escape input value    
                          
                      $value = $this->mMysqli->real_escape_string(trim($value));
                          
                      // empty user name is not valid
                          
                      if ($value == null) 
                            return 
                      0; // not valid
                          // check if the username exists in the database
                          
                      $query = $this->mMysqli->query('SELECT user_name FROM macher ' .
                                                         
                      'WHERE user_name="' . $value . '"');
                          if (
                      $this->mMysqli->affected_rows > 0)
                            return 
                      '0'; // not valid
                          
                      else
                            return 
                      '1'; // valid
                        
                      }

                       [
                      b] // validate Pass
                          
                      private function validatePass($value)
                        {
                          
                      // trim and escape input value    
                          
                      $value = trim($value);
                          
                      // empty user name is not valid
                          
                      if ($value){
                            
                      $this->password = $value;
                            return 
                      1; // valid
                          
                      }
                          else
                            return 
                      0; // not valid
                        
                      }

                        
                      // validate Pass2
                          
                      private function validatePass2($value)
                        {
                          
                      // trim and escape input value    
                          
                      $value = trim($value);
                          
                      // empty user name is not valid

                          
                      if ($this->password == $value) {
                            return 
                      1; // valid
                          
                      }
                          else
                            return 
                      0; // not valid
                        
                      }[/b]
                        
                        
                      // validate gender 
                        
                      private function validateGender($value)
                        {
                          
                      // user must have a gender
                          
                      return ($value == '0') ? 0 : 1;
                        }  

                        
                      // validate email
                        
                      private function validateEmail($value)
                        {
                          
                      // valid email formats: *@*.*, *@*.*.*, *.*@*.*, *.*@*.*.*)
                          
                      return (!eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$', $value)) ? 0 : 1;
                        }
                        
                        
                      // validate Web
                          
                      private function validateWeb($value)
                        {
                          
                      // trim and escape input value    
                          
                      $value = trim($value);
                          
                      // empty user name is not valid
                           
                      if (!is_numeric($value) && !empty($value)) 
                            return 
                      1; // valid
                          
                      else
                            return 
                      0; // not valid
                        
                      }
                          
                        
                      // check the user has read the terms of use
                        
                      private function validateReadTerms($value)
                        {
                          
                      // valid value is 'true'
                       
                          
                      return ($value == 'true' || $value == 'on') ? 1 : 0;
                        }
                      }
                      ?>

                      Kommentar


                      • #12
                        Solange du mir nicht zeigen kannst, wo du diese Klasse instanzierst, glaube ich dir auch nicht, dass auch nur etwas von diesem Code ausgeführt wird. Das was du bis jetzt gezeigt hast ist (wie ich irrtümlich schon zwei mal geschrieben habe, Sorry) nur der Aufruf einer JS-Funktion.
                        Und so nebenbei, unfomatierten und nicht eingerückten Code schaue ich nicht an (und in diesem Umfang erst recht nicht). Beschränke dich bitte auf die wesentlichen Stellen und benutze PHP-Tags

                        Kommentar


                        • #13
                          Hier ein Teil der JS Datei, diese

                          Code:
                          function validate(inputValue, fieldID)
                          {
                            // only continue if xmlHttp isn't void
                            if (xmlHttp)
                            {
                              // if we received non-null parameters, we add them to cache in the
                              // form of the query string to be sent to the server for validation
                              if (fieldID)
                              {
                                // encode values for safely adding them to an HTTP request query string
                                inputValue = encodeURIComponent(inputValue);
                                fieldID = encodeURIComponent(fieldID);
                                // add the values to the queue
                                cache.push("inputValue=" + inputValue + "&fieldID=" + fieldID);
                              }
                              // try to connect to the server
                              try
                              {
                                // continue only if the XMLHttpRequest object isn't busy
                                // and the cache is not empty
                                if ((xmlHttp.readyState == 4 || xmlHttp.readyState == 0) 
                                   && cache.length > 0)
                                {
                                  // get a new set of parameters from the cache
                                  var cacheEntry = cache.shift();
                                  // make a server request to validate the extracted data
                                  xmlHttp.open("POST", serverAddress, true);
                                  xmlHttp.setRequestHeader("Content-Type", 
                                                           "application/x-www-form-urlencoded");
                                  xmlHttp.onreadystatechange = handleRequestStateChange;
                                  xmlHttp.send(cacheEntry);
                                }
                              }
                              catch (e)
                              {
                                // display an error when failing to connect to the server
                                displayError(e.toString());
                              }
                            }
                          }
                          und hier das validate.php script:

                          PHP-Code:
                          <?php
                          session_start
                          ();
                          require_once (
                          'error_handler.php5');
                          require_once (
                          'validate.class.php5');
                            

                          $validator = new Validate();


                          $validationType = '';  
                          if (isset(
                          $_GET['validationType']))
                          {
                            
                          $validationType = $_GET['validationType'];
                          }

                          // AJAX validation or PHP validation?
                          if ($validationType == 'php')
                          {
                             
                          header("Location:" . $validator->ValidatePHP());
                          }
                          else
                          {
                             
                          $response = 
                             
                          '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' .
                             
                          '<response>' .
                               
                          '<result>' .
                                 
                          $validator->ValidateAJAX($_POST['inputValue'], $_POST['fieldID']) .
                               
                          '</result>' .
                               
                          '<fieldid>' .
                                 
                          $_POST['fieldID'] .  
                               
                          '</fieldid>' .
                             
                          '</response>'; 
                            if(
                          ob_get_length()) ob_clean();
                            
                          header('Content-Type: text/xml');
                            echo 
                          $response;
                          }
                          ?>
                          Ich hoffe ich hab euch jetzt die Notwendigen Teile gereicht.

                          Kommentar


                          • #14
                            Bitte benutzt PHP-BBCode, vorher schau ich mir das nicht mehr an.

                            Kommentar


                            • #15
                              Sei mir mal nicht böse Zergling, aber solche Antworten find ich persönlich echt nicht in ordnung. Schreib doch gleich mal genau was Du wie gern hättest. Wenn du schon nach weiteren Teilen des Codes fragst dann sag mir doch bitte gleich das ich die betroffenen Stellen hervorheben soll. Dann mach ich das auch gerne, ich bin ja schliesslich der der die Hilfe braucht also versuch ich es euch auch einfach zu machen. Ich werd jetzt die einträge von mir noch mal sauberer darstellen. Ich hoffe ihr helft mir dann weiter.

                              Kommentar

                              Lädt...
                              X