Seite 1 von 2

Login-Formular funktioniert nicht mehr/willkürliche Logouts

Verfasst: 07.04.2007 01:09
von baerenwurm
Ich hab auf meiner Startseite ein Quick-Login-Formular, das (manchmal) nicht richtig funktioniert.
Z.B. hab ich mich eben damit eingeloggt und konnte meine Nachrichten unter "PrivMsg" lesen - ein Klick auf "Shop" loggte mich aber wieder aus. ([e] Nachtrag: Mitunter wird man nach einem Login auch gar nicht als eingeloggt angezeigt; das Problem tritt auch bei dem normalen Login-Formular unter "Login" auf - man wird dann uneingeloggt auf die Startseite weitergeleitet...)

(Zum Testen: user: test123, Passwort: test123)

Hier der relevante Teil meiner index_body.tpl:

Code: Alles auswählen

<table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
 <tr>
	<td align="left" valign="top">
	<!-- BEGIN switch_user_logged_out -->
	<div><img src="http://www.quentintarantino.de/images/collapse.gif" class="showstate" onClick="expandcontent(this, 'sc3')" />&nbsp;<span class="genwhite"><font color="#FF0000"><b>Anmelden</b></font></span></div>
	<div id="sc3" class="switchcontent">
<table border="0" align="left" cellpadding="0" cellspacing="0">
  <tr>
    <td>
<form method="post" action="{S_LOGIN_ACTION}">
	  <td><span class="gensmallwhite">{L_USERNAME}: 
		<input class="post" type="text" name="username" size="10" />
		&nbsp;{L_PASSWORD}:
		<input class="post" type="password" name="password" size="10" maxlength="32" />
		&nbsp;
		<!-- BEGIN switch_allow_autologin -->
		<input type="hidden" name="autologin" value="true" />
		<!-- END switch_allow_autologin -->
		<input type="submit" class="mainoption" name="login" value="{L_LOGIN}" />
		</span> </td>
</form>
</td>
  </tr>
</table>
   </div><!-- END switch_user_logged_out -->
	<!-- BEGIN switch_user_logged_in -->
	<div><img src="http://www.quentintarantino.de/images/collapse.gif" class="showstate" onClick="expandcontent(this, 'sc3')" />&nbsp;<span class="genwhite"><font color="#FF0000"><b>{L_WELCOME_REG}</b></font></span></div>
	<div id="sc3" class="switchcontent">
<table border="0" align="left" cellpadding="0" cellspacing="0">
  <tr>
    <td><span class="gensmallwhite"><b>{U_WELCOME_REG}, {LAST_VISIT_DATE}</b><br />{CURRENT_TIME}</span>
</td>
  </tr>
</table>
   </div><!-- END switch_user_logged_in --></td>

Das <div>-Zeugs ist von folgendem Script:

Code: Alles auswählen


<script type="text/javascript">

var enablepersist="on" //Enable saving state of content structure using session cookies? (on/off)
var memoryduration="999" //persistence in # of days

var contractsymbol='http://www.quentintarantino.de/images/collapse.gif' //Path to image to represent contract state.
var expandsymbol='http://www.quentintarantino.de/images/expand.gif' //Path to image to represent expand state.

function getElementbyClass(rootobj, classname){
var temparray=new Array()
var inc=0
var rootlength=rootobj.length
for (i=0; i<rootlength; i++){
if (rootobj[i].className==classname)
temparray[inc++]=rootobj[i]
}
return temparray
}

function sweeptoggle(ec){
var inc=0
while (ccollect[inc]){
ccollect[inc].style.display=(ec=="contract")? "none" : ""
inc++
}
revivestatus()
}


function expandcontent(curobj, cid){
if (ccollect.length>0){
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="none")? "none" : ""
curobj.src=(document.getElementById(cid).style.display=="none")? expandsymbol : contractsymbol
}
}

function revivecontent(){
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="none"
}

