How do I pull variables from a php page?

0 favourites
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Will publish the *. capx?

    regards.

  • b781rev this sounds good. I had started making notes on a simple score system that I used in my first demo, it seems you've done more work. If you can put up a tutorial or sample files I am sure many would appreciate it.

  • Wow b781rev, this is impressive!

    I'd love to see your solutions to this, can you post your project to the community?!

  • Ok, here is the .capx:

    4shared.com/file/6glBPu19/login.html

    jax.php:

    <?php

    $username=$_GET['username'];

    $password=$_GET['password'];

    echo $username."\n".$password;

    ?>

    Or whatever you need to put in your php page to login. Of course, that is not all of it.

    ?>

  • Ok, I'm going to post what I have for my .capx for the saving variables to a database and the php for it.

    FILE:

    4shared.com/file/885mRUrE/ajaxsave.html

    PHP:

    <?php

    include('connect.php');

    if ($_GET['mode']=="save") {

    $score = $_GET['score'];

    $level = $_GET['level'];

    mysql_select_db("p668534r_members", $con);

    mysql_query("UPDATE ajax SET ajax_score = '$score', ajax_level = '$level'

    WHERE username = 'b781rev'");

    if (!mysql_query($sql,$con))

    { die('Error: ' . mysql_error()); }

    mysql_close($con);

    }

    if ($_GET['mode']=="load") {

    mysql_select_db("p668534r_members", $con);

    $result = mysql_query("SELECT * FROM ajax WHERE username='b781rev'");

    while($row = mysql_fetch_array($result))

    {

    echo $row['ajax_score']."|".$row['ajax_level']."|";

    }

    mysql_close($con);

    }

    ?>

  • Did anyone find these examples useful?

  • Great example b781rev! One thing though - on this line in the PHP:

    ysql_query("UPDATE ajax SET ajax_score = '$score', ajax_level = '$level'

    WHERE username = 'b781rev'");

    I don't know PHP very well, but it looks vulnerable to a SQL injection hack. If you request the AJAX URL with this for the score:

    0';DROP DATABASE;

    then you substitute that in to the SQL command and it wipes the database. You should be very careful about SQL injection - many, many sites have been hacked by that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh, I know. I just posted it as an example. I won't be running my site with queries like that.

  • Your posts are great, today after work hours I'll take a look. you can be sure I'm going to follow and suggesting questioner.'ll answer for here because I have enough reputation to do so in private. The text box and new buttons, put them through your work, because the moderators realize that it is essential for logon. A big hug from Chile.

  • Here is a register example:

    peepelz.com/index.php

  • your posts are very good. I consider myself a beginner. would be great to publish a game where the user could register, login and logout. subsequently to login, you load the data from the previous game. It would also be very useful to teach us to create the database and everything related to store the records. Already very grateful and my respect for you.

  • would be great to publish a game where the user could register, login and logout. subsequently to login, you load the data from the previous game. It would also be very useful to teach us to create the database and everything related to store the records.

    This all is out of the scope of C2's forum (once again).

    This is webdeveloppement and you can find tons of examples and dediacted websites on the internet.

    But this can't really be simplified and there are a lot of things to take in account/learn. Make a search in your own language for "mysql database" or "PHP login/registering".

    Find a webdevelopment website in your own language this is where you'll get all you need. But be sure to look up for infos by yourself first, and not just wait for the infos to come at you.

  • your posts are very good. I consider myself a beginner. would be great to publish a game where the user could register, login and logout. subsequently to login, you load the data from the previous game. It would also be very useful to teach us to create the database and everything related to store the records. Already very grateful and my respect for you.

    That is a full php dev production request. Again, either you check out the millions of tutorials out there related to php or maybe hire a professional developer to do this part.

    On the plus side, C2 already takes care of the onerous task of trying to learn HMTL5. That alone can save about 6-8 months of development and research depending on one's expertise level.

  • Too bad that this issue is no longer interested. But it remains a clear example for a user logs on and it loads the data from previous sessions. example, in an online casino credits are saved for a later session. if anyone knows how to do it please post an entire project. knowledge must come together, such as medicine and electronics come together to make a machine (eg, a dialysis machine). Neither the doctor nor the address on their own can do it. So hopefully someone will put together an expert in php expert C2 and can make the project possible.

  • Bumping all the topics about this won't make it happen faster.

    All the physicians, doctors, etc...

    They LEARNED their craft. They studied the documents available.

    On the internet you have zillions of documents about PHP programming, find yourself a beginner tutorial and learn from it.

    All the examples already posted on the forum need to be adapted to your needs, by yourself or some coder working on your project.

    You can't simply ask for someone to post a full working solution and rip it off as you surely plan to do.

    Anyway you would soon come back and ask "how to change this or that" according to your project's needs, and the person would tell you "change it yourself".

    As Ghengis said in his previous post, C2 saves you monthes of learning a language.

    For your purpose, you need to learn another. It's not that complicated, it just take time and practice.

    And this is made simpler as there are many documents (and surely in your own language, whereas C2 is only (mostly) english).

    Just make a search on google.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)