liebewinter: probleme mit nested...

Beitrag lesen

so wie der code auf ClassProveContakt.php habe...

<?php

 include 'ClassProveContakt.php';
 header('Content-Type: text/html; Charset=utf-8');
 mb_internal_encoding('UTF-8');
 date_default_timezone_set('Europe/Paris');
 error_reporting(-1);
 error_reporting(E_ALL)

 class ClassProveContakt {
    private $Name;
    private $Email;
    private $Message;

    function __construct() {
      $this->Name="";
      $this->Email="";
      $this->Message="";
    }

    function Form() {
     echo('<table>');
     echo('<label for="name">Name </label>');
     echo('<input type="text" name="Name" value="'.$this->Name.'">');
     echo('<label for="email"> Email </label>');
     echo('<input type="email" value="'.$this->Email.'" name="Email" ');
     echo('<tr>');
     echo('<td>');
     echo('<br>');
     echo('<label> Message: <br><textarea cols="45" rows="6" name="Message">'.$this->Message.'</textarea></label>');
     echo('<br><br>');
     echo('<input  type="submit" name="post" value="POST COMMENT" id="comment">');
     echo('</td>');
     echo('</tr>');
     echo('</table>');
   }


  function PostOk() {
      
      $file = "test.txt"; 
         
     
       
      if(empty($_POST['Name']) || empty($_POST['Email']) || empty($_POST['Message'])) {
        
        


          echo "<br>" . "<b>" . "<h3>*** Please enter all required fields ***</h3>" . "</b>";    

        

           if(isset($_POST["Name"]) && isset($_POST["Email"]) && isset($_POST["Message"]))
      
           {
              $this->Name=$_POST["Name"];
              $this->Email=$_POST["Email"];
              $this->Message=$_POST["Message"]; 
        

              $name = filter_input( INPUT_POST, 'Name', FILTER_SANITIZE_STRING);
              $email = filter_input(INPUT_POST, 'Email', FILTER_SANITIZE_STRING);
              $message = filter_input(INPUT_POST, 'Message', FILTER_SANITIZE_STRING);
              $datetime = date('m/d/Y h:i:s a', time());

       
        
              $data = array("name" => $name, "message" => $message, "datetime" => $datetime);

       
              $data = serialize($data);
	      file_put_contents($file, $data . "\n", FILE_APPEND|LOCK_EX);    
              }   
               $messages = file($file);
 
               foreach ($messages as $value) {
		   $data = unserialize($value);
                  
                echo "<br>"
                  . "<b>From: </b>" . htmlspecialchars( $data["name"])
                  . "<b> at: </b>" . htmlspecialchars( $data["datetime"])
                  . "<br><br>" . htmlspecialchars( $data["message"])
                  . "<br><hr>";
          }   
          
          if(isset($_POST["Name"]) && isset($_POST["Email"]) && isset($_POST["Message"]))
          {
            $me = "me.txt";

            $this->Name=$_POST["Name"];
            $this->Email=$_POST["Email"];
            $this->Message=$_POST["Message"]; 
        

            $name = filter_input( INPUT_POST, 'Name', FILTER_SANITIZE_STRING);
            $email = filter_input(INPUT_POST, 'Email', FILTER_SANITIZE_STRING);
            $message = filter_input(INPUT_POST, 'Message', FILTER_SANITIZE_STRING);
            $datetime = date('m/d/Y h:i:s a', time());

       
        
             $datas = array("name" => $name, "email" => $email, "message" => $message, "datetime" => $datetime);

       
             $datas = serialize($datas);
	     file_put_contents($me, $datas . "\n", FILE_APPEND|LOCK_EX);    
             }   
             $messages = file($me);
 
             foreach ($messages as $value) {
		   $datas = unserialize($value);
                  
               echo "<br>"
                . "<b>From: </b>" . htmlspecialchars( $datas["name"])
                . "<b> at: </b>" . htmlspecialchars( $datas["datetime"])
                . "<br><br>" . htmlspecialchars( $datas["email"])
                . "<br><br>" . htmlspecialchars( $datas["message"])
                . "<br><hr>";
              }   
          }
      }

}

 

?>

auf der Bownser mit diese adresse, localhost/index.php

bekome dieser fehler…

Parse error: syntax error, unexpected 'class' (T_CLASS) in /var/www/html/ClassProveContakt5.php on line 10