Probleme nach Umstieg von PHP4 auf PHP5 mit Formularen

PhoenixDH

Erfahrenes Mitglied
Probleme nach Umstieg von PHP4 auf PHP5

Hallo zusammen,

mein Provider hat diese Nacht von PHP Version 4 auf Version 5 umgestellt.

Jetzt habe ich Probleme mit sämtlichen Formularen die ich hatte.
Ein Beispiel seht ihr hier:
http://www.bartagame-info.de/terrariumrechner.html

Ich bekomme immer Fehler das keine Werte ankommen.

Kann mir wer sagen was sich da geändert hat?

Hier mal noch ein Stück Quellcode:
Code:
<form action="terrariumrechner-ergebnis.html" method="POST">
.....
	<?php
	if($_GET['action'] == 'send')
	{

		$fehler = "0";

		if ($krl=="")
		{
		$fehler = "1";
		echo "<br><b>Keine KRL eingetragen!</b><br>";
		}
		elseif (!is_numeric($krl))
		{
		$fehler = "1";
		echo "<br><b>Für die KRL sind nur Zahlen zulässig!</b><br>";	
		}

Dank euch!
 
Zuletzt bearbeitet:
Hi,

das liegt an deinen Post-Variablen:
PHP:
$krl

muss nun lauten:
PHP:
$_POST['krl']
 
Zuletzt bearbeitet:
Ich mache das Thema nochmal auf, denn mir ist noch ein weiteres Problem aufgefallen, allerdings nicht mir FOrmularen.

Ich hoffe das is ok so, wenn nicht mache ich nen neuen Thread.

Also ich habe eine Topliste, die jetzt auch total verhackt ist:
http://www.bartagame-info.de/topliste/

Wenn ich mit Firefox in den Quellcode kucke, dann sieht der ziemlich komisch aus, und ich weiß nicht wo das herkommt.

der macht aus:
Code:
<meta name="revisit-after" content="7 days">

z.B.:
Code:
<meta name=\"revisit-after\" content=\"7 days\">

Dank euch.
 
Kein Problem, hier sind ein paar Zeilen:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<head>
<title>{$list_name} - {$header}</title>
<meta http-equiv="Content-Type" content="text/html;charset={$lng->charset}">
<link rel="stylesheet" type="text/css" media="screen" href="{$skins_url}/{$skin_name}/screen.css">
<link rel="alternate" href="{$list_url}/{$feed}" type="application/rss+xml" title="{$list_name}">
<script language="JavaScript" type="text/javascript" src="../buchanzeigen.js"></script>
<script src="../bookmarks.js" type="text/javascript"></script>
<META name="Content-Language" CONTENT="de">
<meta name="language" content="German, deutsch, de">
<meta name="description" content="Bartagame-Info.de - Infos und Forum - Hier bekommt ihr alle Infos zur Haltung, Lebensraum, Fressen, wie sieht ihr Terrarium aus, Beleuchtung und Wärme, Pflegetips, Bildergalerie ...">
<meta name="abstract" content="Bartagame-Info.de - Infos und Forum über Bartagamen - Hier bekommt ihr alle Infos zur Haltung von Bartagamen !">
<META CONTENT="Bartagame, Bartagamen, Echsen, Reptilien, Reptile, Terrarium, Terrarien, HQI, HQL, UVA, UVB, Haltung, Ernährung, Pflege, Vor dem Kauf, Kaufinformationen, Lebensraum, Geschelcht, Pogona, Vitticeps, Pogona Vitticeps, Fachbegriffe, Lexikon, Verhalten, Krankheiten, Rachitis, Vitamin D3, Vitamine, Obst, Gemüse, Salat, Vergesellschaftung, Winterruhe, Winterschlaf, Größe, Beleuchtung, Wärme, T5, T8, Leuchtstoffröhren, Röhren, Osram, Vitalux, Radium, Sanolux, ZooMed, Exo Terra, Heimchen, Grillen, Heuschrecken, Luftfeuchtigkeit, Bodengrund, Temperatur, Einrichtung, Pflanzen, Golliwoog, Rückwand, Rückwandbau, Galerie, Bildergalerie, Literatur, Info, Infos, Informationen, Paarhaltung, Volglasterrarium, Holzterrarium, Klimazonen, Fressen, Futter, Futtertiere, Pogona barbata, Pogona henrylawsoni, Pogona microlepidota, Pogona minima, Pogona minor, Pogona mitchelli, Pogona nullabor, Zucht, Züchtung, Brut, Paarung, Inkubator, Tip, Tipps, Tricks, Forum" NAME="keywords">
<META NAME="robots" CONTENT="INDEX, FOLLOW">
<meta name="revisit-after" content="7 days">
<script type="text/javascript">
function out(username)
{
  image = new Image();
  image.src= '{$list_url}/index.php?a=out&u=' + username;
}
</script>
</head>
<body>

<table width="100%" cellpadding="0" cellspacing="0">
 <tr>
  <td width="163" height="150"><a href="http://www.tutorials.de/forum/" title="Bartagame-Info.de - Wissenswertes über Bartagamen"><img src="http://www.tutorials.de/forum/design/headlinks.jpg" border="0" alt=""></a></td>
  <td width="158" height="150"><a href="http://www.tutorials.de/forum/" title="Bartagame-Info.de - Wissenswertes über Bartagame"><img src="http://www.tutorials.de/forum/design/headlinks2.jpg" border="0" alt=""></a></td>
  <td width="100%" height="150" align="center" valign="middle" style="background:url('../design/headmitte.jpg');"><table><tr><td align="right">{include "http://www.bartagame-info.de/werbung_top.php"}</td></tr></table></td>
  <td align="right" height="150" style="background:url('../design/headmitte.jpg');"><img src="http://www.tutorials.de/forum/design/headrechts.gif" alt=""></td>
 </tr>
</table>
 
Zuletzt bearbeitet:
Ich denke mal, dass das ganze dann auch noch mit irgendeiner Funktion bearbeitet wird, zumindest jedenfalls durch ein echo gejagt wird, oder?
Der Code wäre dann auch praktisch ;)
 
