UberDark's Forum Posts

  • lennaert

    Let me bother you some more maestro..

    I get the concept of what you are saying but since i only just learned a bit of php and now i have to get into javascript i am finding it hard to do.

    In Construct2 i should basicly do something like this?

    System>Set variableX to "ExecJS('username')" ?

    Is this correct? Or is it not ExecJS I should be using? Perhaps EvalJS?

    Completely lost it now..

  • Would you really think that would not be too much info to do all the markers every minute for every user? I mean.. just the locations and status perhaps but if i would allow a description for each marker of let's say 150 characters per marker that becomes a lot of data.. Interesting idea though. I thought every time a change was made just only change that entry in the database and leave all the other markers untouched. Not sure how i would identify the individual markers though since if i would use the database ID and markers get deleted the ID changes.

    So if person A and B both log in..

    Person A edits marker #5..

    At the same time person B deletes marker #4..

    This would cause marker #5 to become marker #4..

    Now when person A is done editting and the system autosaves that data it saves it to the wrong spot in the database.

    Or am I overthinking this now?

    Perhaps when a marker gets deleted I instead of actually removing it I should just make the database entry say DELETED and once a day at a specific moment remove all deleted entries at once?

    *scratches head*

  • There will be roughly 50 members so not likely more than a couple will use it at once. This is why I already decided to only send to database the current pin/marker that user is placing or modifying. I don't want people to often overwrite each others data by accident. If it happens once every now and then so be it. I know how to write to database now a bit so that is not really a problem, but I am not sure about specific problems this specific project will cause. For example..

    If I have 3 markers in the database and the second one will be deleted does this leave a gap in the database or in the array when I load the data into construct? I want to avoid that sort of things as much as possible. If two people are using the map at the same time and one deletes a marker but the other adds one I don't want it to cause a conflict. This basicly means I don't want to number the markers or use the ID in the database for identifying the marker.

    I will figure this out

    It is a wonderful learning project.

    Thank you for recommending the plugins I will make sure to check those out.

  • 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?