Scripts

KNVB ripper class

Hieronder heb ik een knvbripper neergezet na een vraag van iemand hier op het forum. Het is een class die ik al een tijdje voor me eigen website gebruik. Het is exact dezelfde als op www.sitemasters.be maar vanwege een kleine aanpassing op de KNVB website werkte de Ripper niet optimaal. De ripper werkt namelijk soms wel en soms niet doordat knvb.nl elke keer in de lange url 1 letter veranderd in een hoofdletter en dan weer niet. Dit heb ik opgelost door de ripper automatisch te laten vernieuwen tot hij informatie geeft. Om te voorkomen dat je lange laadtijden krijgt op je website is het handig om de informatie die de class ript meteen in een database weg te schrijven en vervolgens de informatie te publiceren vanuit de database Nogmaals. Het script is niet van mij, maar mag volgens de eigenaar vrij gebruikt/aangepast worden

knvb-ripper-class
class.knvb.php
[code]
<?php 
include 'class.socket.php'; 

class KnvbRipper 
{ 
    protected $contents; 
    protected $email; 
    protected $password; 
    protected $club_url; 
    protected $mode; 
    protected $errors; 
    protected $output; 

    public function __construct($email, $password, $club_url, $mode = 'uitslagen') 
    { 
        $this -> email = $email; 
        $this -> password = $password; 
        $this -> club_url = $club_url; 
        $this -> mode = $mode; 
        $this -> errors = array(); 
    } 

    protected function get_contents() 
    { 
        if(!empty($this -> contents)) 
        { 
            return; 
        } 

        // Log in on knvb.nl 
        $post = new HttpPostRequest(); 
        $post -> set_ip("www.knvb.nl", 80); 
        $post -> set_file("mijn"); 
        $post -> add_var("method", "login"); 
        $post -> add_var("email", $this -> email); // Je email 
        $post -> add_var("password", $this -> password); // je wachtwoord 
        $post -> include_headers(); 
        $post -> use_redirect(false); 
        if($post -> request()) 
        {    
            // Ok, we logged in now on knvb.nl 
            // Get ranking now 
            $get = new HttpGetRequest(); 
            $get -> set_ip("www.knvb.nl", 80); 
            // Zet hier onder de URL van je team pagina 
            $get -> set_file($this -> club_url); 
            $get -> include_headers(); 
            
            // Get cookies setted by the login page 
            $cookies = $post -> get_cookies(); 
            foreach($cookies as $name => $value) 
            { 
                $get -> set_cookie($name, $value); 
            } 
            
            if($get -> request()) 
            { 
                $this -> contents = $get -> get_contents(); 
                return true; 
            } 
            else 
            { 
                $this -> errors[] = $get -> get_error(); 
                return false; 
            } 
        } 
        else 
        { 
            $this -> errors[] = $post -> get_error(); 
            return false; 
        } 

        return false; 
    } 

