NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: terryd on August 27, 2015, 10:35:22 PM

Title: How to parse an incoming URL to get a session value
Post by: terryd on August 27, 2015, 10:35:22 PM
I have a client who has his own website.
On the website he has a map of a show terrain.
Each of the locations has a hot spot with a value (say 'S01') which when pressed can redirect to a URL.

Our idea is for him to redirect to my website with something like http://mywebsite.com/checkstatus/?S01.

What I want to do from my website is:
a. Check that that location is available. I have a table with an Unique identifier (not the Primary Key) which would be able to check the status of the record if I do something like
STA:Code = 'S01'
Access:Stall.Fetch(SK_StallCode)
One of the fields in the Stall table contains the status of the stall (Available/Not Available)
So I would then return a not available message or allow the user to continue is the status is available.

My question is if I received the above URL what would I need to do to store the value S01 into a session variable since once I have that the rest should be straightforward.
Title: Re: How to parse an incoming URL to get a session value
Post by: MyBrainIsFull on August 27, 2015, 11:31:27 PM
Hi Terry, this will come in on the URL so it will be part of the ValueQueue 
You need to read it as GetValue()  see ep. 55

Your post should be a name and value pair,  like   blah.com/checkstatus/?map=S01
ie      var = GetValue('map')    ! and var will hold S01

To save it to the session Q you could
p_web.SSV('MapRef',  p_web.GetValue('map') )

Title: Re: How to parse an incoming URL to get a session value
Post by: terryd on August 28, 2015, 12:40:06 AM
Thanks Kevin. This helps
BTW what does ep. 55 mean?
Title: Re: How to parse an incoming URL to get a session value
Post by: Bruce on August 28, 2015, 01:46:13 AM
Kevin is right - just 2 small corrections;

>> blah.com/checkstatus/?map=S01

lose the trailing / and rather use

blah.com/checkstatus?map=S01

>> p_web.SSV('MapRef',  p_web.GetValue('map') )

this is ok, but the name changes (which can make for interesting confusions) and also if the parameter is _not_ there then the session value will be cleared. so I prefer;

p_web.Storevalue('map')

This makes the session value the same name, and if the "map" value does not exist then the session value is not overwritten.

cheers
Bruce
Title: Re: How to parse an incoming URL to get a session value
Post by: terryd on August 28, 2015, 02:43:53 AM
Thanks Bruce.
Hi Kevin I see you meant Nettalk Webinar 55. Thanks
Title: Re: How to parse an incoming URL to get a session value
Post by: terryd on August 28, 2015, 03:32:02 AM
Hi Bruce I used this version
p_web.SSV('MapRef',  p_web.GetValue('map') )  (This works for me)
because as you say using the second version p_web.Storevalue('map') if the incoming parameter doesn't exist nothing happens on my netweb page and I want to handle exceptions with an alert and then redirect either to my website login page or back to the clients map page.
I have a question on creating a redirect to a different page but I will create that as a new topic