0

I need to script something that opens a php page that executes a query. In particular i have to do a login / register. I already have the queries and the database working to do this (i have a working login/register on my site). I wanted to use c++ directly to connect to the server and send query from the program but i i heard that is dicuraged becouse of security (and i even can't connect to the server unless i do it directly from the site). So i found on internet that the best way to do this is write the connection to the server and the queries on a .php page that will than be called by the c++ program that also passes, in POST, the variables (username and password) to login or register. I can write the php pages, but i don't know how to make the program.
Basically, in pseudocode, i want to do this

//Things i already know how to do
- read username from console
- read password from console
- read if the user wants to login or register
//Things i don't know how to do
- send username, password (and if the user wants to login or register) to a php page that can execute the right queries and connect to the db
- perform all the checks on the username (not duplicated etc)

By knowing how to open the php page i can also do other things i'm intrested in like create a log of the action taken by the user after connecting (in fact after logging in you can play a little game in DirectX so i can upload like the score or the time played etc) Thanks a lot

Emanuele
  • 28
  • 10
  • You may want to do is to make an HTTP request using C++, see: http://stackoverflow.com/questions/1011339/how-do-you-make-a-http-request-with-c. `libcurl` is a complete solution. – F.Igor May 02 '17 at 13:43
  • Igor ok thanks i think i can find this useful – Emanuele May 02 '17 at 13:46

1 Answers1

0

You can look into the CURL library for C/C++

The normal console actions are trivial. When you get the details from the user, use curl to initiate a [login] request to the server.

Igbanam
  • 5,904
  • 5
  • 44
  • 68