    protected function parse() 
    { 
        switch($this -> mode) 
        { 
            case 'uitslagen': 
                list(, $contents) = explode('<td width="100%" align="left" valign="middle" class="Agreenheader">Uitslagen</td>', $this -> contents); 
                list($contents) = explode('<td class="Agreenheader">Stand_ </td>', $contents); 

                preg_match_all('#<tr( class="clubselectie")?>(\s+)<td class="scoretd">(.*?)</td>(\s+)<td class="scoretd">(.*?)</td>(\s+)<td class="scoretd">(.*?)</td>(\s+)<td class="scoretd">(.*?)(\s+)</td>(\s+)</tr>#si', $contents, $matches, PREG_SET_ORDER); 
                 
                $this -> output = array(); 
                $i = 0; 
                foreach($matches as $info) 
                { 
                    $this -> output[$i]['datum'] = $info[3]; 
                    $this -> output[$i]['thuis_club'] = $info[5]; 
                    $this -> output[$i]['uit_club'] = $info[7]; 
                    $this -> output[$i]['uitslag'] = $info[9]; 

                    $i++; 
                } 
            break; 
            case 'stand': 
                list(, $contents) = explode('<td class="Agreenheader">Stand </td>', $this -> contents); 
                list($contents) = explode('<td width="100%" align="left" valign="middle" class="Agreenheader">Programma</td>', $contents); 

                preg_match_all('#<tr(.*?)>(\s+)(\s+)<td align="left" class="scoretd">(\d+.)</td>(\s+)<td align="left" class="scoretd">(.*?)</td>(\s+)<td align="center" class="scoretd">(\d+)</td>(\s+)<td align="center" class="scoretd">(\d+)</td>(\s+)<td align="center" class="scoretd">(\d+)</td>(\s+)<td align="center" class="scoretd">(\d+)</td>(\s+)<td align="center" class="scoretd"><b>(\d+)</b></td>(\s+)<td align="center" class="scoretd">(\d+)</td>(\s+)<td align="center" class="scoretd">(\d+)</td>(\s+)<td align="center" class="scoretd">(.*?)</td>(\s+)</tr>#si', $contents, $matches, PREG_SET_ORDER); 
                 
                 
                $this -> output = array(); 
                $i = 0; 
                foreach($matches as $info) 
                { 
                    $this -> output[$i]['eigenclub'] = (($info[1]) ? '1' : ''); 
                    $this -> output[$i]['nummer'] = $info[4]; 
                    $this -> output[$i]['club'] = $info[6]; 
                    $this -> output[$i]['gespeeld'] = $info[8]; 
                    $this -> output[$i]['gewonnen'] = $info[10]; 
                    $this -> output[$i]['gelijk'] = $info[12]; 
                    $this -> output[$i]['verloren'] = $info[14]; 
                    $this -> output[$i]['punten'] = $info[16]; 
                    $this -> output[$i]['goals_voor'] = $info[18]; 
                    $this -> output[$i]['goals_tegen'] = $info[20]; 
                    $this -> output[$i]['punten_mindering'] = $info[22]; 
                     
                    $i++; 
                } 
            break; 
            case 'programma':                 
                preg_match_all('#<tr( class="clubselectie")?>(\s+)<td class="scoretd" nowrap="nowrap">(.*?)</td>(\s+)<td class="scoretd">(.*?)</td>(\s+)<td class="scoretd">(.*?)</td>(\s+)<td class="scoretd">(.*?)</td>(\s+)<td valign="middle" align="right" class="scoretd">(.*?)</td>#si', $this -> contents, $matches, PREG_SET_ORDER); 
                 
                $this -> output = array(); 
                $i = 0; 
                foreach($matches as $info) 
                {     
                    $this -> output[$i]['datum'] = $info[3]; 
                    $this -> output[$i]['tijd'] = $info[5]; 
                    $this -> output[$i]['teams'] = $info[7]; 
                    $this -> output[$i]['accomedatie'] = $info[9]; 

                    $i++; 
                } 
            break; 
            default: 
                $this -> errors[] = "Ongeldige mode"; 
            break; 

        } 
    } 

    public function rip($mode = '') 
    { 
        if(!empty($mode)) 
        { 
            $this -> mode = $mode; 
        } 
        $this -> get_contents(); 
        $this -> parse(); 

        return $this -> output; 
    } 

    public function get_errors() 
    { 
        return $this -> errors; 
    } 
} 

?> 
[/code]

class.socket.php
[code]
<?php 
/******************************************* 
*  Socket Class Made By Lucas van Dijk 
* * * * * * * * * * * 
*  This class can be used for ANYTHING related to socket 
*  programming. 
* 
*  Includes some examples on how the socket class can be 
*  implented. (the HttpGetRequest and HttpPostRequest class) 
* * * * * * * * * * * 
* Revision 1.3 
********************************************/ 

class Socket 
{ 
    /** 
    * @desc the main socket 
    * @scope protected 
    * @type resource 
    */ 
    var $socket; 
     
    /** 
    * @desc IP of the server 
    * @scope protected 
    * @type string 
    */ 
    var $ip; 
     
    /** 
    * @desc port of the server 
    * @scope protected 
    * @type int 
    */ 
    var $port; 
     
    /** 
    * @desc Timeout 
    * @scope protected 
    * @type int 
    */ 
    var $timeout; 
     
    /** 
    * @desc Contains an error message 
    * @scope protected 
    * @type string 
    */ 
    var $error; 
     
    /** 
    * @desc Contains the data returned 
    * @scope protected 
    * @type string 
    */ 
    var $contents; 
     
    /** 
    * @desc Constructor, inits some vars 
    * @scope 
    */ 
    function Socket() 
    { 
        $this -> reset(); 
    } 
     
