Fatal error: Call to a member function CheckName() on a non-object


Divo1984

Erfahrenes Mitglied
Guten Morgen,

ich hab mal wieder nen Prob, wo ich net weiter weiß...

Ich habe folgende Klassen:

PHP:
<?php
require_once 'class/sub_classes/class_ReceiverManager.php';
require_once 'class/sub_classes/class_eMailManager.php';
class Register{
	public $regerror;
	public $vnameerror;
	public $nnameerror;
	public $emailerror;
	public $katerror;
	public function construct($db){
		if(is_object($db))
			$this->db=$db;
		
		$this->receiver=new ReceiverManager($this->db);
		$this->email=new eMailManager($this->db);
		
		$this->regerror=TRUE;
		$this->vnameerror="";
		$this->nnameerror="";
		$this->katerror="";
	}
	
	public function CheckEntries($vname, $nname,$email, $kat1, $kat2, $kat3, $kat4){
		if(($this->receiver->CheckName($vname))!==TRUE){
			$this->vnameerror="Der Vorname hat zu wenig Zeichen!<br>";
		}if(($this->receiver->CheckName($nname))!==TRUE){
			$this->nnameerror="Der Nachname hat zu wenig Zeichen!<br>";
		}if(($this->email->eMailExist($email))!==TRUE){
			$this->emailerror="Diese eMail ist bereits registriert!<br>";
		}elseif(($this->email->ValidateeMail($email))!==TRUE){
			$this->emailerror="Ihre eMail hat einen falschen Syntax!<br>";
		}if(($this->receiver->CheckKats($kat1, $kat2, $kat3, $kat4))!==TRUE){
			$this->katerror="Bitte wählen Sie mindestens 1 Kategorie!<br>";
		}else{
			$this->regerror=FALSE;
		}
		
		return $this->regerror;
		return $this->vnameerror;
		return $this->nnameerror;
		return $this->emailerror;
		return $this->katerror;
	}
	
	public function RegUser($vname, $nname, $email, $code){
		$a=$this->db->conn();
		$stmt=$a->prepare("INSERT INTO b_receiver(u_vname, u_nname, u_email, u_code)
										   VALUES(?, ?, ?, ?)");
		$stmt->bind_param("ssss", $vname, $nname, $email, $code);
		$stmt->execute();
		if($stmt->affected_rows>0){
			return TRUE;
		}
		return FALSE;
	}
	
	
}
?>

und

PHP:
<?php
class ReceiverManager{
	public function __construct($db){
		if(is_object($db))
			$this->db=$db;
	}
	
	public function CheckName($name){
		if(strlen($name)<3){
			return FALSE;
		}
		return TRUE;
	}
	
