Return-Path: Delivered-To: apmail-perl-embperl-archive@www.apache.org Received: (qmail 83919 invoked from network); 9 Dec 2004 15:23:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 9 Dec 2004 15:23:30 -0000 Received: (qmail 81594 invoked by uid 500); 9 Dec 2004 15:22:49 -0000 Delivered-To: apmail-perl-embperl-archive@perl.apache.org Received: (qmail 81337 invoked by uid 500); 9 Dec 2004 15:22:42 -0000 Mailing-List: contact embperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list embperl@perl.apache.org Received: (qmail 81239 invoked by uid 99); 9 Dec 2004 15:22:39 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=HTML_40_50,HTML_MESSAGE,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of wschroed@schroedernet.net designates 64.81.147.225 as permitted sender) Received: from home.schroedernet.net (HELO home.schroedernet.net) (64.81.147.225) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 09 Dec 2004 07:22:34 -0800 Received: from home.schroedernet.net (localhost [127.0.0.1]) by home.schroedernet.net (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id iB9FMDfT025302 for ; Thu, 9 Dec 2004 09:22:14 -0600 Received: (from nobody@localhost) by home.schroedernet.net (8.12.10/8.12.10/Submit) id iB9FMDoO025301; Thu, 9 Dec 2004 09:22:13 -0600 X-Authentication-Warning: home.schroedernet.net: nobody set sender to wschroed@schroedernet.net using -f Received: from 4.19.111.130 (SquirrelMail authenticated user wschroed); by home.schroedernet.net with HTTP; Thu, 9 Dec 2004 09:22:13 -0600 (CST) Message-ID: <29927.4.19.111.130.1102605733.squirrel@4.19.111.130> Date: Thu, 9 Dec 2004 09:22:13 -0600 (CST) Subject: session question From: "Will Schroeder" To: embperl@perl.apache.org User-Agent: SquirrelMail/1.4.3a X-Mailer: SquirrelMail/1.4.3a MIME-Version: 1.0 Content-Type: multipart/mixed;boundary="----=_20041209092213_94533" X-Priority: 3 (Normal) Importance: Normal X-Scanned-By: MIMEDefang 2.43 X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N ------=_20041209092213_94533 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit I have used embperl with great success in a number of projects but I have never needed to keep session information until now and I find myself a little confused. Here is the dilemma: I can insert session info into mysql but I am not sure how to go about restoring session data. I have a form that has two radio buttons 1: Have a login 2: Need a login. If the user submits "need" a form opens that accepts a username and a PIN. After submitting that information I move the user through a few quiz questions save the data and exit. The %udat works great when the app is used this way. The problem I have is restoring session data when I open new pages. The $udat{_session_id} prints out the session number yet I can not get $udat{User}. I have a feeling that I need the $r - GetSession somehow but when I use that [- $r -> GetSession -] I get a "Can't call method "GetSession" on an undefined value" error. What do I need to do here??? I have attached the main form and inlined some other relevent snippets. BTW: when I get this to work I will be more that happy to fully document what I did post it back here. Apache 1.3.33, embperl 1.3.6, mod_perl 1.2.9, apache::session 1.6, apache::sessionX 2.00b5 The Trying to restore session page: [- use Apache::Session::MySQL; -] [- use Apache; -] [- use DBI; -] [- $req = shift; -] [- $r -> GetSession; -]

[+ $udat{_session_id} +]

[+ $udat{Token} +]

[- $cookie = $udat{_session_id}; -] [- my %session; -] [- tie %session, 'Apache::Session::MySQL', $cookie, { DataSource => 'dbi:mysql:sessions', #these arguments are UserName => 'sessions', #required when using Password => 'sessions', #MySQL.pm LockDataSource => 'dbi:mysql:sessions', LockUserName => 'sessions', LockPassword => 'sessions' }; -] #################################################### httpd.conf options PerlSetEnv EMBPERL_OBJECT_BASE base.epl PerlSetEnv EMBPERL_OBJECT_APPNAME infosec PerlSetEnv EMBPERL_ESCMODE 0 #PerlSetEnv EMBPERL_OPTIONS 262144 PerlSetEnv EMBPERL_OBJECT_OPTIONS 16 #PerlSetEnv EMBPERL_DEBUG 2097152 #PerlSetEnv EMBPERL_LOG "/tmp/embperl.log" PerlSetEnv EMBPERL_SESSION_ARGS "DataSource=dbi:mysql:session;hostname=localhost UserName=sessions Password=password" PerlSetEnv EMBPERL_SESSION_CLASSES "MySQL Semaphore" PerlSetEnv EMBPERL_OBJECT_FALLBACK xerror.html Notice: This e-mail and any attachments are confidential and may be subject to legal or some other professional privilege. They are intended solely for the attention and use of the named addressee(s). They must not be disclosed to any person without authorisation. This e-mail and any attachments are also subject to copyright. They may only be copied or distributed with the consent of the copyright owner. If you are not named addressee you must not use, disclose, retain or reproduce all or any part of the information contained in this e-mail or any attachments. ------=_20041209092213_94533 Content-Type: text/html; name="PreAuth.html" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="PreAuth.html" [- $req = shift; -] [- $User = $fdat{User} -] [- $Token = $fdat{Token} -] [- $udat{User} = $User -] [- $udat{Token} = $Token -] [- $HaveLogin = $fdat{Login} -] [$ if $User eq "" && $Token eq "" && $HaveLogin eq "" $]

Starting Out

I have a login


I need to get a login


[$ endif $] [# <----------------------##########################----------------------------> #] [$ if $HaveLogin eq "HaveLogin" $]

[+ $udat{_session_id} +]

[+ $udat{User} +]

Please enter your LAN ID and the PIN.

Please Enter your Lan ID


Please Enter your PIN

Go Back [$ endif $] [# <----------------------##########################----------------------------> #] [$ if $HaveLogin eq "NeedLogin" && $User eq "" && $Token eq "" $]

Please note the following information. You will need it to access the quiz

Please Enter your Lan ID


[- $Token = int( rand 10000000000000 ) -] [- sleep 1; -] [# Check to ensure the password is Unique #] [- $rc = $req->{QuizSelect} -> prepare ("SELECT Token from WebQuiz.User where User.Token = '$Token' " ); -] [- $Val = $rc->execute(); -] [$ if ( $Val == "0E0" ) $]
Go Back [$ endif $] [$ endif $] [$ if $User ne "" && $Token ne "" $] [# Check to ensure That the user name's Unique #] [- $rc = $req->{QuizSelect} -> prepare ("SELECT UserName from WebQuiz.User where User.UserName like '$User' " ); -] [- $Val = $rc->execute(); -] [$ if ( $Val == "0E0" ) $] [- $sth = $req->{QuizInsert} -> do ("INSERT INTO WebQuiz.User VALUES('$User','$Token','$udat{_session_id}')" ); -]

User Info: [+ $User +] [+ $Token +]

Please remember this info. You will need it if you have to retake the quiz




Your Information has been submitted. Continue with the quiz.

There are 27 questions please finish the quiz once you begin.

[$ else $]

It looks like you already have a login. Call x7432 for help

[$ endif $] [$ endif $] ------=_20041209092213_94533 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org For additional commands, e-mail: embperl-help@perl.apache.org ------=_20041209092213_94533--