Hallo Community,
und zwar gehts um folgendes. Ich habe hier einen Code bei mir, dass damals ohne Probleme lief, jetzt jedoch Probleme aufweist.
HTML-Code:
<?php
require('db.php');
session_start(); // startet die Session
$gfx_status[1] = '<img src="images/gruen.gif" width="15" height="15" border="0" alt="Admin">';
$gfx_status[0] = '<img src="images/rot.gif" width="15" height="15" border="0" alt="User">';
//--------------------- Upload-Einstellungen --------------------------------- //
$maxsize = "2097152"; // Maximale Uploadgroesse (4 mb)
$uploaddir = "galerie/upload/"; // Upload Ordner
$allowed_files = array(".jpg", ".gif", ".png"); // Erlaubte Dateien
// --------------------------------------------------------------------------- //
ob_start(); // startet den Ausgabepuffer
?>
<!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" xml:lang="de">
<head>
<title> SMNG-Senshi.com - Dateiupload || Euer Weg zum uploaden...</title>
<meta http-equiv="Content-Language" content="de" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="imagetoolbar" content="no" />
<style type="text/css">
<!--
/* Styleangabe
--------------------------------------*/
body {
margin: 0px;
color: #777;
background: #000000;
font: normal 12px Arial, Verdana, sans-serif;
}
#ram {
background: #000;
border: 2px solid #8fd9ff;
margin: 10px auto;
text-align: left;
width: 700px;
padding: 0px 15px;
}
h1#header {
height: 90px;
background: url('http://the-lastfighters.de/bilder/logo.png') left no-repeat;
border: none;
padding: 15px 0px 0px 115px;
font-size: 2.8em;
color: #8fd9ff;
margin: 0px;
}
#header small{
display: block;
font-size: 0.4em;
margin: 0px;
color: #acacac;
padding-left: 15px;
}
/* Headlines
------------------------------------------------------------------ */
h1, h2, h3, h4, h5, h6 {
margin: 0px 0px 10px;
font-family: 'Century Gothic', Tahoma, Verdana, Sans-serif;
border-bottom: 1px dotted #DDD;
font-weight: normal;
text-align: left;
color: #8fd9ff;
}
h1{
font-size: 1.8em;
}
h2{
font-size: 1.3em;
}
h3{
margin: 35px 0px 10px;
border-bottom: none;
border-top: 1px dotted #DDD;
font-size: 1.2em;
}
/* Verweise
------------------------------------------------------------------ */
A {
color: #777;
font-weight: bold;
text-decoration: underline;
}
A:visited {
color: #B5B5B5;
font-weight: normal;
text-decoration: none;
}
A:hover, A:active {
color: #8fd9ff;
text-decoration: underline;
}
/* Formulare
------------------------------------------------------------------ */
fieldset{
margin: 0px auto 15px;
border: 1px solid #8fd9ff;
padding: 10px;
width: 90%;
}
legend{
font-size: 1.4em;
color: #8fd9ff;
}
#upload label{
float: left;
width: 400px;
}
#login_form fieldset{
width: 425px;
}
#login_form input{
width: 200px;
}
#login_form input.button {
width: 120px;
}
input {
color: #8fd9ff;
background: #000000;
border: 1px solid #B5B5B5;
font-size: 0.9em;
height: 18px;
margin: 0px 0px 3px 0px;
}
input:hover, input:active, input:focus {
border: 1px solid #8fd9ff;
color: #777;
}
/* Error
------------------------------------------------------------------ */
.error{
padding: 5px;
margin: 5px 5px 20px;
border: 3px solid #8fd9ff;
}
.Stil1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 24px;
}
-->
</style>
</head>
<body>
<div id="ram">
<h1 id="header"><span class="Stil1">The-Lastfighters.de - Dateiupload</span> <small>Euer eigener Uploadweg ...</small></h1>
<br />
<?php
$action = strip_tags($_GET['action']);
$pfad = $_SERVER['PHP_SELF']; // generiert aktueller Pfad zur Datei
// -------------------------------- Logout --------------------------------------
if ($action == 'logout'){
session_unset();
session_destroy();
header("Location: $pfad"); // Weiterleitung
}
// ------------------------------------ Login ---------------------------------------
if ($_GET['del'] == 1) {
$uid = $_GET['id'];
$udn = $_GET['name'];
if ($uid != 1) {
$db->query("DELETE FROM user WHERE id = ".$uid."");
$message = 'User <strong>'.$udn.'</strong> gelöscht<br />'; $error = "0";
} else {
$message = 'Schnucki nicht dich selber löschen wollen ... <br />'; $error = "1";
}
if($error != "1"){ echo "<p>$message</p>" ;
}
if($error == "1"){
echo "<div class=\"error\"><h1>Error ...</h1>\n <p>$message</p></div>";
}
}
if(isset($_POST['uanlegen'])) {
$nuname = strip_tags($_POST['uname']);
$nupass = strip_tags($_POST['upass']);
$fu1 = $db->query("SELECT * FROM user WHERE user = '".$uname."' LIMIT 1");
if (!mysql_num_rows($fu1)) {
$db->query("INSERT INTO user (user,pass) VALUES ('".$nuname."','".md5($nupass)."')");
$message = 'User <strong>'.$nuname.'</strong> angelegt<br />'; $error = "0";
} else {
$message = 'Usernamen schon vorhanden oder Fehler ... <br />'; $error = "1";
}
if($error != "1"){ echo "<p>$message</p>" ;
}
if($error == "1"){
echo "<div class=\"error\"><h1>Error ...</h1>\n <p>$message</p></div>";
}
}
if (!isset($_SESSION['login'])){
if(isset($_POST['admin_login'])) {
$login_name = strip_tags($_POST['admin_name']);
$login_pass = strip_tags($_POST['admin_pass']);
$fu = $db->query("SELECT * FROM user WHERE user = '".$login_name."' LIMIT 1");
if (!mysql_num_rows($fu)) { $message .= 'Usernamen nicht gefunden ... <br />'; $error = "1"; }
$ful = mysql_fetch_array($fu);
echo $ful['user'].' '.$ful['pass'];
if(empty($login_name)) {
$message .= 'Bitte geben Sie ihren Usernamen ein ... <br />'; $error = "1";
}
if(empty($login_pass)) {
$message .= 'Bitte geben Sie ihr Passwort ein ... <br />'; $error = "1";
}
if($login_name != $ful['user'] OR md5($login_pass) != $ful['pass']){
$message .= 'Zugriff verweigert ... <br />'; $error = "1";
}
if($error != "1"){
// session handle-----------------------------
$_SESSION['login'] = $_SERVER['REMOTE_ADDR'];
$_SESSION['user'] = $login_name;
$_SESSION['admin'] = $ful['status'];
header("Location: $pfad");
}
if($error == "1"){
echo "<div class=\"error\"><h1>Error ...</h1>\n <p>$message</p></div>";
}
} // LoginFormular ausgeben
?>
<form action="" method="post">
<fieldset style="width: 300px">
<legend>Login</legend>
<label for="user">Username: </label>
<input type="text" name="admin_name" style="width: 250px" />
<label for="passwort">Passwort: </label>
<input type="password" name="admin_pass" style="width: 250px" />
<br /><br />
<input type="submit" value=" Login " name="admin_login" />
</fieldset>
</form>
<?php
} //------------------------------------- Login ENDE -----------------
...
Jedoch bekomme ich nun ständig die Fehlermeldung:
HTML-Code:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /www/htdocs/xxxxxx/db.php:58) in /www/htdocs/xxxxxx/dateiupload.php on line 4
so als wolle der mir die Cookies nicht speichern wollen. Was ich jedoch nicht verstehe. Würde mich um Hilfe freuen.
Lg Reika