Create account MySQL/PHP not working need help

0 favourites
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Rofl

    Don't feel bad we all made silly mistakes early on. :)

  • (y)

  • Hi averybody,

    Somebody can post an example of construct2 with a register and login with the php file?

    I would like to make a savegame with a registration... it's very important for me...

    somebody knows some example, tutorial? my problem it's the php file, and eventually how I can implement on construct2...

    thank you very much!!!

    <img src="smileys/smiley1.gif" border="0" align="middle" />

    PS: is it important to associate an ID for every user? because if somebody use the same nickname... it's possible to check a the users name on the database before the registration?

    sorry for my English, if somebody have a tutorial with file it's perfect...

    thank you again!!

  • Hey Ribis,

    Try using this example I scrounged up-

    Make sure you have a web server, such as WAMP server on your local computer.

    Be sure to use the SQL document and import it into PhpMyAdmin or what ever MYSQL administration you use.

    Export and upload your project, as well as the PHP files.

    The test username and password should be: test01

    https://www.dropbox.com/s/8nqacjhm2otwrun/RegisterLogin.zip

  • Hey Ribis,

    Try using this example I scrounged up-

    Make sure you have a web server, such as WAMP server on your local computer.

    Be sure to use the SQL document and import it into PhpMyAdmin or what ever MYSQL administration you use.

    Export and upload your project, as well as the PHP files.

    The test username and password should be: test01

    https://www.dropbox.com/s/8nqacjhm2otwrun/RegisterLogin.zip

    thank you so much!!!

    it's working!! It's just what I needed!! easy example!!

    now, I need to study the PHP for make safe the database from some attack and add some information like a e-mail..etc

    I found

    Subscribe to Construct videos now

    how it's possible to make a safe login/register...etc etc

    I think it's good idea to adabt this example for construct2...

    Have a savegame system on the database with a username/pass/e-mail it's very important!

    Thank you again! <img src="smileys/smiley1.gif" border="0" align="middle">

  • Glad it worked! <img src="smileys/smiley1.gif" border="0" align="middle" />

    You could further security by encrypting the passwords inside the MYSQL database, and make the AJAX post parameters more complex then password or username.

    Just to name a few things.

  • Glad it worked! <img src="smileys/smiley1.gif" border="0" align="middle" />

    You could further security by encrypting the passwords inside the MYSQL database, and make the AJAX post parameters more complex then password or username.

    Just to name a few things.

    Thank you for the suggestion, I never use the PHP or the MYSQL for this case, for me it's very difficult...

    I love to understand this topic (mysql, php...) because for me it's difficult and I need that for make my game...

    have a savegame on the database with login, customize avatars...etc will be fantastic...

    I just find a few topics about this topic...

    Do you think it's good idea to save the items, avatar, variable of user... in one row? or it's good to make a new table for this case?

    Thank you!! <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I wouldn't recommend this as a way of storing all the users data. However it may be the most simplest way.

    You have a database structure like this, where you can track different types of skills available to the user, for this example I only included one skill, and you can keep track of each and every one of them inside a skills column for the user. For items, you can basically do the same, each time a player gets a specific item, you can add one to the Item_1 column, more then one item in the game? Just add more Item columns. . Like I said, this is not the best method.

    It works, but ugly.

    As for storing avatars, you can't store them inside a database. However, you can let the user upload a image onto the webserver, and store them in a user image directory, and when they log in, call the image file into a sprite.

  • Yes, I think about that...

    every users have item1,item2... with a different row to setup the item...

    my problem is the php, I now how I can make the logic "system", but when I think how I can write the code in php grow up a big problem...

    for example, it's possible to make a code on the MYSQL, or on php, to recognize when the database have a new user and for that the database will make all of the rule for new users? like make a row for item1,item2,life,point,score....etx (off course it's possible, but i don't know how I can write the code in php, and insert on construct2...)

    I don't know how I can write the code to write on the database (like edit a item when the user save the game...etc <img src="smileys/smiley5.gif" border="0" align="middle" />

    Thank you so much!!!

  • Maybe you should view some tutorials on PHP and MYSQL before you tackle something like this?

    http://www.w3schools.com/php/

    http://www.w3schools.com/php/php_mysql_intro.asp

  • Maybe you should view some tutorials on PHP and MYSQL before you tackle something like this?

    http://www.w3schools.com/php/

    http://www.w3schools.com/php/php_mysql_intro.asp

    Thank you for the links,

    I will publish some idea about the php and the options of the database soon...

  • ok, I made a picture of my idea:

    <img src="http://www.apophisgame.com/TABLE.png" border="0" />

    when one user will register on my game, the php will make a new row for all of the table with the ID of the user.

    when someone save the game, the variable will save in all of the table.

    it's possible this scheme?

    could work?

    Thank you!!

  • Think of each row entry to a table as an object.

    for instance:

    you have a table called cars with huge rowlengths with all the details ...

    lots of details would get stored double.

    for isntance, car brand, or motor size, or just imagine if you would have more then 1 set of tires that could fit. Would you make an entire row entry with double values just to store those extra tires ?

    no, chop it up, and link items by their IDs.

    Example:

    I want a car, listed with a brand, and want to know which tires fit under it.

    We get cars, brands, tires.

    Table my_cars

    -id : auto increment - key

    -brand : int (id car brands)

    -tire : int (id tire_sizes)

    Table car_brands

    -id : autoincrement - key

    -name : var char - car brand name

    Table tire_sizes

    -id : auto increment - key

    -size : int - set size

    Assuming you have rows entered in car_brands, (names with IDs) and rows added to tire_sizes (Sizes with IDs)

    when adding a my_cars, you can pick the ID from the corresponding table,which gives you a reference.

    This principal can keep your datanbase really small and fast.

    heres a rough version of a possible query:

    select tire_sizes.size as tiresize,car_brands.name as brandname from car_brands, tire_sizes where car_brands.id = my_cars.brand and tire_sizes.id = my_cars.tire and my_cars.id = 'MyChosenId'

    when done $var->brandname and $var->tiresize should give the table linked data :)

    your my_cars table would merely be storing every row, the IDs as reference to the items.

    These tables are small, but if you have lots of data in lots of tables, this will really come in use.

    There are lots of framework who use this sort of system through primary keys and indexes (INNODB)

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