    /** 
    * @desc resets all vars 
    * @scope 
    */ 
    function reset() 
    { 
        $this -> timeout = 10; 
        $this -> ip = ''; 
        $this -> port = 0; 
        $this -> contents = ''; 
    } 
     
    /** 
    * @desc sets the IP and port 
    * @scope 
    * @param the IP 
    * @param the port 
    */ 
    function set_ip($ip, $port) 
    { 
        $this -> ip = (string) $ip; 
        $this -> port = (int) $port; 
    } 
     
    /** 
    * @desc sets the timeout 
    * @scope 
    * @param the timeout 
    */ 
    function set_timeout($timeout) 
    { 
        $this -> timeout = (int) $timeout; 
    } 
     
    /** 
    * @desc gets the error message 
    * @scope 
    * @return the error message 
    */ 
    function get_error() 
    { 
        return $this -> error; 
    } 
     
    /** 
    * @desc gets the data returned 
    * @scope 
    * @return the data 
    */ 
    function get_contents() 
    { 
        return $this -> contents; 
    } 
     
    /** 
    * @desc connects to the server 
    * @scope 
    * @return true on success else false 
    */ 
    function connect() 
    { 
        return $this -> socket = fsockopen($this -> ip, $this -> port, $errno, $this -> error, $this -> timeout); 
    } 
     
    /** 
    * @desc makes the actual request to the server 
    * @scope 
    * @param the request 
    * @return the contents returned by server, false on fail 
    */ 
    function request($request) 
    {         
        // Connect to IP and Port 
        $this -> connect(); 
         
        // Check if connected 
        if(is_resource($this -> socket)) 
        { 
            fwrite($this -> socket, $request); 
             
            // Get contents 
            $buffer = ''; 
            while($buffer = fgets($this -> socket, 4096)) 
            { 
                $this -> contents .= $buffer; 
            } 
             
            return $this -> contents; 
        } 
        else 
        { 
            // Error! 
            return false; 
        } 
    } 
} 

class HttpGetRequest extends Socket 
{ 
    /** 
    * @desc determines if we should include headers or not 
    * @scope protected 
    * @type boolean 
    */ 
    var $include_headers; 
     
    /** 
    * @desc determines if we should redirect, when a Location header was found 
    * @scope protected 
    * @type boolean 
    */ 
    var $redirect; 
     
    /** 
    * @desc an array with all the headers to be sent 
    * @scope protected 
    * @type array 
    */ 
    var $headers; 
     
    /** 
    * @desc the file to request 
    * @scope protected 
    * @type string 
    */ 
    var $file; 
     
    /** 
    * @desc an array with all cookies setted by the web page 
    * @scope protected 
    * @type array 
    */ 
    var $cookies; 
     
    /** 
    * @desc Cookies to set with the next request 
    * @scope protected 
    * @type array 
    */ 
    var $cookies_to_set; 
     
    /** 
    * @desc constructor, inits some vars 
    * @scope 
    */ 
    function HttpGetRequest() 
    { 
        $this -> reset(); 
    } 
     
    /** 
    * @desc resets all vars 
    * @scope 
    */ 
    function reset() 
    { 
        $this -> timeout = 10; 
        $this -> include_headers = false; 
        $this -> redirect = true; 
        $this -> headers = array(); 
        $this -> file = ''; 
        $this -> cookies = array(); 
        $this -> cookies_to_set = array(); 
        $this -> redirect = true; 
    }         
     
    /** 
    * @desc sets if we include headers or not 
    * @scope 
    * @param true or false, should we include headers? 
    */ 
    function include_headers($yes_no = true) 
    { 
        $this -> include_headers = (bool) $yes_no; 
    } 
     
    /** 
    * @desc determines if we should redirect, when a Location header was found 
    * @scope 
    * @param true or false, should we redirect? 
    */ 
    function use_redirect($yes_no = true) 
    { 
        $this -> redirect = (bool) $yes_no; 
    } 
     
    /** 
    * @desc adds a header 
    * @scope 
    * @param the header 
    */ 
    function add_header($header) 
    { 
        $this -> headers[] = (string) $header."\r\n"; 
    } 
     
    /** 
    * @desc set the file to request 
    * @scope 
    * @param the file 
    */ 
    function set_file($file) 
    { 
        $this -> file = (string) $file; 
    } 
     