Das ist eigentlich der Code des Templates das aufgerufen wird.

Hier ist noch der Part der für die Topliste aufgerufen wird:
Code:
<!-- BEGINN TOPLISTE -->

<div id="wrapper">
	<div id="header"><a href="{$list_url}/"><img src="{$skins_url}/{$skin_name}/header.jpg" width="630" height="75" alt="{$list_name}"></a></div>
	<div id="navigation">
		<a href="{$list_url}/" class="menu">{$lng->main_menu_rankings}</a> - 
		<a href="{$list_url}/index.php?a=join" class="menu">{$lng->main_menu_join}</a> - 
		<a href="{$list_url}/index.php?a=user_cpl" class="menu">{$lng->main_menu_user_cp}</a> - 
		<a href="{$list_url}/index.php?a=stats" class="menu">{$lng->stats_overall}</a>
	</div>
	<div id="filters"><form action="index.php" method="get">
{$ranking_methods_menu}
{$categories_menu}
{$multiple_pages_menu}
		<input type="submit" value="{$lng->g_form_submit_short}">
	</form></div>
	<div id="search"><form action="index.php" method="get">
		<input type="hidden" name="a" value="search">
		<input type="text" name="q" size="18" value="{$query}">
		<input type="submit" value="{$lng->search_header}">
	</form></div>
	<div id="content">
{$content}
	</div>
	<div id="copyright"><br />{$lng->main_executiontime}: {$execution_time} | {$lng->main_queries}: {$num_queries} | {$lng->main_members}: {$num_members}<br>
		{$list_name} - {$powered_by}</div>



</div>

<!-- ENDE TOPLISTE -->

Das ist der Code der index.php
Code:
<?php
//===========================================================================\\
// Aardvark Topsites PHP 5.2                                                 \\
// Copyright (c) 2000-2009 Jeremy Scheff.  All rights reserved.              \\
//---------------------------------------------------------------------------\\
// http://www.aardvarktopsitesphp.com/                http://www.avatic.com/ \\
//---------------------------------------------------------------------------\\
// 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.                                                \\
//                                                                           \\
// This program is distributed in the hope that it will be useful, but       \\
// WITHOUT ANY WARRANTY; without even the implied warranty of                \\
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General \\
// Public License for more details.                                          \\
//===========================================================================\\

// Help prevent register_globals injection
define('ATSPHP', 1);
$CONF = array();
$FORM = array();
$TMPL = array();

// Change the path to your full path if necessary
$CONF['path'] = '.';
$TMPL['version'] = '5.2.1';
// Set to 1 to display SQL queries and GET/POST/COOKIE data
$CONF['debug'] = 0;

// Require some classes and start the timer
require_once("{$CONF['path']}/sources/misc/classes.php");
$TIMER = new timer;

// Connect to the database
// Set the last argument of $DB->connect to 1 to enable debug mode
require_once("{$CONF['path']}/settings_sql.php");
require_once("{$CONF['path']}/sources/sql/{$CONF['sql']}.php");
$DB = "sql_{$CONF['sql']}";
$DB = new $DB;
$DB->connect($CONF['sql_host'], $CONF['sql_username'], $CONF['sql_password'], $CONF['sql_database'], $CONF['debug']);

