Weather online Weather online
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Weather online

Started by rgroen, December 17, 2003, 10:17:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rgroen

Hello,

I'm trying to make the following script:


<?PHP
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery 1.2.0                                            //
// ------------------------------------------------------------------------- //
// Copyright (C) 2002,2003 Gregory DEMAR <gdemar@wanadoo.fr>                 //
// http://www.chezgreg.net/coppermine/                                       //
// ------------------------------------------------------------------------- //
// Updated by the Coppermine Dev Team                                        //
// (http://coppermine.sf.net/team/)                                          //
// see /docs/credits.html for details                                        //
// ------------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify      //
// it under the terms of the GNU General Public License as published by      //
// the Free Software Foundation; either version 2 of the License, or         //
// (at your option) any later version.                                       //
// ------------------------------------------------------------------------- //

define('IN_COPPERMINE', true);  

require('include/init.inc.php');
 

pageheader('Het weer');  
starttable("100%", $lang_ecard_php['title'], 3);  


<?
if($_POST['Submit'])
{
$fd=file("http://load.weeronline.com/cgi-bin/citybild?LANG=nl&PLZ=$pc&PLZN=$plaats");
$weer=array();
$wind=array();
for($i=0;$i<count($fd);$i++){
if(eregi("de verwachting",$fd[$i])){
  $line=$fd[$i];
  $start=strpos($line, "de verwachting voor de regio/plaats:");
  $start+=37;
  $stop=strpos($line,"</b>");
  $stop=$stop-$start;
  $plaats=substr($line,$start,$stop);
};
if(eregi("&deg;",$fd[$i])){
  $line=$fd[$i];
  $stop=strpos($line, "<b>")+3;
  $eind=strpos($line, "</b>");
  $eind=$eind-$stop;
  $temp=Substr($line, $stop, $eind);
  $weer[]=$temp;
};
if(eregi("daten/symbole",$fd[$i])){
  $line=$fd[$i];
  $stop=strpos($line, "<img src=")+10;
  $eind=strpos($line, "width=\"50\" height=\"35\">");
  $eind=$eind-$stop;
  $temp=Substr($line, $stop, $eind);
  $weer[]=$temp;
};
};
$fd=file("http://load.weeronline.com/cgi-bin/citywind?LANG=nl&PLZ=$pc&PLZN=$plaats");
for($i=0;$i<count($fd);$i++){
if(eregi("height=\"24\"",$fd[$i])){
  $line=$fd[$i];
  $stop=strpos($line, "<b>")+3;
  $eind=strpos($line, "</b>");
  $eind=$eind-$stop;
  $temp=Substr($line, $stop, $eind);
  $wind[]=$temp;
};
if(eregi("&nbsp;",$fd[$i])){
  $line=$fd[$i];
  $stop=strpos($line, "<b>")+3;
  $eind=strpos($line, "</b>");
  $eind=$eind-$stop;
  $temp=Substr($line, $stop, $eind);
  $wind[]=$temp;
};
};
echo"
<table width=\"100%\">
<tr><td>
<b>Het weer in: $plaats&nbsp;&nbsp;[$pc]</b>
<table border=\"0\">
<tr>
    <td><b>Weer</b></td>
    <td>$wind[1]</td>
    <td>$wind[2]</td>
    <td>$wind[3]</td>
</tr>
<tr>
    <td>Min Temp</td>
    <td>$weer[0]</td>
    <td>$weer[1]</td>
    <td>$weer[2]</td>
</tr>
<tr>
    <td>Max Temp</td>
    <td>$weer[3]</td>
    <td>$weer[4]</td>
    <td>$weer[5]</td>
</tr>
<tr>
    <td>ochtend</td>
    <td><img src=\"http://load.weeronline.com$weer[6]</td>
    <td><img src=\"http://load.weeronline.com$weer[7]</td>
    <td><img src=\"http://load.weeronline.com$weer[8]</td>
</tr>
<tr>
    <td>middag</td>
    <td><img src=\"http://load.weeronline.com$weer[9]</td>
    <td><img src=\"http://load.weeronline.com$weer[10]</td>
    <td><img src=\"http://load.weeronline.com$weer[11]</td>
</tr>
<tr>
    <td>avond</td>
    <td><img src=\"http://load.weeronline.com$weer[12]</td>
    <td><img src=\"http://load.weeronline.com$weer[13]</td>
    <td><img src=\"http://load.weeronline.com$weer[14]</td>
</tr>
<tr>
    <td colspan=\"4\"><b>Wind</b></td>
</tr>
<tr>
    <td>'s morgens</td>
    <td>$wind[4]</td>
    <td>$wind[5]</td>
    <td>$wind[6]</td>
</tr>
<tr>
    <td>'s middags</td>
    <td>$wind[7]</td>
    <td>$wind[8]</td>
    <td>$wind[9]</td>
</tr>
<tr>
    <td>'s avonds</td>
    <td>$wind[10]</td>
    <td>$wind[11]</td>
    <td>$wind[12]</td>
</tr>
</table></td></tr></table>
";
}
?>
<form method="post" action="weer2.php">
  <table width="1147" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td align="left" width="60">Postcode:</td>
      <td width="1083">
        <input type="text" name="pc" size="5" maxlength="4">
      </td>
    </tr>
    <tr>
      <td align="left" width="60">&nbsp;</td>
      <td width="1083">
        <input type="submit" name="Submit" value="Verzenden">
      </td>
    </tr>
  </table>
  </form>
endtable();  
pagefooter();
ob_end_flush();


But it doesn't work. Does anyone know why?

Thnx