[Klone-users] (no subject)
Radek
radek.hnilica at gmail.com
Fri Dec 21 10:26:51 EST 2007
Hello,
what's wrong on following code:
-------[ component/user.kl1 ]--------
<%! /* -*- mode:c;coding:utf-8; -*- */
/*
* $Id:$
* User component. Display username and allows login ang logout.
* Copyright (c) 2007 Radek Hnilica
* All rights reserved. Všechna práva vyhrazena.
*/
#include "sawi.h"
#include "login.h"
%><%
/*
* Component variables. Should be in separate structure to do not mix
* with other variables and other component variables.
*/
struct {
char *username;
char *logout;
} user_kl1;
user_kl1.username = session_get(session, "username");
user_kl1.logout = request_get_arg(request, "logout");
if (strcmp(user_kl1.logout, "1") == 0) {
session_del(session, "username"); // <-------- there program fails
}
%>
<% if (user_kl1.username) { %>
Jste přihlášen jak <%= user_kl1.username %>[<a
href="<%=SCRIPT_NAME%>?logout=1">Odhlásit</a>]
<% } else { %>
Nejste přihlášen [Přihlásit]
<% } %>
DBG: .logout=<%=user_kl1.logout%>;
session.username=<%=session_get(session,"username")%>
--------------------------------------------------------
When entering page test.kl1 which usess indirectly component user.kl1
the daemon fails with
./run: line 5: 28513 Segmentation fault ./sawid -dF -f debug.conf
After commenting out the session_del line program works.
The component user.kl1 just displays the string You are connected as
<username> or you are not connected depending on username variable in
session.
--
-- Radek
More information about the klone-users
mailing list