// Settings
$settings = $DB->fetch("SELECT * FROM {$CONF['sql_prefix']}_settings", __FILE__, __LINE__);
$CONF = array_merge($CONF, $settings);

$ad_breaks = explode(',', $CONF['ad_breaks']);
$CONF['ad_breaks'] = array();
foreach ($ad_breaks as $key => $value) {
  $CONF['ad_breaks'][$value] = $value;
}

$result = $DB->query("SELECT category, skin FROM {$CONF['sql_prefix']}_categories ORDER BY category", __FILE__, __LINE__);
while (list($category, $skin) = $DB->fetch_array($result)) {
  $CONF['categories'][$category] = $skin;
}

$CONF['skins_path'] = "{$CONF['path']}/skins";
$CONF['skins_url'] = "{$CONF['list_url']}/skins";
$TMPL['skins_url'] = $CONF['skins_url'];
$TMPL['list_name'] = $CONF['list_name'];
$TMPL['list_url'] = $CONF['list_url'];

// Combine the GET and POST input
$FORM = array_merge($_GET, $_POST);

// The language file
require_once("{$CONF['path']}/languages/{$CONF['default_language']}.php");

// Determine the category and skin
if (isset($FORM['cat']) && isset($CONF['categories'][$FORM['cat']])) {
  $TMPL['skin_name'] = $CONF['categories'][$FORM['cat']];
}
else {
  $TMPL['skin_name'] = $CONF['default_skin'];
}
if (!is_dir("{$CONF['path']}/skins/{$TMPL['skin_name']}/") || !$TMPL['skin_name']) {
  $TMPL['skin_name'] = $CONF['default_skin'];
}
if (!is_dir("{$CONF['path']}/skins/{$CONF['default_skin']}/")) {
  $TMPL['skin_name'] = 'fusion';
}
require_once("{$CONF['path']}/sources/misc/skin.php");

// Is it a new day/week/month?
list($last_new_day, $last_new_week, $last_new_month, $TMPL['original_version']) = $DB->fetch("SELECT last_new_day, last_new_week, last_new_month, original_version FROM {$CONF['sql_prefix']}_etc", __FILE__, __LINE__);
$time = time() + (3600*$CONF['time_offset']);
$current_day = date('d', $time);
$current_week = date('W', $time);
$current_month = date('m', $time);
if ($last_new_day != $current_day) {
  require_once("{$CONF['path']}/sources/misc/new_day.php");
  new_day($current_day);
}
if ($last_new_week != $current_week) {
  require_once("{$CONF['path']}/sources/misc/new_day.php");
  new_week($current_week);
}
if ($last_new_month != $current_month) {
  require_once("{$CONF['path']}/sources/misc/new_day.php");
  new_month($current_month);
}

// Adjust the output text based on days, weeks, or months
if ($CONF['ranking_period'] == 'weekly') {
  $LNG['g_this_period'] = $LNG['g_this_week'];
  $LNG['g_last_period'] = $LNG['g_last_week'];
}
elseif ($CONF['ranking_period'] == 'monthly') {
  $LNG['g_this_period'] = $LNG['g_this_month'];
  $LNG['g_last_period'] = $LNG['g_last_month'];
}
else {
  $LNG['g_this_period'] = $LNG['g_today'];
  $LNG['g_last_period'] = $LNG['g_yesterday'];
}

// Check if installer is there
if (file_exists("{$CONF['path']}/install/")) {
  $TMPL['header'] = $LNG['g_error'];
  $base = new base;
  $base->error($LNG['g_delete_install']);
}

// Check for hits in
require_once("{$CONF['path']}/sources/in.php");
$in = new in;

// Array containing the valid .php files from the sources directory
$action = array(
            'admin' => 1,
            'in' => 1,
            'join' => 1,
            'lost_pw' => 1,
            'out' => 1,
            'page' => 1,
            'rankings' => 1,
            'rate' => 1,
            'search' => 1,
            'stats' => 1,
            'user_cpl' => 1
          );

// Require the appripriate file
if (isset($FORM['a']) && isset($action[$FORM['a']])) {
  $page_name = $FORM['a'];
}
else {
  $page_name = 'rankings';
}

require_once("{$CONF['path']}/sources/{$page_name}.php");
$page = new $page_name;

// Display the page
$skin = new main_skin('wrapper');
echo $skin->make();

$DB->close();

