Sessions sending me mad

Hi everyone, hope someone can spot what i am doing wrong, never used sessions within Wappler before and must be doing something wrong. I am trying to insert user location detail into an audit record but don’t want to use $_GET parameters

Here is what i have done

Created session variables within app connect session manager

Set the session variables content within app connect onLoad() event

I know this is working as i had displayed the session variables temporarily on the screen

I then add the session manger to relevant server connection which needs to be audited


I then create corresponding session variables in Server connect


And insert the details, with other info, into an audit record

However the entries in the audit table show no values are inserted for lat,lng or ipaddress

I am sure i must be making a simple rookie mistake, please can someone help with this

Hey Brian,
This step is not related to passing sessions to server action. It's used to cache server action data into a session (so on refresh the server action is not being called again) and i doubt you need it.

Now on your issue:
How and when do you run the server action on the page?

demo Page is here

On load, the page runs a a server action to load a list of properties from the server to populate the swiper

This works exactly as it should

I have then added a simple database insert into that server action to store the audit info

Do you think it is running before the sessions are initialised by onLoad()?

Probably that’s the issue, but your page is giving js errors and i cannot really see what is going on.

Just a question: Why do you not directly pass the browser plugin data to your server action?

Strange, i don’t see get that error?

In answer to your last question, how do i do that? Don;t mind how i do this, just want a working solution. I would really appreciate your assistance on this one.
The 403 is a missing image

Which action file are you using to insert data?

Server connection is called slider1 in app connect and it calls “assetlist”

“assetlist” firstly retrieves a data set

Then a table insert inserts into the audit trail

Setting are:

Please remove the cache option from it, as it is not needed. It currently caches the data in some session you set and does not really run.


Ok i checked your site more detailed, but if you want to use sessions (instead of get vars) you need to change the logic a bit.

Let me just clarify what the workflow should be here :slight_smile:

First, you need to have the user ip, lat and lon to be able to use them wherever you need them. So the logic should be:

  • Wait for the geolocation plugin to get ip, lat, lon
  • When you have these, set them in variables
  • Run your server action

So the load event is not suitable here. Auto running action which inserts data is also not suitable.

You need to:

  • Set server action that inserts data to No Auto Load
  • Add geolocation plugin
  • Use geolocation plugin dynamic events > on success:
    – Set Session (3 times for the 3 values)
    – Run the insert Server Action

This way the location data will be collected, sessions will be created, the action will be called and session values will be inserted with insert step :slight_smile:
Hope that helps.

1 Like


set server connection slider1 to no load
removed the app onLoad() action
added set actions to geo1 on:success()
Still no output

<dmx-geolocation id="geo1" dmx-on:success="session1.set('lat',geo1.coords.latitude,{});session1.set('lng',geo1.coords.longitude,{});session1.set('ipaddress','<?php echo $_SERVER[REMOTE_ADDR];?>',{});slider1.load({})"></dmx-geolocation>'

The server action now runs when the location has been detected. Everything should be inserted perfectly.

Please create 3 setvalue steps in your server action and bind each session value to them (enable output as well) so i can check what the sessions return.

All set to output

There is no need for them to be in a repeat - just 3 regular steps at the begging of the file will do it.

Just a question - are you using the latest version of Wappler, as in previous versions there was an issues passing {{$_SESSION.name_here}} in server connect steps?

Repeat removed, latest version 1.7.2

Could you try removing the dmxConnectLib folder locally, re-save your action file (so it gets recreated), and upload it to the server again :slight_smile:

The IP is critical, the lat. lng is a bonus. I assume if I create a $_SERVER.REMOTE_ADDR in server action it will give the server address and not the client address as the script is called from app connect (or have i got that wrong)?

Just the record make sure you save a server action to update server connect files to the latest, as we did fix some server connect issues with $_SESSION in PHP

delete the entire dmxConnectLib folder @Teodor ?