Gegen Bilderklau - Das Original (https://www.gegen-bilderklau.net/index.php)
- Design, Website, Copyright (https://www.gegen-bilderklau.net/board.php?boardid=80)
--- Homepagehilfe (https://www.gegen-bilderklau.net/board.php?boardid=27)
---- Homepagehilfe - Archiv (https://www.gegen-bilderklau.net/board.php?boardid=139)
----- [PHP & MySQL] PHP - session_start() (https://www.gegen-bilderklau.net/thread.php?threadid=129876)
Geschrieben von Maina am 08.03.2008 um 13:55:
PHP - session_start()
Whaha .___. Das will nicht. Und ich weiß, es ist primitiv. Und ich hatte den Fehler gestern schonmal, in 'nem anderen Script. Und da konnte ich den beheben. Nur da nicht -.-
acplogin2.php
php: |
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
|
<?php
$pw=$_POST['passwort'];
$uname=$_POST['name'];
include('config.inc.php');
$sql = "SELECT * FROM `members` WHERE `art` = 'team'";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
if($uname=="$row[name]" and $pw=="$row[pw]")
{
$yes ="1";
$job = "$row[job]";
$stat = "$row[stat]";
$id = "$row[id]";
}
}
mysql_close();
if($yes=="1"){
session_start();
$_SESSION["user_name"] =$uname;
$_SESSION["user_job"] =$job;
$_SESSION["user_stat"] =$stat;
$_SESSION["user_id"] =$id;
header("location: weiterleitung.php");
}
?> |
|
Fehlermeldungen:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/www/web52/html/spzmares/acp/acplogin2.php:

in /home/www/web52/html/spzmares/acp/acplogin2.php on line 30
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/www/web52/html/spzmares/acp/acplogin2.php:

in /home/www/web52/html/spzmares/acp/acplogin2.php on line 30
Warning: Cannot modify header information - headers already sent by (output started at /home/www/web52/html/spzmares/acp/acplogin2.php:

in /home/www/web52/html/spzmares/acp/acplogin2.php on line 35
Wäre für 'ne schnelle Hilfe dankbar...
Geschrieben von Maina am 10.03.2008 um 19:44:
Blupp. Niemand?
Geschrieben von Maina am 10.03.2008 um 20:19:
AAaaaanni. Darf ich dich knutschen? XD
Geschrieben von Maina am 13.03.2008 um 15:48:
jetzt gehts schooon wieder nicht ._.
Fehler:
Warning: Cannot modify header information - headers already sent by (output started at /home/www/web52/html/spzmares/login/main.php:2) in /home/www/web52/html/spzmares/login/checkuser.php on line 3
Code:
php: |
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
|
<?php
session_start();
$pw=$_POST['passwort'];
$uname=$_POST['name'];
include('config.inc.php');
$sql = "SELECT * FROM `members`";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
if($uname=="$row[name]" and $pw=="$row[pw]")
{
$yes ="1";
$job = "$row[job]";
$stat = "$row[stat]";
$id = "$row[id]";
}
}
mysql_close();
if($yes=="1"){
$_SESSION["user_name"] =$uname;
$_SESSION["user_job"] =$job;
$_SESSION["user_stat"] =$stat;
$_SESSION["user_id"] =$id;
header("location: index.php");
}
?> |
|
Ich weiß langsam echt nich mehr weiter... vorgestern gings noch, seit gestern nich mehr & ich hab nix am code gemacht ._.
Geschrieben von Maina am 13.03.2008 um 16:47:
Hm. Also. Das LogIn Script selber geht jetzt. Danke <3
Nur die checkuser will nicht (Jaaa, ich hab mit Uni's Tut gelernt.

)
Fehler:
Warning: Cannot modify header information - headers already sent by (output started at /home/www/web52/html/spzmares/login/main.php:2) in /home/www/web52/html/spzmares/login/checkuser.php on line 3
php: |
1:
2:
3:
4:
|
<?if($uname=="")
{
header ("location: login.php");
}?> |
|
Geschrieben von cll am 13.03.2008 um 16:51:
geht das nicht mit include? ich umgeh Fehler einfach....
Geschrieben von Maina am 13.03.2008 um 21:06:
Zitat: |
Original von reiterhofmeeresblick
Was ist denn mit der checkuser.php - Datei?
Ist die sicher nicht, oder?
Hast du ein Div, wo du Header & Footer includest? Oder ein Iframe? |
Ganz normales IFrame. ^^
Wie meinst du das, cll?
Also praktisch include('login.php'); ?
Geschrieben von Maina am 13.03.2008 um 21:17:
Auf jeder Seite, die zum Login gehört...
z.B.
index2.php
php: |
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
|
<?
@session_start();
$uname = $_SESSION["user_name"];
$job = $_SESSION["user_job"];
$stat = $_SESSION["user_stat"];
$id = $_SESSION["user_id"];
include "checkuser.php";
// Code by Unicorn, darf beliebig verändert werden
?><html>
<head>
<title>Sportpferdezentrum Mares - Version 1/2008</title>
<meta name="author" content="DScharf">
<link rel="stylesheet" href="http://spzmares.sp.funpic.de/spzmares/css.css" type="text/css">
</head>
<BODY marginwidth="0" leftmargin="0" marginheight="0" topmargin="0" scroll="no">
<img src="design2.png" border=0>
<div id="Layer1" style="position: absolute; left: 26px; top: 1px;">
<iframe src="menu.php" name="umenu" width="97" height="285" frameborder=0 scrolling="auto" noresize style="border: 0px" allowtransparency="true" style="FILTER: chroma (color=#ffffff)" ;>
</iframe>
</div>
<div id="Layer1" style="position: absolute; left: 252; top: 172px;">
<iframe src="main.php" name="content" width="548" height="391" frameborder=0 scrolling="auto" noresize style="border: 0px" allowtranspareny="true" style="FILTER: chroma (color=#ffffff)" ;>
</iframe>
</div>
<div id="Layer1" style="position: absolute; left: 135; top: 2px;">
<iframe src="newpn_index.php" name="pns" width="215" height="151" frameborder=0 scrolling="auto" noresize style="border: 0px" allowtranspareny="true" style="FILTER: chroma (color=#ffffff)" ;>
</iframe>
</div>
</body>
</html> |
|
Geschrieben von Maina am 13.03.2008 um 21:26:
Die Login will ja, die leitet zur index.php seite über (in der die index2.php drinne ist) und da kommts.
Geschrieben von Maina am 14.03.2008 um 15:27:
So.
Die Fehlermeldungen sind weg. Na immerhin.
Aber der loggt mich nich mehr ein... *hust*
Beispiel:
(mit Test & test einloggen)
http://web52.server10.greatweb.de/spzmares/login/login.php
& die Scripte (jetzt mal alles hier!

)
login.php
code: |
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
|
<html>
<head>
<title></title>
<meta name="author" content="Diana Scharf">
<link rel="stylesheet" href="http://photographed-life.de/spzmares/css.css" type="text/css">
</head>
<body>
<center>
<h2>LogIn . Einloggen</h2>
Du kommst nur rein, wenn du Vollmitglied bist & deine Daten hast (; Für Awardbewerter gibt es Testdaten, die erfragt<br>
werden müssen. Für Besucher machen wir nur selten Ausnahmen!<br>
<form action="loginneu.php" method="POST">
<b>Name</b> <input type="text" name="name"> <br>
<b>Passwort</b> <input type="password" name="passwort"> <br>
<br>
<input type="submit" value="Login" name="submit">
</form>
</body>
</html> |
|
loginneu.php
php: |
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
|
<?php
session_start();
header("location: index.php");
$pw=$_POST['passwort'];
$uname=$_POST['name'];
include('config.inc.php');
$sql = "SELECT * FROM `members`";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
if($uname=="$row[name]" and $pw=="$row[pw]")
{
$yes ="1";
$job = "$row[job]";
$stat = "$row[stat]";
$id = "$row[id]";
}
}
mysql_close();
if($yes=="1"){
$_SESSION["user_name"] =$uname;
$_SESSION["user_job"] =$job;
$_SESSION["user_stat"] =$stat;
$_SESSION["user_id"] =$id;
}
?> |
|
als Beispiel für interne Seite:
main.php
php: |
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
|
<?
@session_start();
$uname = $_SESSION["user_name"];
$job = $_SESSION["user_job"];
$stat = $_SESSION["user_stat"];
$id = $_SESSION["user_id"];
include "checkuser.php";
// Code by Unicorn, darf beliebig verändert werden
?>
<html>
<head>
<title></title>
<meta name="author" content="Diana Scharf">
<link rel="stylesheet" href="http://photographed-life.de/spzmares/css.css" type="text/css">
</head>
<body >
<center>
<h2>LogIn Bereich</h2><br>
<table width="90%" style="text-align: center;">
<tr><td colspan="2"><b>Heute ist der <?php $datum = date("j.n.Y"); echo $datum; ?>.</b></td></tr>
<tr><td rowspan="5"><img src="welcome1.png"></td><td><b>Willkommen im internen Bereich, <? echo $uname;?> (:</b><br>
Schön, dass du mal wieder da bist. Hier kannst du alles mögliche 'anstellen': Pferde versorgen, Arbeiten,
Lizenzen ablegen, deinen Stall verwalten und über die Bewerber entscheiden.<br>
<br>
Du bist <b><? echo $job;?></b>, hast den Status <? echo $stat;?> und die ID <? echo $id;?>.</td></tr>
<tr><td><b>Das Wetter</b><br>
<?php include('wetterausgabe.php'); ?></td></tr></table>
</body>
</html> |
|
Und jetzt bitte nicht über meinen 'Codingstil' wundern...
Ich bin ein Sorgenkind.
Geschrieben von Maina am 14.03.2008 um 15:36:
Fischii hat doch gesagt, über header dürfe nix stehen?
Auch, wenn ichs drunterpack, passiert nix andres.
Und solangs nicht stört, bleibts mysql_close() stehen. Das ist meine Lieblingsfunktion.
Geschrieben von cll am 14.03.2008 um 16:01:
vor session_start() darf schon Recht nichts stehn
Geschrieben von Maina am 14.03.2008 um 16:03:
Klappt eh schon.

Danki Eppi... wenn auch nich hier *.*
Forensoftware: Burning Board, entwickelt von WoltLab GmbH