// Print out debugging info, if necessary
if ($CONF['debug']) {
  echo '<div style="clear: both;">';
  foreach ($DB->queries as $value) {
    echo "<hr /><pre>{$value}</pre>";
  }
  echo '<hr /><pre>';
  print_r($_REQUEST);
  echo '</pre>';
  echo '</div>';
}
?>
 
ich denke mal, dass irgendwas in folgender funktion nicht richtig bearbeitet wird:
Code:
// Display the page
$skin = new main_skin('wrapper');
echo $skin->make();

es ist grundsätzlich schwer, eine Lösung anbieten zu können, ohne das ganze ablaufende System verstehen zu können.
Schau bitte mal, ob du in der classes.php diese funktion finden kannst (und vielleicht auch gesondert postest und nicht die ganze classes wenn diese größer sein sollte).
 
Ich denke das sollte die file sein, heißt skin.php:
Code:
<?php
//===========================================================================\\
// Aardvark Topsites PHP 5.2                                                 \\
// Copyright (c) 2000-2009 Jeremy Scheff.  All rights reserved.              \\
//---------------------------------------------------------------------------\\
// http://www.aardvarktopsitesphp.com/                http://www.avatic.com/ \\
//---------------------------------------------------------------------------\\
// 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.                                                \\
//                                                                           \\
// This program is distributed in the hope that it will be useful, but       \\
// WITHOUT ANY WARRANTY; without even the implied warranty of                \\
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General \\
// Public License for more details.                                          \\
//===========================================================================\\

if (!defined('ATSPHP')) {
  die("This file cannot be accessed directly.");
}

class skin {
  var $filename;

  function skin($filename) {
    $this->filename = $filename;
  }

  function make() {
    global $CONF, $TMPL;

    $file = "{$CONF['skins_path']}/{$TMPL['skin_name']}/{$this->filename}.html";
    $fh_skin = fopen($file, 'r');
    $skin = @fread($fh_skin, filesize($file));
    fclose($fh_skin);

    $parse = 1;

    if ($this->filename == 'wrapper') {
      $powered_by_check = strpos($skin, '{$powered_by}') ? 1 : 0;
  
      if ($powered_by_check) {
        $return = $skin;
      }
      else {
        $return = 'You cannot delete {$powered_by} from wrapper.html.';
        $parse = 0;
      }
    }
    elseif ($this->filename == 'admin' || $this->filename == 'ssi_top' || $this->filename == 'ssi_members') {
      $return = $skin;
    }
    else {
      $return = "<!-- Begin {$this->filename}.html -->\n{$skin}<!-- End {$this->filename}.html -->\n\n";
    }

    if ($parse) {
      return $this->parse($return);
    }
    else {
      return $return;
    }
  }

  function send_email($email) {
    global $CONF, $TMPL;

    $file = "{$CONF['skins_path']}/{$TMPL['skin_name']}/{$this->filename}.html";
    $fh_skin = fopen($file, "r");
    $skin = @fread($fh_skin, filesize($file));
    fclose($fh_skin);

    $skin_array = explode("\n", $skin);

    $subject = array_shift($skin_array);
    $subject = str_replace('Subject: ', '', $subject);
    $body = implode("\n", $skin_array);

    $subject = $this->parse($subject);
    $body = $this->parse($body);

    mail($email, $subject, $body, "From: {$CONF['your_email']}\r\n");
  }
  
  function parse($skin) {
    global $LNG, $TMPL, $n, $parse_time;

    $skin = preg_replace_callback('/{\$lng->(.+?)}/i', create_function('$matches', 'global $LNG; return $LNG[$matches[1]];'), $skin);
    $skin = preg_replace_callback('/{\$(.+?)}/i', create_function('$matches', 'global $TMPL; return $TMPL[$matches[1]];'), $skin);
    $skin = preg_replace_callback('/{include \"(.+?)\"}/i', create_function('$matches', 'return file_get_contents($matches[1]);'), $skin);

    return $skin;
  }

  function callback($matches) {
    return $matches[1];
  }
}