	public function CheckKats($kat1, $kat2, $kat3, $kat4){
		if(($kat1!=1) && ($kat2!=1) && ($kat3!=1) && ($kat4!=1)){
			return FALSE;
		}
		return TRUE;
	}
	
	
}
?>

aufgerufen wird das ganze so:

PHP:
<?php 
require_once 'class/sub_classes/class_DB.php';
$db=new DB();
require_once 'class/main_classes/class_Register.php';
$reg=new Register($db);
include_once 'inc/header.php';
?>
Text<br><br>
Text<br><br>
Text<br><br>
Text<br><br>
			
<?php 
include_once 'inc/footer.php';
?>

der header schau so aus:

PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Service-Gruler.de</title>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta name="copyright" content="Jan-Christoph Brier, JC-Media">
<link rel="stylesheet" href="./style/style.css" type="text/css">
<link rel="shortcut icon" href="Favicon.ico" type="image/x-icon"> 
<!--[if IE 9]>
<link rel="stylesheet" type="text/css" href="./style/ie9.css">
<![endif]-->

<script type="text/javascript">
if (navigator.userAgent.toLowerCase().indexOf('chrome')!=-1){
    document.write('<link rel="stylesheet" type="text/css" href="./style/chrome.css"/>');                    
}
</script>

<?php 
  if(preg_match('/Opera(?:\/| )(\S+)/', $_SERVER['HTTP_USER_AGENT'], $operaVersion)) { echo("<link rel=\"stylesheet\" type=\"text/css\" href=\"./style/opera.css\"/>"); } 
 ?>
</head>
<body>
<div id="body">
	<div id="head">
		<div class="links">
        <a href="index.php" class="links_on_head">Startseite</a> | 
        <a href="referenzen.php" class="links_on_head">Referenzen</a> |  
        <a href="ueber_uns.php" class="links_on_head">&Uuml;ber uns</a> | 
        <a href="kontakt.php" class="links_on_head">Kontakt</a> | 
        <a href="agb.php" class="links_on_head">AGB</a> |
        <a href="impressum.php" class="links_on_head">Impressum</a> </div>
	</div>
	<div id="content">
		<div class="content">
			<!-- Header Kategorien -->
			<div id="head_kats">
				<div class="head_kat1"><a href="#"></a></div>
				<div class="head_kat2"><a href="#"></a></div>
				<div class="head_kat3"><a href="#"></a></div>
				<div class="head_kat4"><a href="#"></a></div>
			</div>
			<!-- Header Texte in den Kategorien -->
			<div id="head_text">
				<div class="head_text1"><br>
					<img src="design/list_arrow.png" alt="pfeil"> <a href="#" class="links_on_kats">PC Neukauf</a><br>
					<img src="design/list_arrow.png" alt="pfeil"> <a href="#" class="links_on_kats">PC Reparatur</a><br>
					<img src="design/list_arrow.png" alt="pfeil"> <a href="#" class="links_on_kats">PC Erweiterung</a><br>
					<img src="design/list_arrow.png" alt="pfeil"> <a href="#" class="links_on_kats">PC Fernwartung</a><br>
                    <br>
                    <div id="right"> <a href="#" class="links_on_kats_details">Details...</a></div>
				</div>
				<div class="head_text2"><br>
					<img src="design/list_arrow.png" alt="pfeil"> <a href="#" class="links_on_kats">mit dem Lesen von eMails</a><br>
                    <img src="design/list_arrow.png" alt="pfeil"> <a href="#" class="links_on_kats">mit dem Verkauf von eBooks</a><br>
					<img src="design/list_arrow.png" alt="pfeil"> <a href="#" class="links_on_kats">durch Online-Shopping</a><br>
                    <br>
                    <br>
                    <div id="right"> <a href="#" class="links_on_kats_details">Details...</a></div>
				</div>
				<div class="head_text3"><br>
					<img src="design/list_arrow.png" alt="pfeil"> <a href="#" class="links_on_kats">Private Homepage</a><br>
                    <img src="design/list_arrow.png" alt="pfeil"> <a href="#" class="links_on_kats">Firmenwebsite</a><br>
					<img src="design/list_arrow.png" alt="pfeil"> <a href="#" class="links_on_kats">Referrals für Paid4-Dienste</a><br>
					<img src="design/list_arrow.png" alt="pfeil"> <a href="#" class="links_on_kats">sonstiges</a><br>
                    <br>
                    <div id="right"> <a href="#" class="links_on_kats_details">Details...</a></div>
				</div>
				<div class="head_text4"><br>
					<img src="design/list_arrow.png" alt="pfeil"> <a href="#" class="links_on_kats">Was sind eBooks ?</a><br>
					<img src="design/list_arrow.png" alt="pfeil"> <a href="#" class="links_on_kats">Informationen</a><br>
                    <img src="design/list_arrow.png" alt="pfeil"> <a href="#" class="links_on_kats">Sortiment</a><br>
                    <img src="design/list_arrow.png" alt="pfeil"> <a href="#" class="links_on_kats">Informationen</a><br>
                    <br>
                    <div id="right"> <a href="#" class="links_on_kats_details">Details...</a></div>
				</div>
			</div>
		</div>
		<!-- Hier kann Text definiert werden -->
		<div id="cont">
			<table border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td style="vertical-align:top; width:229px">
					<div style="margin-left:25px; margin-top:-8px; color:#ffffff; font-size:8pt; font-weight:bold;">
					<!-- Navi Überschrift -->
					<center>Newsletter-Eintrag</center></div>
				  <div style="margin-left:22px; margin-top:20px; color:#000000; text-align:justify; ">
						<!-- Navi Text -->
						<?php
						if(isset($_POST['register'])){
							//Registrierungsvorgang
							$reg->CheckEntries($_POST['vname'], $_POST['nname'], $_POST['email'], $_POST['kat1'], $_POST['kat2'], $_POST['kat3'], $_POST['kat4']);
							if(($reg->regerror)!==TRUE){
								echo $reg->vnameerror;
								echo $reg->nnameerror;
								echo $reg->emailerror;
								echo $reg->katerror;
								
								echo"<input type=\"hidden\" name=\"vname\" value=\"".$_POST['vname']."\"><br>";
								echo"<input type=\"hidden\" name=\"nname\" value=\"".$_POST['nname']."\"><br>";
								echo"<input type=\"hidden\" name=\"email\" value=\"".$_POST['email']."\"><br>";
								
								echo"<input type=\"submit\" name=\"back\" value=\"Zurück\"><br>";
							}
						}else{
							include_once 'forms/navi/formular.php';
						}

						?>
						<!-- Navi Inhalt Ende -->
						</div></td><td style="width:45px;"></td><td style="vertical-align:top; width:700px;">

in dem include, im header - befindet sich ein Formular über welches die Funktionen aufgerufen werden sollen - leider kommt sobald ich den Button drücke folgende Meldung:

Fatal error: Call to a member function CheckName() on a non-object in Pfad/class/main_classes/class_Register.php on line 24

nur verstehe ich nicht warum?!! Kann mir jmd. sagen, wo mein Denkfehler liegt?
 

Forum-Statistiken

Themen
272.363
Beiträge
1.558.641
Mitglieder
187.836
Neuestes Mitglied
MMazi