hi i cannot sustain a session. i login to my app. it shows my login name as i programmed. when i refresh the page it stays there. but when i refresh for the second time my session name and other things goes away and instead i see what is there for the not loginned case.
I think i miss something in hunchentoot session hadling.
;all html generated by a macro:
(defmacro ff (tag) `(defun ,tag (&rest c) (with-output-to-string (*standard-output*) (format t "<~a ~{~a='~a' ~}> ~{~a ~}</~a>" ',tag (car c) (cdr c) ',tag))))
;;defining all tag functions: (progn (ff html) (ff title) (ff head) (ff meta) (ff link) (ff style) (ff script) (ff body) (ff span) (ff div) (ff section) (ff p) (ff form) (ff input) (ff button) (ff textarea) (ff a) (ff h1) (ff h2) (ff h3) (ff h4) (ff h5) (ff h6) (ff ol) (ff ul) (ff li))
;authentication utilities used by the home page function at the bottom:
(defun signed-in-p () (if (and (boundp '*session*) (session-value '*signed-in *session*)) t nil))
(defun signed-up-p (x y) (if (with-connection *conn1spec* (query (:select 'username 'password :from 'users.users :where (:and (:= 'username x) (:= 'password y))))) t nil))
(defun sign-in () (let ((username (parameter "username")) (password (parameter "password"))) (if (signed-up-p username password) (progn (start-session) (setf (session-value '*username) username) (setf (session-value '*signed-in) t) (morph-status-plate (session-value '*username))) (with-output-to-string (s) (princ (morph-sign-in-form) s) (princ "No record found!" s) (princ (a (list :href "/form-sign-up") "Sign up") s) )))) ;the data base querying functions are working correctly ;views generated:
(defun morph-write-button () (div (list :style "border:1px solid; float:left;") (a (list :href "/writingp") "write")))
(defun morph-status-plate (username) (div (list :id "status-plate" :style "border:1px solid; float:left;") (span () "123 users online") (span () username) (button (list :onclick "ajaxlogout()") "logout")))
(defun morph-sign-in-form () (div (list :id "sign-in-form" :style "border:1px solid; float:left;") (form (list :method "" :action "") (input (list :id "username" :type "input" :name "username")) (input (list :id "password" :type "input" :name "password")) (input (list :onClick "ajaxsignin()" :type "button" :value "login")))))
;at last ;the page i generate as home page: (div (list :id "sign-in-form-or-status-plate" :style "height: 45px; border: 1px solid; float:left;") (if (signed-in-p);;;;;; (with-output-to-string (s) (start-session) (princ (morph-status-plate (session-value '*username)) s) (princ (morph-write-button) s)) (with-output-to-string (s) (princ (morph-sign-in-form) s) (princ (a (list :href "form-sign-up") "Sign up") s))))
my problem persists. once it has gone but i could not figure out how. but now the problem is back. any help?
On Wed, Mar 12, 2014 at 7:19 PM, Faruk S. Can farukscan@gmail.com wrote:
hi i cannot sustain a session. i login to my app. it shows my login name as i programmed. when i refresh the page it stays there. but when i refresh for the second time my session name and other things goes away and instead i see what is there for the not loginned case.
I think i miss something in hunchentoot session hadling.
;all html generated by a macro:
(defmacro ff (tag) `(defun ,tag (&rest c) (with-output-to-string (*standard-output*) (format t "<~a ~{~a='~a' ~}> ~{~a ~}</~a>" ',tag (car c) (cdr c) ',tag))))
;;defining all tag functions: (progn (ff html) (ff title) (ff head) (ff meta) (ff link) (ff style) (ff script) (ff body) (ff span) (ff div) (ff section) (ff p) (ff form) (ff input) (ff button) (ff textarea) (ff a) (ff h1) (ff h2) (ff h3) (ff h4) (ff h5) (ff h6) (ff ol) (ff ul) (ff li))
;authentication utilities used by the home page function at the bottom:
(defun signed-in-p () (if (and (boundp '*session*) (session-value '*signed-in *session*)) t nil))
(defun signed-up-p (x y) (if (with-connection *conn1spec* (query (:select 'username 'password :from 'users.users :where (:and (:= 'username x) (:= 'password y))))) t nil))
(defun sign-in () (let ((username (parameter "username")) (password (parameter "password"))) (if (signed-up-p username password) (progn (start-session) (setf (session-value '*username) username) (setf (session-value '*signed-in) t) (morph-status-plate (session-value '*username))) (with-output-to-string (s) (princ (morph-sign-in-form) s) (princ "No record found!" s) (princ (a (list :href "/form-sign-up") "Sign up") s) )))) ;the data base querying functions are working correctly ;views generated:
(defun morph-write-button () (div (list :style "border:1px solid; float:left;") (a (list :href "/writingp") "write")))
(defun morph-status-plate (username) (div (list :id "status-plate" :style "border:1px solid; float:left;") (span () "123 users online") (span () username) (button (list :onclick "ajaxlogout()") "logout")))
(defun morph-sign-in-form () (div (list :id "sign-in-form" :style "border:1px solid; float:left;") (form (list :method "" :action "") (input (list :id "username" :type "input" :name "username")) (input (list :id "password" :type "input" :name "password")) (input (list :onClick "ajaxsignin()" :type "button" :value "login")))))
;at last ;the page i generate as home page: (div (list :id "sign-in-form-or-status-plate" :style "height: 45px; border: 1px solid; float:left;") (if (signed-in-p);;;;;; (with-output-to-string (s) (start-session) (princ (morph-status-plate (session-value '*username)) s) (princ (morph-write-button) s)) (with-output-to-string (s) (princ (morph-sign-in-form) s) (princ (a (list :href "form-sign-up") "Sign up") s))))
morph composes home-page has changed (defun morph-columns1 () (html () (head () (link (list :rel "stylesheet" :href "reset.css")) (link (list :rel "stylesheet" :href "main.css")) (script () +js-sign-in+ +js-logout+ +jswritingdesk+ +jssavewriting+ +jsnotepad+))
(body ()
(morph-categories-axis) (morph-time-axis) (div (list :style "height: 45px; border: 1px solid;") (morph-name) (morph-search)
(div (list :id "online-xor-offline" :style "height: 45px; border: 1px solid; float:left;") (if (signed-in-p);!!!t
(div (list :id "if-online") (div (list :id "numbers-online" :style "border:1px solid; float:left;") "123 users online") (div (list :id "username" :style "border:1px solid; float:left;") (session-value '*username));!!!"sess val" (button (list :onclick "ajaxlogout()") "logout") (a (list :onclick "writingdesk()") "writing desk") (a (list :onclick "notepad()") "note pad") (a (list :onclick "published()") "published") (a (list :onclick "preferences()") "preferences"))
(div (list :id "if-offline") (morph-sign-in-form) (morph-signup-link) )))))))
On Sat, Mar 15, 2014 at 7:40 PM, Faruk S. Can farukscan@gmail.com wrote:
my problem persists. once it has gone but i could not figure out how. but now the problem is back. any help?
On Wed, Mar 12, 2014 at 7:19 PM, Faruk S. Can farukscan@gmail.com wrote:
hi i cannot sustain a session. i login to my app. it shows my login name as i programmed. when i refresh the page it stays there. but when i refresh for the second time my session name and other things goes away and instead i see what is there for the not loginned case.
I think i miss something in hunchentoot session hadling.
;all html generated by a macro:
(defmacro ff (tag) `(defun ,tag (&rest c) (with-output-to-string (*standard-output*) (format t "<~a ~{~a='~a' ~}> ~{~a ~}</~a>" ',tag (car c) (cdr c) ',tag))))
;;defining all tag functions: (progn (ff html) (ff title) (ff head) (ff meta) (ff link) (ff style) (ff script) (ff body) (ff span) (ff div) (ff section) (ff p) (ff form) (ff input) (ff button) (ff textarea) (ff a) (ff h1) (ff h2) (ff h3) (ff h4) (ff h5) (ff h6) (ff ol) (ff ul) (ff li))
;authentication utilities used by the home page function at the bottom:
(defun signed-in-p () (if (and (boundp '*session*) (session-value '*signed-in *session*)) t nil))
(defun signed-up-p (x y) (if (with-connection *conn1spec* (query (:select 'username 'password :from 'users.users :where (:and (:= 'username x) (:= 'password y))))) t nil))
(defun sign-in () (let ((username (parameter "username")) (password (parameter "password"))) (if (signed-up-p username password) (progn (start-session) (setf (session-value '*username) username) (setf (session-value '*signed-in) t) (morph-status-plate (session-value '*username))) (with-output-to-string (s) (princ (morph-sign-in-form) s) (princ "No record found!" s) (princ (a (list :href "/form-sign-up") "Sign up") s) )))) ;the data base querying functions are working correctly ;views generated:
(defun morph-write-button () (div (list :style "border:1px solid; float:left;") (a (list :href "/writingp") "write")))
(defun morph-status-plate (username) (div (list :id "status-plate" :style "border:1px solid; float:left;") (span () "123 users online") (span () username) (button (list :onclick "ajaxlogout()") "logout")))
(defun morph-sign-in-form () (div (list :id "sign-in-form" :style "border:1px solid; float:left;") (form (list :method "" :action "") (input (list :id "username" :type "input" :name "username")) (input (list :id "password" :type "input" :name "password")) (input (list :onClick "ajaxsignin()" :type "button" :value "login")))))
;at last ;the page i generate as home page: (div (list :id "sign-in-form-or-status-plate" :style "height: 45px; border: 1px solid; float:left;") (if (signed-in-p);;;;;; (with-output-to-string (s) (start-session) (princ (morph-status-plate (session-value '*username)) s) (princ (morph-write-button) s)) (with-output-to-string (s) (princ (morph-sign-in-form) s) (princ (a (list :href "form-sign-up") "Sign up") s))))
Upon login it shows the value of (session-value *'username) on the top of the page as desired. And when I refresh the page it is still ok. But when page is doubled for the second time it is gone and the elements that is programmed to be shown when (signed-in-p) is nil is shown.
On Sat, Mar 15, 2014 at 7:42 PM, Faruk S. Can farukscan@gmail.com wrote:
morph composes home-page has changed (defun morph-columns1 () (html () (head () (link (list :rel "stylesheet" :href "reset.css")) (link (list :rel "stylesheet" :href "main.css")) (script () +js-sign-in+ +js-logout+ +jswritingdesk+ +jssavewriting+ +jsnotepad+))
(body ()
(morph-categories-axis) (morph-time-axis) (div (list :style "height: 45px; border: 1px solid;") (morph-name) (morph-search) (div (list :id "online-xor-offline" :style "height: 45px; border: 1px solid;
float:left;") (if (signed-in-p);!!!t
(div (list :id "if-online") (div (list :id "numbers-online" :style "border:1px
solid; float:left;") "123 users online") (div (list :id "username" :style "border:1px solid; float:left;") (session-value '*username));!!!"sess val" (button (list :onclick "ajaxlogout()") "logout") (a (list :onclick "writingdesk()") "writing desk") (a (list :onclick "notepad()") "note pad") (a (list :onclick "published()") "published") (a (list :onclick "preferences()") "preferences"))
(div (list :id "if-offline") (morph-sign-in-form) (morph-signup-link) )))))))
On Sat, Mar 15, 2014 at 7:40 PM, Faruk S. Can farukscan@gmail.com wrote:
my problem persists. once it has gone but i could not figure out how. but now the problem is back. any help?
On Wed, Mar 12, 2014 at 7:19 PM, Faruk S. Can farukscan@gmail.comwrote:
hi i cannot sustain a session. i login to my app. it shows my login name as i programmed. when i refresh the page it stays there. but when i refresh for the second time my session name and other things goes away and instead i see what is there for the not loginned case.
I think i miss something in hunchentoot session hadling.
;all html generated by a macro:
(defmacro ff (tag) `(defun ,tag (&rest c) (with-output-to-string (*standard-output*) (format t "<~a ~{~a='~a' ~}> ~{~a ~}</~a>" ',tag (car c) (cdr c) ',tag))))
;;defining all tag functions: (progn (ff html) (ff title) (ff head) (ff meta) (ff link) (ff style) (ff script) (ff body) (ff span) (ff div) (ff section) (ff p) (ff form) (ff input) (ff button) (ff textarea) (ff a) (ff h1) (ff h2) (ff h3) (ff h4) (ff h5) (ff h6) (ff ol) (ff ul) (ff li))
;authentication utilities used by the home page function at the bottom:
(defun signed-in-p () (if (and (boundp '*session*) (session-value '*signed-in *session*)) t nil))
(defun signed-up-p (x y) (if (with-connection *conn1spec* (query (:select 'username 'password :from 'users.users :where (:and (:= 'username x) (:= 'password y))))) t nil))
(defun sign-in () (let ((username (parameter "username")) (password (parameter "password"))) (if (signed-up-p username password) (progn (start-session) (setf (session-value '*username) username) (setf (session-value '*signed-in) t) (morph-status-plate (session-value '*username))) (with-output-to-string (s) (princ (morph-sign-in-form) s) (princ "No record found!" s) (princ (a (list :href "/form-sign-up") "Sign up") s) )))) ;the data base querying functions are working correctly ;views generated:
(defun morph-write-button () (div (list :style "border:1px solid; float:left;") (a (list :href "/writingp") "write")))
(defun morph-status-plate (username) (div (list :id "status-plate" :style "border:1px solid; float:left;") (span () "123 users online") (span () username) (button (list :onclick "ajaxlogout()") "logout")))
(defun morph-sign-in-form () (div (list :id "sign-in-form" :style "border:1px solid; float:left;") (form (list :method "" :action "") (input (list :id "username" :type "input" :name "username")) (input (list :id "password" :type "input" :name "password")) (input (list :onClick "ajaxsignin()" :type "button" :value "login")))))
;at last ;the page i generate as home page: (div (list :id "sign-in-form-or-status-plate" :style "height: 45px; border: 1px solid; float:left;") (if (signed-in-p);;;;;; (with-output-to-string (s) (start-session) (princ (morph-status-plate (session-value '*username)) s) (princ (morph-write-button) s)) (with-output-to-string (s) (princ (morph-sign-in-form) s) (princ (a (list :href "form-sign-up") "Sign up") s))))