class main_skin extends skin {
  function main_skin($filename) {
    global $CONF, $DB, $FORM, $LNG, $TIMER, $TMPL;

    $this->filename = $filename;

    // Number of members
    list($TMPL['num_members']) = $DB->fetch("SELECT COUNT(*) FROM {$CONF['sql_prefix']}_sites WHERE active = 1", __FILE__, __LINE__);

    // Build the multiple pages menu
    if ($TMPL['num_members'] > $CONF['num_list']) {
      $num = $TMPL['num_members'];
      $done = 0;
      $TMPL['multiple_pages_menu'] = "<select name=\"start\">\n";
      while ($num > 0) {
        $start = $done * $CONF['num_list'] + 1;
        $end = ($done + 1) * $CONF['num_list'];
        if ($end >= $TMPL['num_members']) { $end = $TMPL['num_members']; }
        $FORM['start'] = isset($FORM['start']) ? $FORM['start'] : 1;

        if ($FORM['start'] == $start) {
          $TMPL['multiple_pages_menu'] .= "<option value=\"{$start}\" selected=\"selected\">{$start} - {$end}</option>\n";
        }
        else {
          $TMPL['multiple_pages_menu'] .= "<option value=\"{$start}\">{$start} - {$end}</option>\n";
        }

        $num = $num - $CONF['num_list'];
        $done++;
      }
      $TMPL['multiple_pages_menu'] .= '</select>';
    }
    else { $TMPL['multiple_pages_menu'] = ''; }
  
    // Build the ranking method menu
    $ranking_method = isset($FORM['method']) ? $FORM['method'] : $CONF['ranking_method'];
    $TMPL['ranking_methods_menu'] = '<select name="method">'."\n";
    if ($ranking_method == 'pv') { $TMPL['ranking_methods_menu'] .= "<option value=\"pv\" selected=\"selected\">{$LNG['g_pv']}</option>\n"; }
    else { $TMPL['ranking_methods_menu'] .= "<option value=\"pv\">{$LNG['g_pv']}</option>\n"; }
    if ($ranking_method == 'in') { $TMPL['ranking_methods_menu'] .= "<option value=\"in\" selected=\"selected\">{$LNG['g_in']}</option>\n"; }
    else { $TMPL['ranking_methods_menu'] .= "<option value=\"in\">{$LNG['g_in']}</option>\n"; }
    if ($ranking_method == 'out') { $TMPL['ranking_methods_menu'] .= "<option value=\"out\" selected=\"selected\">{$LNG['g_out']}</option>\n"; }
    else { $TMPL['ranking_methods_menu'] .= "<option value=\"out\">{$LNG['g_out']}</option>\n"; }
    $TMPL['ranking_methods_menu'] .= '</select>';
  
    // Build the categories menu and feed.php link
    $TMPL['feed'] = 'feed.php';
    $current_cat = isset($FORM['cat']) ? $FORM['cat'] : $LNG['main_all'];
    $TMPL['categories_menu'] = "<select name=\"cat\">\n";
    if ($current_cat == $LNG['main_all']) {
      $TMPL['categories_menu'] .= "<option value=\"\" selected=\"selected\">{$LNG['main_all']}</option>\n";
    }
    else {
      $TMPL['categories_menu'] .= "<option value=\"\">{$LNG['main_all']}</option>\n";
    }
    foreach ($CONF['categories'] as $cat => $skin) {
      if ($current_cat == $cat) {
        $TMPL['categories_menu'] .= "<option value=\"{$cat}\" selected=\"selected\">{$cat}</option>\n";
        $TMPL['feed'] .= "?cat={$cat}";
      }
      else {
        $TMPL['categories_menu'] .= "<option value=\"{$cat}\">{$cat}</option>\n";
      }
    }
    $TMPL['categories_menu'] .= '</select>';

    // Featured member
    if ($CONF['featured_member'] && $TMPL['num_members']) {
      $result = $DB->select_limit("SELECT username, url, title, description, banner_url FROM {$CONF['sql_prefix']}_sites WHERE active = 1 ORDER BY RAND()", 1, 0, __FILE__, __LINE__);
      $row = $DB->fetch_array($result);
      $TMPL = array_merge($TMPL, $row);

      $TMPL['featured_member'] = base::do_skin('featured_member');
    }

    $TMPL['query'] = isset($TMPL['query']) ? $TMPL['query'] : '';

    // Please do not remove the link to http://www.aardvarktopsitesphp.com/.
    // This is a free script, all I ask for is a link back.
    $TMPL['powered_by'] = $LNG['main_powered'].' <a href="http://www.aardvarktopsitesphp.com/"><b>Aardvark Topsites PHP</b></a> '.$TMPL['version'];

    // If you want to remove these links, you can; however, I would appreciate
    // it if you left them there.
    $TMPL['powered_by'] .= '<br /><a href="http://www.getonlinedegrees.org/">Online Masters Degree</a>';

    if (!isset($TMPL['content'])) { $TMPL['content'] = ''; }

    $TMPL['num_queries'] = $DB->num_queries;
    $TMPL['execution_time'] = $TIMER->get_time();
  }
}
?>
 
Zurück