function revivestatus(){
var inc=0
while (statecollect[inc]){
if (ccollect[inc].style.display=="none")
statecollect[inc].src=expandsymbol
else
statecollect[inc].src=contractsymbol
inc++
}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="none")
selectedItem+=ccollect[inc].id+"|"
inc++
}
if (get_cookie(window.location.pathname)!=selectedItem){ //only update cookie if current states differ from cookie's
var expireDate = new Date()
expireDate.setDate(expireDate.getDate()+parseInt(memoryduration))
document.cookie = window.location.pathname+"="+selectedItem+";path=/;expires=" + expireDate.toGMTString()
}
}

function do_onload(){
uniqueidn=window.location.pathname+"firsttimeload"
var alltags=document.all? document.all : document.getElementsByTagName("*")
ccollect=getElementbyClass(alltags, "switchcontent")
statecollect=getElementbyClass(alltags, "showstate")
if (enablepersist=="on" && get_cookie(window.location.pathname)!="" && ccollect.length>0)
revivecontent()
if (ccollect.length>0 && statecollect.length>0)
revivestatus()
}

if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate

</script>

Verfasst: 08.04.2007 19:23
von baerenwurm
bump :oops:

Verfasst: 16.04.2007 16:48
von baerenwurm
Eben hab ich mich über das Quick-Login eingeloggt, ein wenig auf meinem Forum rumgeklickt, bis ich mir irgendwann wieder die Startseite hab anzeigen lassen, wo oben das Quick-Login-Formular angezeigt wurde - als sei ich nicht eingeloggt (gleichwohl ich noch in der "Wer ist online?"-Liste aufgeführt wurde).

Als ich kurze Zeit später in einem Forum auf "Post Reply" klickte, wurde ich auf die Startseite geworfen - wo dieses Mal (wie für alle eingeloggten user) statt dem Quick-Login-Formular "Willkommen im Forum!" angezeigt wurde (d.h. ich war anscheinend doch noch die ganze Zeit angemeldet). Sehr komisch :-?