    /** 
    * @desc gets the array woth cookies 
    * @scope 
    * @return array with all the cookies 
    */ 
    function get_cookies() 
    { 
        return $this -> cookies; 
    } 
     
    /** 
    * @desc send request to the webpage 
    * @scope 
    * @param the file 
    * @return the contents, or false on fail 
    */ 
    function request() 
    { 
        $contents = ''; 
         
        // Connect to IP and Port 
        $this -> connect(); 
         
        // Check if connected 
        if(is_resource($this -> socket)) 
        { 
            // Build cookie header 
            $cookies = ''; 
            foreach($this -> cookies_to_set as $name => $value) 
            { 
                $cookies .= $name."=".$value.";"; 
            } 
             
            $this -> add_header("GET /".$this -> file." HTTP/1.1"); 
            $this -> add_header("Host: ".$this -> ip); 
            $this -> add_header("Connection: Close"); 
            $this -> add_header("User-Agent: Socket PHP class (incompatible; IE sucks)"); 
            if(count($this -> cookies_to_set)) 
            { 
                $this -> add_header("Cookie: ".$cookies); 
            } 
            $this -> add_header(""); 
             
            $this -> contents = $this -> do_request(); 
             
            $this -> headers = array(); 
             
            $this -> grab_cookies(); 
             
            return $this -> contents; 
        } 
        else 
        { 
            // Error! 
            return false; 
        } 
    } 
     
    /** 
    * @desc does the actual request, builds headers etc. 
    * @scope protected 
    * @return the content 
    */ 
    function do_request() 
    { 
        $contents = ''; 
         
        // Build request to send 
        $request = ''; 
        foreach($this -> headers as $header) 
        { 
            $request .= $header; 
        } 
         
        fwrite($this -> socket, $request); 
         
        if($this -> include_headers == false) 
        { 
            $line = ''; 
            while(!($line == "\r\n")) 
            { 
                $line = fgets($this -> socket, 128); 
                 
                if($this -> redirect) 
                { 
                    if(preg_match("#Location\: (.*?)\\r\\n#si", $line, $matches)) 
                    { 
                        $this -> set_file($matches[1]); 
                         
                        // Clear all headers 
                        $this -> headers = array(); 
                        return $this -> request(); 
                    } 
                } 
            }    // strip out the header 
        } 
             
        // Get contents 
        $buffer = ''; 
        while($buffer = fgets($this -> socket, 4096)) 
        { 
            $contents .= $buffer; 
        }     
         
        return $contents; 
    } 
     
    /** 
    * @desc gets the cookies setted by the webserver 
    * @scope protected 
    * @return array with the cookies 
    */ 
    function grab_cookies() 
    { 
        if($this -> include_headers) 
        { 
            preg_match_all("/Set-Cookie: (.*?)\r\n/si", $this -> contents, $matches, PREG_SET_ORDER); 
             
            foreach($matches as $match) 
            { 
                $cookie = explode(";", $match[1]); 
                list($cookie_name, $cookie_value) = explode("=", $cookie[0], 2); 
                $this -> cookies[urldecode($cookie_name)] = urldecode($cookie_value); 
            } 
        } 
    } 
     
    /** 
    * @desc sets a cookie 
    * @scope 
    * @param cookie name 
    * @param cookie value 
    */ 
    function set_cookie($cookie_name, $cookie_value) 
    { 
        $this -> cookies_to_set[$cookie_name] = $cookie_value; 
    } 
     
    /** 
    * @desc removes a cookie 
    * @scope 
    * @param cookie name 
    */ 
    function remove_cookie($cookie_name) 
    { 
        unset($this -> cookies_to_set[$cookie_name]); 
    } 
     
    /** 
    * @desc sets all cookies grabbed by grab_cookies(); 
    * @scope 
    */ 
    function set_all_cookies() 
    { 
        foreach($this -> cookies as $name => $value) 
        { 
            $this -> set_cookie($name, $value); 
        } 
    }         
} 

class HttpPostRequest extends HttpGetRequest 
{ 
    /** 
    * @desc Post variables to send 
    * @scope protected 
    * @type array 
    */ 
    var $post_vars; 
     
    /** 
    * @desc Constructor, inits some vars 
    * @scope 
    */ 
    function HttpPostRequest() 
    { 
        $this -> reset(); 
    } 
     
