Create account MySQL/PHP not working need help

Get help using Construct 2

Post » Wed Dec 18, 2013 12:07 am

[QUOTE=GameThirsty] 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[/QUOTE]

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 this tutorial 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!
B
21
S
9
Posts: 298
Reputation: 2,967

Post » Wed Dec 18, 2013 12:27 am

Glad it worked!

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.
B
17
S
6
Posts: 348
Reputation: 2,608

Post » Wed Dec 18, 2013 8:53 am

[QUOTE=GameThirsty] Glad it worked!

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.[/QUOTE]

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!!
B
21
S
9
Posts: 298
Reputation: 2,967

Post » Wed Dec 18, 2013 7:03 pm

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.GameThirsty2013-12-18 19:06:43
B
17
S
6
Posts: 348
Reputation: 2,608

Post » Sat Dec 21, 2013 4:08 pm

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

Thank you so much!!!
B
21
S
9
Posts: 298
Reputation: 2,967

Post » Sat Dec 21, 2013 6:52 pm

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
B
17
S
6
Posts: 348
Reputation: 2,608

Post » Tue Dec 24, 2013 3:31 am

[QUOTE=GameThirsty] 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[/QUOTE]

Thank you for the links,

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

Ribis2013-12-24 03:31:47
B
21
S
9
Posts: 298
Reputation: 2,967

Post » Tue Dec 24, 2013 7:03 pm

ok, I made a picture of my idea:



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!!
B
21
S
9
Posts: 298
Reputation: 2,967

Post » Tue Dec 24, 2013 7:40 pm

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)

lennaert2013-12-24 19:41:52
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Previous

Return to How do I....?

Who is online

Users browsing this forum: MikaelS, nahima, Shenkai the ssj and 20 guests