echo example

Xbase++ 2.0 Build 554 or later
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: echo example

#11 Post by rdonnay »

Zdeno -

Here is an application I would like you to look at.
I handle session data within the form.

DD787.PRG is a program written for the USS James E. Kyes (DD-787) webpage
to allow association members to RSVP that they will be attending the next
reunion.

It is called as follows:

http://localhost:8080/dd787/rsvp

Add DD787.PRG to your CxpHttpServer.Xpj project file.

You can now make several simultaneous connections to the server on different tab pages and form data will be handled correctly.

If you need to store login info or handle session timeouts, this can be done with hidden variables that are part of the form.

I will work on updating the program to show how to do that as soon as I have some more time available.
Attachments
dd787.zip
(5.13 KiB) Downloaded 683 times
The eXpress train is coming - and it has more cars.

bwolfsohn
Posts: 648
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: echo example

#12 Post by bwolfsohn »

Roger,

We struggled with session management for many years (over a decade) using xb2net. (not xb32net's problems, but problems in our approach. We finally fixed it on 2012, and haven't had any problems since... So few problems, i had forgotten how we handled it, because i haven't looked at the session management code since then!!! We handle upward of 300 legitimate very active sessions frequently. I'll be glad to go over our methods at the express++ devcon in a week...

Even though we use xb2net for our webservers, the approach we use will still fit within pure alaska (presuming they support the webserver functions needed
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: echo example

#13 Post by rdonnay »

I'll be glad to go over our methods at the express++ devcon in a week...
I'm looking forward to that.
I hope to spend half the time on internet stuff.
This is becoming too important for most Xbase++ developers.
There are simple approaches to most of the needs.
Your app goes way beyond what most of our needs are but it shows what is possible.
The eXpress train is coming - and it has more cars.

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: echo example

#14 Post by rdonnay »

Here is a much better version of DD787.PRG and RSVP787.HTM.

This is fully object-oriented now. It still has a DD787 class and a RSVPForm class but it is better structured.

RSVP787.HTM now contains a HIDDEN variable named timestamp and RSVPForm also contains an iVar named timestamp.

RSVPForm:getAllVars() now stores the current time as Str(Seconds()) into timestamp which in turn is embedded in the form by RSVPForm:stuffVars().

When the form is submitted to the server, the value of timestamp in the form is checked against the current time on the server.
If the user has not submitted the form within 5 minutes of it being sent to the browser, a timeout message will show in the form and the user must reenter all data. This is an example of session management. Test it by running localhost:8080/dd787/rsvp on several tabs simultaneously.

This technique can also be used for login information such as user id or password and this info can be embedded as hidden variables in the form.

This updated code is a better framework for simple projects such as filling in a form and having it save the data to a database or send it to the office by email. The only thing I don't like about it yet is that the form must use a GET instead of a POST. This is supposed to be fixed by Alaska Software.
Attachments
dd787.zip
(5.38 KiB) Downloaded 668 times
The eXpress train is coming - and it has more cars.

Zdeno Bielik
Posts: 147
Joined: Thu Jan 28, 2010 9:24 am
Location: Nitra, Slovakia
Contact:

Re: echo example

#15 Post by Zdeno Bielik »

Roger,

many thanks for next example, I will look at it.

Zdeno

Post Reply