    /** 
    * @desc resets all vars 
    * @scope 
    */ 
    function reset() 
    { 
        $this -> post_vars = array(); 
        $this -> timeout = 10; 
        $this -> include_headers = false; 
        $this -> redirect = true; 
        $this -> headers = array(); 
        $this -> file = ''; 
        $this -> cookies = array(); 
        $this -> redirect = true; 
    }         
     
    /** 
    * @desc adds a post var 
    * @scope 
    * @param name of the var 
    * @param value of the var 
    */ 
    function add_var($name, $value) 
    { 
        $this -> post_vars[$name] = $value; 
    } 
     
    /** 
    * @desc makes the actual request to the webpage 
    * @scope 
    * @param the file 
    * @return the contents, or false on fail 
    */ 
    function request() 
    {         
        // Connect to IP and Port 
        $this -> connect(); 
         
        // Check if connected 
        if(is_resource($this -> socket)) 
        { 
            // Build post vars 
            $vars = ''; 
            foreach($this -> post_vars as $name => $value) 
            { 
                $vars .= "&".$name."=".urlencode($value); 
            } 
            $vars = substr($vars, 1); 
             
            $this -> add_header("POST /".$this -> file." HTTP/1.1"); 
            $this -> add_header("Host: ".$this -> ip); 
            $this -> add_header("Connection: Close"); 
            $this -> add_header("User-Agent: Socket PHP class (incompatible; IE sucks)"); 
            $this -> add_header("Content-type: application/x-www-form-urlencoded"); 
            $this -> add_header("Content-Length: ".strlen($vars)); 
            $this -> add_header(''); 
            $this -> add_header($vars); 
            $this -> add_header('');             
             
            $this -> contents = $this -> do_request(); 
             
            $this -> grab_cookies(); 
             
            return $this -> contents; 
        } 
        else 
        { 
            // Error! 
            return false; 
        } 
    } 
} 
?>
[/code]

index.php
[code]
<?php 
ob_start();

    ## Login gegevens voor KNVB.nl 
    $Email         = ''; 
    $Wachtwoord    = ''; 
     
    ## Team gegevens 

    ## URL: link naar de statistieken van een team, zonder http://www.knvb.nl/ ervoor. 
    ## Naam: naam van het team. 
    ## Titel: naam van het team zoals het in het menutje weergegeven moet worden. 
    ## Clubnaam: : naam van het team zoals weergegeven op de knvb site. 
    $Team = array ( array ( 'URL'     => 'clubs_comp/real_time?action=teamDetails&ClubName=Monnickendam&NotationDescription=0212%20Mannen%20%20Zaterdag%20standaard&LevelDescription=2e%20klasse%20A&CompetitionType=0212&ClassLevel=12&RegionCode=KNVB-DISTRICT-WEST1&Pool=A&TeamDescription=&CompNummer=W1-0212**-12-148881!', 
                            'Naam'    => 'Monnickendam, 0212 Mannen Zaterdag standaard , 2e klasse A ', 
                            'Titel'    => '', 
                            'Clubnaam'    => '' ), 
                     
                    array ( 'URL'     => 'clubs_comp/team_standen?club_id=BBFW684&team_id=123328&comp_id=W1-0213**-12-148883!', 
                            'Naam'    => ' ', 
                            'Titel'    => '', 
                            'Clubnaam'    => '' ), 
                     ); 
     
    include( 'class.knvb.php' ); 

    if ( !isset ( $_GET [ 'team' ] ) || !isset ( $Team [ $_GET [ 'team' ] ] ) ) 
     
        $_GET [ 'team' ] = 0; 
     
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 

    <head> 

        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 

        <title>VVMonnickendam<?php echo $Team [ $_GET [ 'team' ] ][ 'Titel' ]; ?></title> 

        <style type="text/css"> 

            body { 
                font-family: Arial, Helvetica, sans-serif; 
                font-size: 12pt; 
                text-align: center; 
            } 
             
            a { 
                color: #000; 
                text-decoration: none; 
            } 
             
            a:hover { 
                color: #390; 
                text-decoration: underline; 
            } 
             
            h2 { 
                margin: 15px 20px; 
                font-size: 16pt; 
                text-align: center; 
            } 
             
            table { 
                margin: 0 auto; 
            } 
             
            table.stand { 
                padding: 0px; 
                width: 600px; 
            } 
             
            table.stand th, table.uitslagen th, table.programma th { 
                background: #6297DA; 
                color: #fff; 
                font-family: Arial, Helvetica, sans-serif; 
                font-size:12px; 
                color:#000000; 
            } 
             
            table.stand th, table.stand td { 
                padding: 3px; 
                border-right: #000 1px solid; 
                border-bottom: #000 1px solid; 
                text-align: center; 
                font-family: Arial, Helvetica, sans-serif; 
                font-size:12px; 
                color:#000000; 
            } 
             
            table.uitslagen { 
                padding: 0px; 
                width: 600px; 
                font-family: Arial, Helvetica, sans-serif; 
                font-size:12px; 
                color:#000000; 
            } 
             
            table.programma { 
                padding: 0px; 
                width: 700px; 
                font-family: Arial, Helvetica, sans-serif; 
                font-size:12px; 
                color:#000000; 
            } 
             
            table.uitslagen th, table.uitslagen td, table.programma th, table.programma td { 
                padding: 3px; 
                border-right: #000 1px solid; 
                border-bottom: #000 1px solid; 
                text-align: left; 
            } 
         
        </style> 

    </head> 
     
    <body> 
     
