art-d-sign
-


Hinweise


Antwort
 
LinkBack Themen-Optionen Thema durchsuchen Thema bewerten
Alt 18.02.2003, 16:52   #1
TP-Veteran
 
Benutzerbild von Flow09
 
Registriert seit: Jun 2001
Ort: Wien
Flow09 ist auf einem guten Weg
Question

Problem mit Cookies


Hey Leute!

Ich hab ein Problem mit PHP und Cookies!

Ehrlich gesagt, beschäftige ich mich erst seit gestern Richtig mit den Cookies und hab somit eigentlich null Erfahrung mit den Dingern!

Mein Problem hängt mit der Lebenszeit der Dinger zusammen!

Ich setzte z.B. folgendes Cookie:

PHP-Code:
SetCookie("log_user"$usernametime()+10
Mit der Angabe time()+10 sollte das Ding ja 10 Sek. nach dem setzen ungültig sein und man sollte nicht mehr darauf zugreifen können. Das klappt aber irgendwie nicht so ganz!
Ich 5 Min. warten und die Informationen noch immer auslesen!

Hab ich da jetzt was falsch verstanden oder mach ich was falsch???

lg
Flow
__________________
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
Flow09 ist offline   Mit Zitat antworten


Alt 18.02.2003, 17:43   #2
TP-Supporter
 
Benutzerbild von P4r4
 
Registriert seit: Feb 2002
P4r4 ist auf einem guten Weg
Hi,

also so der Cookie-freak bin ich ja eigendlich auch nicht, aber soweit ich weis hält ein Cookie bei dem dieser Parameter ausgelassen wurde eine Session.
Ich denke mal, dass eine Session somit immer zugrunde liegt.
Deshalb vermute ich mal so, dass diese 10 sek. erst zählen nach dem verlassen der Seite. (nur ne Hypothese).
cYa
P4r4 ist offline   Mit Zitat antworten
Alt 19.02.2003, 10:07   #3
TP-Veteran
 
Benutzerbild von Flow09
 
Registriert seit: Jun 2001
Ort: Wien
Flow09 ist auf einem guten Weg
Unhappy

Nein leider, ich mach alle Brwoser Fenster zu und wart mehr als 10 Sek. und das Cookie ist immernoch aktiv!

lg
Flow
__________________
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
Flow09 ist offline   Mit Zitat antworten
Alt 19.02.2003, 10:37   #4
TP-Supporter
 
Benutzerbild von Filou
 
Registriert seit: Aug 2002
Ort: Erde
Filou macht alles soweit korrekt

Re: Problem mit Cookies


Zitat:
Original geschrieben von Flow09
PHP-Code:
SetCookie("log_user"$usernametime()+10
Mit der Angabe time()+10 sollte das Ding ja 10 Sek
demnach dürfte es irgendwo anders bei deinem script möglicherweise scheitern, weil du den cockiebefehl richtig ausführst.

ciao filou
__________________
ich liebe dich, Hans-Jörg. gebt schwulen gleiche rechte.
erst wenn wir alles verloren haben, haben wir die freiheit alles zu tun.(tyler durden)
Filou ist offline   Mit Zitat antworten
Alt 19.02.2003, 10:57   #5
TP-Veteran
 
Benutzerbild von Flow09
 
Registriert seit: Jun 2001
Ort: Wien
Flow09 ist auf einem guten Weg
Question

Hier is mal der bedeutende Teil von dem Script. Vielleicht mach ich wirklich was falsch!

PHP-Code:
while ($row mysql_fetch_array($ergebnis))
{

    
$pw_md5 md5($passw);

    if (
$pw_md5 == $row[2])
    {
        
SetCookie("log_user"$row[1], time()+10);
        
SetCookie("log_intranet"$row[4]);
        
SetCookie("log_damage"$row[5]);
        
//echo $log_user."<br>\n";
        //echo $log_intranet."<br>\n";
        
echo "OK<br>\n";
    }
    else
    {
        echo 
"Login fehlgeschlagen";
    }

Was über dem Code passiert ist die SQL-Abfrage mehr nicht!

lg
Flow

P.S.: Mir is jetzt aufgefallen das das Cokkie irgendwann doch ungültig wird, aber nach welcher Zeit das kann ich jetzt nicht einschätzen!
__________________
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
Flow09 ist offline   Mit Zitat antworten
Alt 19.02.2003, 11:38   #6
TP-Supporter
 
Benutzerbild von Filou
 
Registriert seit: Aug 2002
Ort: Erde
Filou macht alles soweit korrekt
SetCookie("log_user", $row[1], time()+10);
SetCookie("log_intranet", $row[4]);
SetCookie("log_damage", $row[5]);

wozu dienen log_intranet und log_damage, mit den beiden zeilen löscht du das cookie.

andere frage noch, mysql_fetch_array($ergebnis);
woraus liesst du das aus. zeig mal abfrage, wenn db

ciao filou
__________________
ich liebe dich, Hans-Jörg. gebt schwulen gleiche rechte.
erst wenn wir alles verloren haben, haben wir die freiheit alles zu tun.(tyler durden)
Filou ist offline   Mit Zitat antworten
Alt 19.02.2003, 11:59   #7
TP-Veteran
 
Benutzerbild von Flow09
 
Registriert seit: Jun 2001
Ort: Wien
Flow09 ist auf einem guten Weg
Ähhh,

warum sollten die beiden Zeilen das Cookie löschen??? Sind ja verschiedene Namen!?!

PHP-Code:
SetCookie ("log_user"); 
würde das Cookie löschen!

Ich hab ja auch kein Problem mit dem erstellen des Cookies, das funktioniert Problemlos (ich schau mir ja jedesmal den Inhalt an)!

Es geht ums ungültig werden!
__________________
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
Flow09 ist offline   Mit Zitat antworten
Alt 19.02.2003, 12:12   #8
TP-Supporter
 
Benutzerbild von Filou
 
Registriert seit: Aug 2002
Ort: Erde
Filou macht alles soweit korrekt
ich sprach auch nicht von SetCookie("log_user", $row[1], time()+10); das setzt den cookie ja für 10 sekunden, sondern die anderen 2 ohne zeitangabe

poste mal das ganze script bitte.

ciao filou
__________________
ich liebe dich, Hans-Jörg. gebt schwulen gleiche rechte.
erst wenn wir alles verloren haben, haben wir die freiheit alles zu tun.(tyler durden)
Filou ist offline   Mit Zitat antworten
Alt 19.02.2003, 12:44   #9
TP-Veteran
 
Benutzerbild von Flow09
 
Registriert seit: Jun 2001
Ort: Wien
Flow09 ist auf einem guten Weg
Question

Mir is gerade was anderen eingefallen!

Es geht schlussendlich darum das ich mit einem anderen Script abfrage ob die Variable $log_user gesetzt ist!

PHP-Code:
if (isset($log_user))
{
blablabla
}
else
{
blabla

Iregdwie hab ich so das blöde Gefühl, dass das nicht der richtige Weg ist um zu überprüfen ob der Cookie noch´gültig ist oder nicht!

lg
Flow
__________________
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
Flow09 ist offline   Mit Zitat antworten
Alt 19.02.2003, 12:50   #10
TP-Veteran
 
Benutzerbild von Flow09
 
Registriert seit: Jun 2001
Ort: Wien
Flow09 ist auf einem guten Weg
Hab jetzt unter PHP.net nachgeschaut... Die machen's auch mit isset()!!!
__________________
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
Flow09 ist offline   Mit Zitat antworten
Antwort

  Aktuelles Thema
  TP Hilfe Forum > Web-Editoren & Coding > Traum-Dynamik
Problem mit Cookies Problem mit Cookies
« Installation von ImageMagick? Wie erkennt PHP die neuen Funktionen? | Formular auch nach Fehlern ausgefüllt ...? »

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu


Alle Zeitangaben in WEZ +2. Es ist jetzt 21:33 Uhr.

Powered by: vBulletin Version 3.7 (Deutsch)
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd. / Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.
Traum-Projekt.com | Suchen | Archiv | Impressum | Kontakt | | | Nach oben |



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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67

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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67