Hi,
I have just uploaded an older PHP project I have written by myself up to my
new webserver. On this server PHP is running in version 4.3.2 and this seems
to result in some trouble, since the project worked out pretty fine some
weeks ago under PHP 4.2.3 (I think).
My suggestion is that it has to do sth. with sessionhandling, but I am not
sure.
I don't think that the DB connection is responsible for the problems and I
have already checked that register_globals is switched on.
I always get the message "Das von Ihnen eingegebene Login oder Passwort ist
inkorrekt".
Here the source:
<?
// Init session handling
session_start();
// Include settings files
include("./config/config_db_design.inc.php");
// Include DB functionality
include("./db.php");
// Connect to DB via DB class
$DB = new DB;
$DB->init();
// Booleans needed for login process
$login_entered = true;
$password_entered = true;
$error_message = "";
// Check whether form has already been sent
if (isset($_POST['submit']))
{
// If no menu function has been called, continue with login process
if ( !(isset($_POST['action'])) )
{
// Check for empty user name
if(!$_POST[$users_user_login] || $_POST[$users_user_login] == "")
{
$login_entered = false;
$error_message_1 = "Sie haben keinen Benutzernamen angegeben.";
}
// Check for empty password
if(!$_POST['password'] || $_POST['password'] == "")
{
$password_entered = false;
$error_message_2 = "Sie haben kein Passwort angegeben.";
}
if ($login_entered && $password_entered)
{
// Retrieve correct dataset
$password = md5($password);
$data = $DB->select("SELECT * FROM $table_users WHERE
$users_user_login='$login' AND $users_user_password='$password'");
$count = count($data);
if ($count == 1)
{
// Store session variables
$logged_in_user_id = $data[0][$users_user_id];
$password = $data[0][$users_user_password];
$nachname = $data[0][$users_user_nachname];
$vorname = $data[0][$users_user_vorname];
$email = $data[0][$users_user_email];
$status = $data[0][$users_user_status];
session_register('logged_in_user_id');
session_register('password');
session_register('nachname');
session_register('vorname');
session_register('email');
session_register('status');
header("location:main.php");
}
else
{
$error_message_3 = "Das von Ihnen eingegebene Login und oder Passwort ist
inkorrekt.";
}
}
}
}
// Check whether password reset function has been invoked
if (isset($_POST['submit2']))
{
// Retrieve correct dataset
$data = $DB->select("SELECT * FROM $table_users WHERE
$users_user_email='$email'");
$count = count($data);
if ($count == 1)
{
// Set mail address and determine user id for updating
$user_id = $data[0][$users_user_id];
$mail_address = $email;
include("./logic/reset.tpl.php");
$error_message_1 = "Die neuen Zugangsdaten wurde Ihnen übermittelt.
<br>Bitte loggen Sie sich nun ein.";
}
else
{
$error_message_1 = "Die von Ihnen angegebene E-Mail Adresse ist inkorrekt.";
$action = "password";
}
}
// Check if some additional menu function has been called
$content_template = "";
if ( strcmp($action,"password") == 0)
{
$content_template = "./index/content_index_password.tpl.php";
}
if ( strcmp($action,"hilfe") == 0)
{
$content_template = "./help/help.tpl.php";
}
if ( strcmp($action,"feature_list") == 0)
{
$content_template = "./index/content_index_feature_list.tpl.php";
}
if ( strcmp($action,"impressum") == 0)
{
$content_template = "./index/content_index_impressum.tpl.php";
}
if ( strcmp($action,"") == 0)
{
$content_template = "./index/content_index.tpl.php";
}
?>
<html>
<head>
<title>Login</title>
<link rel="stylesheet" type="text/css" href="./style1.css">
</head>
<body>
<!-- Layout / Design table -->
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"
cellclass="designtable1_top">
<tr height="15%">
<td colspan="2" class="designtable1_top">
<? include("./layout/include_layout_top.tpl.php"); ?>
</td>
</tr>
<tr height="75%">
<td width="15%" class="designtable1_left">
<? include("./menu_templates/menu_index.tpl.php"); ?>
</td>
<td class="designtable1_main">
<!-- Main content -->
<? include($content_template); ?>
</td>
</tr>
</table>
</body>
</html>
Thanks for your help !