<?php 

    if ( sizeof ( $Team ) > 1 ) { 

        foreach ( $Team as $Key => $Value ) { 
         
            if ( $Key > 0 ) 
             
                echo " | \n"; 
                 
            if ( $Key == $_GET [ 'team' ] ) 
             
                echo "\t\t<b>" . $Value [ 'Titel' ] . '</b>'; 
             
            else 
             
                echo "\t\t<a href=\"?team=" . $Key . '">' . $Value [ 'Titel' ] . '</a>'; 
                     
        } 
     
    } 
     
    $ripper = new KnvbRipper ( $Email, $Wachtwoord, $Team [ $_GET [ 'team' ] ][ 'URL' ], 'programma' ); 
     
?> 
         

        <h2>Wedstrijden</h2> 

        <table align="center" cellpadding="0" cellspacing="1" class="programma"> 

      <tr> 

                <th>Datum</th> 
                <th>Tijd</th> 
                <th>Thuis Club</th> 
                <th>Uit Club</th> 
                <th>Accomedatie</th> 

            </tr> 
             
<?php     
        $Programma = $ripper -> rip ( ); 
     
        foreach ( $Programma as $Programma ) { 
         
            if ( eregi ( $Team [ $_GET [ 'team' ] ][ 'Naam' ], $Programma [ 'thuis_club' ] ) || eregi ( $Team [ $_GET [ 'team' ] ][ 'Naam' ], $Programma [ 'uit_club' ] ) ) 
            {    
             
                echo "\t\t\t<tr style=\"background: #eee; font-weight: bold;\">\n"; 
            } 
            else 
             
                echo "\t\t\t<tr>\n"; 

?> 

                <td><?php echo $Programma [ 'datum' ]; ?></td> 
                <td><?php echo $Programma [ 'tijd' ]; ?></td> 
                <td><?php echo str_replace ( $Team [ $_GET [ 'team' ] ][ 'Naam' ], '<b>' . $Team [ $_GET [ 'team' ] ][ 'Naam' ] . '</b>', $Programma [ 'thuis_club' ] ); ?></td> 
                <td><?php echo str_replace ( $Team [ $_GET [ 'team' ] ][ 'Naam' ], '<b>' . $Team [ $_GET [ 'team' ] ][ 'Naam' ] . '</b>', $Programma [ 'uit_club' ] ); ?></td> 
                <td><?php echo $Programma [ 'accomedatie' ]; ?></td> 
             
            </tr> 
             
<?php                 
        } 
         
        if( sizeof( $Programma ) == 0 ) { 
?>         
            <tr> 
             
                <td colspan="5" style="text-align: center;">Er is momenteel geen programma bekend!</td> 
                 
            </tr> 

<?php             
        } 

?>         
        </table> 
         
    <h2>Uitslagen</h2> 
         
        <table cellpadding="0" cellspacing="1" class="uitslagen"> 
         
            <tr> 
             
                <th>Datum</th> 
                <th>Thuis Club</th> 
                <th>Uit Club</th> 
                <th>Uitslag</th> 
                 
            </tr> 
         