Verfasst: 21.05.2007 17:32
von baerenwurm
Hat keiner eine Ahnung? Meine user klagen bereits darüber, dass sie sich 2-3 Mal einloggen müssen, bis es klappt :(

Verfasst: 21.05.2007 19:47
von Westpark
Kennst du schon den Edit Button?

Verfasst: 21.05.2007 20:44
von baerenwurm
Westpark hat geschrieben:Kennst du schon den Edit Button?
Ja. Bekomme halt seit über einem Monat keine Antwort...

Verfasst: 21.05.2007 20:48
von Miriam
Hast Du das mal gecheckt: KB:login

Verfasst: 21.05.2007 21:16
von baerenwurm
Danke für den Link, aber die Infos haben mir leider nicht weitergeholfen.

Vielleicht hilft euch ja ein Blick in meine functions.php & sessions.php!? (In beiden Dateien wurde aufgrund allerlei Mods (u.a. SEO URLs MOD) schon recht oft rumgeschnippelt.)

Wäre nett, wenn ihr mir helfen könntet - danke!

PS_ooopsss

Verfasst: 22.05.2007 18:11
von SZOMM
Also mal ehrlich,

wenn du die Links, die MIRIAM dir gepostet hat, wirklich studiert hättest
und den Board-Doctor benutzt hättest ... wärst du sicherlich irgendwo und irgendwie auf den/die Fehler in deinen Scripten gestossen ...

ZITAT:
Vielleicht hilft euch ja ein Blick in meine functions.php & sessions.php!? (In beiden Dateien wurde aufgrund allerlei Mods (u.a. SEO URLs MOD) schon recht oft rumgeschnippelt.)

Glaubst du, das irgendwer Bock darauf hat sich durch diesen ganzen Wust durchzuackern ???

Alle hier helfen gern, wenn sie können, (ich denken, das kann ich einfach mal so behaupten) und die Installation von MOD's hat auch bei sorgfältiger Vorgehensweise immer ein Restrisiko, aber wild MOD's reinbauen OHNE
nach jedem MOD die Funktionalität des Forums zu überprüfen und dann darauf hoffen ... IRGENDWER wirds schon richten ... ist doch ein wenig naiv, das sehe ich zumindest so ... Empfehle nochmals, die guten Links von Miriam zu befolgen und zu lernen, denn Lernen macht Spass !

... Dennoch viel Erfolg wünscht
Pèdà

Re: PS_ooopsss

Verfasst: 22.05.2007 19:10
von baerenwurm
SZOMM hat geschrieben:Also mal ehrlich,

wenn du die Links, die MIRIAM dir gepostet hat, wirklich studiert hättest
und den Board-Doctor benutzt hättest ... wärst du sicherlich irgendwo und irgendwie auf den/die Fehler in deinen Scripten gestossen ...
nein. Punkt 1 & 2 sind korrekt eingestellt. Wenn ich Punkt 3 so umsetze, komme ich z. B. nicht mehr in den Admin-Bereich; DB-Maintenance-MOD bringt ebenfalls nix.

[e] Ich vermute, es hängt irgendwie mit dem Quick-Login-Formular in der index_body.tpl zusammen:

Code: Alles auswählen

<form method="post" action="{S_LOGIN_ACTION}">
     <td><span class="gensmallwhite">{L_USERNAME}:
      <input class="post" type="text" name="username" size="10" />
      &nbsp;{L_PASSWORD}:
      <input class="post" type="password" name="password" size="10" maxlength="32" />
      &nbsp;
      <!-- BEGIN switch_allow_autologin -->
      <input type="hidden" name="autologin" value="true" />
      <!-- END switch_allow_autologin -->
      <input type="submit" class="mainoption" name="login" value="{L_LOGIN}" />
      </span> </td>
</form> 
oder mit den zwei anderen Cookie-Scripts, die nebenbei laufen:

#1

Code: Alles auswählen

var expDays = 360;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

etc.
#2

Code: Alles auswählen

 var enablepersist="on" //Enable saving state of content structure using session cookies? (on/off)
var memoryduration="999" //persistence in # of days

var contractsymbol='http://www.quentintarantino.de/images/collapse.gif' //Path to image to represent contract state.
var expandsymbol='http://www.quentintarantino.de/images/expand.gif' //Path to image to represent expand state.

function getElementbyClass(rootobj, classname){
var temparray=new Array()
var inc=0
var rootlength=rootobj.length
for (i=0; i<rootlength; i++){
if (rootobj[i].className==classname)
temparray[inc++]=rootobj[i]
}
return temparray
}

function sweeptoggle(ec){
var inc=0
while (ccollect[inc]){
ccollect[inc].style.display=(ec=="contract")? "none" : ""
inc++
}
revivestatus()
}


function expandcontent(curobj, cid){
if (ccollect.length>0){
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="none")? "none" : ""
curobj.src=(document.getElementById(cid).style.display=="none")? expandsymbol : contractsymbol
}
}

function revivecontent(){
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="none"
}

function revivestatus(){
var inc=0
while (statecollect[inc]){
if (ccollect[inc].style.display=="none")
statecollect[inc].src=expandsymbol
else
statecollect[inc].src=contractsymbol
inc++
}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="none")
selectedItem+=ccollect[inc].id+"|"
inc++
}
if (get_cookie(window.location.pathname)!=selectedItem){ //only update cookie if current states differ from cookie's
var expireDate = new Date()
expireDate.setDate(expireDate.getDate()+parseInt(memoryduration))
document.cookie = window.location.pathname+"="+selectedItem+";path=/;expires=" + expireDate.toGMTString()
}
}

function do_onload(){
uniqueidn=window.location.pathname+"firsttimeload"
var alltags=document.all? document.all : document.getElementsByTagName("*")
ccollect=getElementbyClass(alltags, "switchcontent")
statecollect=getElementbyClass(alltags, "showstate")
if (enablepersist=="on" && get_cookie(window.location.pathname)!="" && ccollect.length>0)
revivecontent()
if (ccollect.length>0 && statecollect.length>0)
revivestatus()
}

if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate