parse errors

Alles, was PHP betrifft, kann hier besprochen werden.

parse errors

Postby killerdicke » 23. July 2008 22:09

Was ist an diesen Codes falsch?


Code: Select all
<?php
if (!defined(DICKEWIKI)){
include(install.php);
}
class baseAPI  {
  $user;
  $ip;
  $referer;
  $target_user;
  function __construct () {
    $this->user=$_COOKIE["user"];
    $ip=new user;
    if (true===$ip->status($this->user, 0)){
      $this->ip=true;
    } else {
      $this->ip=false;
    }
    $this->referer=$_GET["referer"]
      if(0 != preg_match("/Benutzer:/", $this->referer)){
        $this->target_user=false; //E-Mail schicken, Benutzerdiskussionsseiten
      }
   protected function ip () {
    if (true===$this->ip){
      return true
    }
  }
}
}
?>


Parse error, unexpected T_VARIABLE, expecting T_FUNCTION in [...] on line 6.
Parse error, unexpected T_IF in [...] on line 19.

Kann mir das bitte jemand erklären?
killerdicke
 
Posts: 7
Joined: 01. March 2008 01:59

Postby Xardas der Dunkle » 24. July 2008 00:02

Machen wirs kurz: alles.
Klammern falsch gesetzt, Variablen Deklaration falsch.
Semikolons vergessen.
Formatierung total im Arsch :P

Code: Select all
<?php
if (!defined(DICKEWIKI)){
    include(install.php);
}
class baseAPI  {
    public $user;
    public $ip;
    public $referer;
    public $target_user;

    function __construct () {
        $this->user    = $_COOKIE["user"];
        $ip            = new user;
        $this->ip      = true === $ip->status($this->user, 0);
        $this->referer = $_GET["referer"];

        if(0 != preg_match("/Benutzer:/", $this->referer)){
            $this->target_user = false; //E-Mail schicken, Benutzerdiskussionsseiten
        }
    }

    protected function ip () {
        return true === $this->ip;
    }
}
?>
User avatar
Xardas der Dunkle
 
Posts: 482
Joined: 09. March 2008 19:40
Location: /var/www

Faulheit sollte man nicht unterstuetzen!

Postby guw » 25. July 2008 23:03

So lassen sich die Leute also ihre Studienaufgaben erledigen?
guw
 
Posts: 15
Joined: 22. July 2008 10:49


Return to PHP

Who is online

Users browsing this forum: No registered users and 1 guest