<?php     
        $Uitslagen = $ripper -> rip ( 'uitslagen' ); 
     
                foreach ( $Uitslagen as $Uitslag ) { 
         
            if ( eregi ( $Team [ $_GET [ 'team' ] ][ 'Naam' ], $Uitslag [ 'thuis_club' ] ) || eregi ( $Team [ $_GET [ 'team' ] ][ 'Naam' ], $Uitslag [ 'uit_club' ] ) ) 
             
                echo "\t\t\t<tr style=\"background: #eee; font-weight: bold;\">\n"; 
             
            else 
             
                echo "\t\t\t<tr>\n"; 
                 
?> 

                <td><?php echo $Uitslag [ 'datum' ]; ?></td> 
                <td><?php echo $Uitslag [ 'thuis_club' ]; ?></td> 
                <td><?php echo $Uitslag [ 'uit_club' ]; ?></td> 
                <td><?php echo $Uitslag [ 'uitslag' ]; ?></td> 
                 
            </tr> 

<?php             
        } 
         
        if( sizeof( $Uitslagen ) == 0 ) { 
?>         
            <tr> 
             
             
                <td colspan="4" style="text-align: center;">Er zijn momenteel geen uitslagen bekend!</td> 
            </tr> 
             
<?php             
        } 
?>         
        </table> 
     
        <h2>Stand</h2> 
         
        <table cellpadding="0" cellspacing="1" class="stand"> 
         
            <tr> 
             
                <th>#</th> 
                <th style="text-align: left;">Club</th> 
                <th>G</th> 
                <th>W</th> 
                <th>GL</th> 
                <th>V</th> 
                <th>P</th> 
                <th>VP</th> 
                <th>DPV</th> 
                <th>DPT</th> 
                <th>DS</th> 
                <th>PM</th> 
                 
            </tr> 
         
<?php     
        $Stand = $ripper -> rip ( 'stand' ); 
         
        foreach ( $Stand as $Stand ) { 
         
            if ( eregi ( $Team [ $_GET [ 'team' ] ][ 'Clubnaam' ], $Stand [ 'club' ] ) ) 
             
                echo "\t\t\t<tr style=\"background: #cccccc; font-weight: bold;\">\n"; 
             
            else 
             
                echo "\t\t\t<tr>\n"; 

?> 

                <td><?php echo $Stand [ 'nummer' ]; ?></td> 
                <td style="text-align: left;"><?php echo $Stand [ 'club' ]; ?></td> 
                <td><?php echo $Stand [ 'gespeeld' ]; ?></td> 
                <td><?php echo $Stand [ 'gewonnen' ]; ?></td> 
                <td><?php echo $Stand [ 'gelijk' ]; ?></td> 
                <td><?php echo $Stand [ 'verloren' ]; ?></td> 
                <td><?php echo $Stand [ 'punten' ]; ?></td> 
                <td><?php echo ( ( $Stand [ 'gelijk' ] * 2 ) + ( $Stand [ 'verloren' ] * 3 ) ); ?></td> 
                <td><?php echo $Stand [ 'goals_voor' ]; ?></td> 
                <td><?php echo $Stand [ 'goals_tegen' ]; ?></td> 
                <td><?php echo ( $Stand [ 'goals_voor' ] - $Stand [ 'goals_tegen' ] ); ?></td> 
                <td><?php echo $Stand [ 'punten_mindering' ]; ?></td> 
             
            </tr> 
             
<?php             
        } 
         
        if( sizeof( $Stand ) == 0 ) {
				header("location: index.php"); 
?>         
            <tr> 
             
                <td colspan="12" style=\"text-align: center;\">Er is momenteel geen stand bekend!</td> 
                 
            </tr> 
             
<?php             
        } 
?>         
            <tr> 
             
                <td style="border: none;" colspan="12"> 
                 
                    <b>G</b>: gespeeld | <b>W</b>: gewonnen | <b>GL</b>: gelijk | <b>V</b>: verloren | <b>P</b>: punten | <b>VP</b>: verlies punten<br /> 
                    <b>DPV</b>: doelpunten voor | <b>DPT</b>: doelpunten tegen | <b>DS</b>: doelsaldo | <b>PM</b>: punten in mindering 
                 
                </td> 
             
            </tr> 
         
        </table> 

    </body> 
     
</html> 
<?php
ob_end_flush();
?>

[/code]

Reacties

0
Nog geen reacties.