UberDark's Recent Forum Activity

  • I notice it is often you that saves the day Lennaert..

  • I seeee. So you can include php into the javascript.

    Cool bud. Cheers

  • All i have on the page now (besides the construct2 portion) is:

    Hey, <?php echo $_SESSION['user_name']; ?>. You are logged in.

    Not sure how to add javascript to the page but something like..

    <script>

    var currentuser = $_SESSION['user_name'];

    </script>

    Would that work? Or am i totally off?

    Never done any javascripting..

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I have a login system that loads a .php page and that displays that you are logged in at the top of the screen like this..

    Hey, <?php echo $_SESSION['user_name']; ?>. You are logged in.

    Then below that on the page will be the whole construct2 bit. (the canvas)

    So construct2 has nothing to do with the login system I use and it will be on a .php page.

    QUESTION:

    How do I grab that $_SESSION variable and load it into a global variable in Construct2?

    Thanks.

  • A little introduction:

    I am creating a map of the town I live in. The map will be used by a group of volunteers that can mark locations on the map that need maintenance or litter picking.

    What I have so far is..

    • A map of the town with zoom and move functions either by pressing buttons (sprites) or by using the mouse.
    • A red and green button (sprites) which will activate the marking process.

    When clicked all buttons will go invisible and a colored pin starts following the mouse.

    When you click on the map after that you place the pin on the map. That pin will then also be moved with the zoom and scroll functions of the map. All buttons will become visible again allowing you to add another marker.

    My question is..

    How do I store the markers placed on the map to a database?

    And how do I load them again when someone else opens the webpage with the map?

    So just for the record.. I want everyone to use the same saved data and add to it or change it.

    Some red markers will for example be changed into a green one when some problem area has been taken care of.

    Another question..

    I also want to add the users name (from a variable set on login) to the marker and add the date when the marker was placed so these will also have to be stored.

    Can I make a textballoon like way of showing this user name and date when an existing marker is clicked?

    Have a look at the capx if you want..

    https://dl.dropboxusercontent.com/u/175 ... rkers.capx

    Thanks for reading,

    Danny

    P.S.

    The name of the placed markers/ pins are 'pingreenplaced' and 'pinredplaced'. They are on layer 2.

    They will be placed by CanvasToLayer because the layer is being scaled when zooming in and out. So the mouse position doesn't always directly correspond to the visual spot on the layer. I hope this makes sense.

  • After a lot of deduction together with lennaert we conclude Ajax seems to be misfiring the POST to url as GET..

    Not sure why yet.

  • Fireche Cheers! Appreciate it

  • Fireche The username, password and database names will of course be changed once i figure it out hahaha What is PDO however?

    lennaert

  • Thank you both Ribis and lennaert. I see a lot of usefull information and tips here. I will learn to use the things like URLEncode/base_encode64. And I will also see what it takes to get a https capable server and if this is worth it for the purpose. I am trying to make something for a group of volunteers..

    I am still very confused about the picture I showed. I AM already using POST method in both the php and construct2. Why does it show GET in the screenshot?

  • That is not answering my questions... nevermind.

    I will just assume it is the way I am asking but this is not helping me even a bit.

    I do appreciate everyone for trying though.

    I have read everything about GET and POST in both php and Construct2 documentation. I understand that mysqli_real_escape_string bit but I think I can avoid using it by using 'prepare' instead. And mysqli_real_escape_string doesn't work on anything but strings anyways. But all of that is irrelevant.

    I am not getting errors except when i use POST in the php script I don't get any value returned. Console and network do not seem to make any mention of why btw but I won't linger on that because my main issue is not solved yet anyway.

    I am simply wondering why everything I do keeps showing up in the network view (shown below) as using GET even if both php and Construct2 are set to use POST.

  • Well like i said. I have tried exactly that (replacing the word GET with POST) but then it suddenly does not work anymore. Every username/password combination will comeback as not found pretty much. So not sure what is going on there. As far as i have found on forums it should not make a difference in the data that is returned. I must add that even when it is POST it is still visible in the console of the browser so I am just guessing it is visible because of the construct2 settings.. When I change the construct2 event to 'post to url' as well though it is still visible.

    *Aaaarg

    Thank you for the help sofar. I do really appreciate it. Have been stuck on this tutorial for days now and not many people seem to have actually got the thing to work or can actually answer the specific questions. What good is it if it is not secure and people can hack it easily right?

UberDark's avatar

UberDark

Member since 14 Jan, 2012

None one is following UberDark yet!

Connect with UberDark

Trophy Case

  • 12-Year Club
  • Email Verified

Progress

13/44
How to earn trophies