h1k3's Recent Forum Activity

  • Pode

    How do I keep links inside of an iframe from opening within a new window?

  • That still seems like an awful lot of php for just updating one variable but I'm kind of new to it as well. Try posting the code On stackoverflow.com. They are usually very helpful as long as you are polite. Which I don't see a problem there for you. :)

  • Ps Ashley

    I can't find documentation on the data field in Ajax requests. How does it work?

  • You can find an example of my working Ajax construct2 at the following link.

    scirra.com/forum/what-am-i-doing-wrong-here_topic56751.html

    Between the php example and the capx in the above link I'm hoping you can get yourself up and running. :)

  • Try the php I had posted earlier and just change the variables around to meet your needs. I know it works because I use it on my server with construct2. If it works you'll have a good starting point that just needs the security stuff put in.

  • I don't think construct2 utilizies the localhost directory path. Change it to the physical http path in the event.

    IE:

    "localhost/killmonster/sanderswin1.php?&score=1"

    to

    "http://colsandersisrad.com/killmonster/sanderswin1.php?score=1"

    I think that may solve your problem. I think the localhost is only for the php side. Thats all I can see in your ajax request. But make sure you add it an on complete event and on error event to make verify the score updated.

  • you know what, are you using godaddy? I am and for some reason it will not let me use localhost. I have to plug in the server address when creating the mysql connection along with the password. Had a freehost before I think it wass fii.me that had the same problem. Maybe try plugging in the server address and password for a trial run? BTW feel free to tell me how to secure my php code. :) I would gladly accept the guidance.

  • ramones,

    I switched checking to two groups, one for x and one for y based on what you thought and you were right. :):):) Thanks bud :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ramones What I want to do is this. Say I enter 1 and 1 for the x and y and set the number of records to 3. I want to first start by filling in positions by the x mark so x1y1,x1y2,x1y3 then when y reaches the record amount set x to the next item and reset y. So x2y1,x2y2,x2y3 The do it again one last time with the x variable set to 3. Then when x and y are both filled completely(9 records) I want it to stop.

  • Thats way out of my league for php programming. I utilize one php file for each type of request. I know it takes up more room and is redundant but its more easy for me to get my head around. What your doing in the capx looks fine though. Heres a copy of one of my php files(work in progress I know I need to add the safety check like stripslashes :)) Anyways heres what works for me:

    And the php file:

    <?php

    $minx = $_REQUEST['min_x'];

    $miny = $_REQUEST['min_y'];

    $terrain = $_REQUEST['ter'];

    $SFood = $_REQUEST['food'];

    $SWood = $_REQUEST['wood'];

    $SStone = $_REQUEST['stone'];

    $SOre = $_REQUEST['ore'];

    $SGems = $_REQUEST['gems'];

    //Connect To Database

    $hostname='#####';

    $username='#####;

    $password='#####';

    $dbname='#####';

    $usertable='#####';

    $MapID = 'Map_ID';

    $MapX = 'Map_X';

    $MapY = 'Map_Y';

    $MapTYPE = 'Map_TYPE';

    $Food = 'Map_FOOD';

    $Wood = 'Map_WOOD';

    $Stone = 'Map_STONE';

    $Ore = 'Map_ORE';

    $Gems = 'Map_GEMS';

    $con = mysql_connect($hostname,$username,$password);

    if (!$con)

    {

    die('Could not connect: ' . mysql_error());

    }

    mysql_select_db($dbname, $con);

    $sql="INSERT INTO $usertable ($MapX, $MapY, $MapTYPE, $Food, $Wood, $Stone, $Ore, $Gems)

    VALUES

    ('$minx','$miny','$terrain','$SFood','$SWood','$SStone','$SOre','$SGems')";

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

    {

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

    }

    echo "1 record added";

    mysql_close($con);

    ?>

    Just remember this isn't an effective php script yet. Still need the safety features so feel free to take from it what you want just be warned it's currently not secure enough for commercial use. :)

  • Anyone around able to figure out what I'm doing wrong with my conditions? I know that the php side works fine as it uploads tiles in the right format.

  • Here's a copy of a stripped down version of my capx.

    CapX

    When it counts off in the database the x variable works fine. The Y seems to lose a digit. It should be everytime the y variable passes the number of records variable the y should reset back to the stsrting y position. But it resets back to the y position + 1 instead. I'm sure it's something relatively easy but with a lack of sleep I can't seem to place my finger on it.

h1k3's avatar

h1k3

Member since 1 Apr, 2012

Twitter
h1k3 has 3 followers

Connect with h1k3

Trophy Case

  • 12-Year Club
  • x5
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Email Verified

Progress

15/44
How to earn trophies