khelaghor's Forum Posts

  • I was trying to post a simple variable to a php page from construct using AJAX post to url method. Here's my PHP code

    <?php 
    header('Access-Control-Allow-Origin: *');
    if (isset($_POST["X"])) {
        $x = $_POST["X"];
        echo $x;
    }else{
        echo 'no variable received';
    }
    ?>[/code:25spxjpm]
    Here's a screenshot of my C2 code
    [img="https://www.dropbox.com/s/0y587d24t4zwztr/Screenshot%202017-10-22%2000.37.53.png?dl=0"]
    
    Can somebody tell me what am I doing wrong here? And also its pretty straightforward in Jquery AJAX and in Construct 2 what to do with that data field is not very clear. What does it mean "The data to post, in query string form"?
    
    Thank you in advance for taking a look at it.

    I was trying to post a simple variable to a php page from construct using AJAX post to url method. Here's my PHP code

    <?php 
    header('Access-Control-Allow-Origin: *');
    if (isset($_POST["X"])) {
        $x = $_POST["X"];
        echo $x;
    }else{
        echo 'no variable received';
    }
    ?>[/code:2qhjjjzl]
    Here's a screenshot of my C2 code
    [img="https://www.dropbox.com/s/0y587d24t4zwztr/Screenshot%202017-10-22%2000.37.53.png?dl=0"]
    
    Can somebody tell me what am I doing wrong here? And also its pretty straightforward in Jquery AJAX and in Construct 2 what to do with that data field is not very clear. What does it mean "The data to post, in query string form"?
    
    Thank you in advance for taking a look at it.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I want to create an universal system for my online gaming portal and want a template from a programmer which will work for all of my games. Note that I'm a game developer myself but not very familiar with php and mysql databases. So that's why I need help. If you're not expert at php , mysql and AJAX please ignore this post.

    Here's the pseudocode I wanna execute for each of my game,

    on every game the an AJAX request will be sent to a certain php page which will tell us if the user is logged in or not . If logged in then it'll send the username in ajax lastdata. If not logged in it'll send an error message or something. Based upon this status we'll set a variable true or false. You'll understand the significance of this boolean later. Okay, now we have the login status. Then after finishing the game the user has highscore which I'm storing in localstorage. The user is given an option to a submit the highscore via a submit button obviously. When he/she presses the button it'll first compare if our boolean is true or false. If false we'll simply give the user option to register on our website. If true we'll post the score to another .php page which will submit the highscore to our database. And we'll have different row for different games. So, it'll just store the highscore value for every specific game. We'll create leaderboard for each game based upon the players who stored the highscore values. If you think you can make a template that'll work for all of the games please let me know. TIA.

  • Hi,

    I was thinking of making something like this which I'm describing below step by step. You may call it as a pseudocode.

    on the start of the game a request will be sent via ajax to a php page to check if the user is logged in or not on my website. Note: I have a wordpress website. If not logged in he/she we'll just set a variable to false in our project. If logged in we'll store the username in a text variable and show something like "welcome "X" bla bla..."

    In the end of each game on my website I want to have submit highscore button. So, when somebody clicks on that it'll check if the login variable status is true or false. If true then we'll post the username and the highscore to a php page which will post the score to the database. If the variable is false the user will be prompted to login with fields or submit as guest. I'm not quite familiar with mysql and php and struggling with scripts . Can somebody help? Thanks in advance.

  • Hi,

    First of all thank you for taking a look at the problem I'm facing. I have a wordpress website. Of course, it should have its own user database consist of userID, username and password. Now what I wanna do is like this: First of all I wanna detect if the user is logged in or not when he first try to play a game on my website. So, after playing each game the user will be able to submit the high score to the website. And if he's not logged in he'll be prompted an error message saying you're not logged in , with the login username and password field. Can somebody help me with this? Thanks

  • Any sort of pseudocode ideas are appreciated.

  • Hi,

    Today I was surfing around youtube to find out some unique game ideas and found this one

    Subscribe to Construct videos now

    Its about sorting out fruits and keeping them in different baskets. Can anybody help me building the basic game ? Thanks

  • Thanks for the help. I've already fixed it though.

  • Sorry, I looked at it after posted. Really sorry.

  • Hi,

    I was hoping to make a table with rows and columns and also give them border , background color etc etc. But seems like there's no such option in construct 2 official plugin to insert HTML tags. I found a plugin named complete HTML pack but the link does not work anymore. I'm attaching the url below. Can anybody tell me how can I accomplish this. Thanks.

    Plugin thread:

  • Pinco download link isn't working

  • Please update the link for the plugin. It's not working. Thanks

  • Thanks 99Instances2Go for your reply. I've already solved the problem. Now I'm dealing with another problem. How to make a table with rows and columns by writing code into construct 2. Its pretty easy in HTML but I can't figure out how I can do it in cosntruct

  • Thanks for the tips. Really appreciate it.