Sign in to follow this  
SERGEI_MAZHARA

HTML | Registration system and authorization

Recommended Posts

Good day to all. I am a novice JS developer. I have an HTML page with registration and authorization connected to the Mysql database. How can I add all this to the server? Thanks.

Share this post


Link to post
Share on other sites

Yes, you can add this to the server. Note that database requests are sent from the server(node.js).

  • Like 1

Share this post


Link to post
Share on other sites

I'll give a brief explanation.

Make an HTML page for your login and registration. Place these html files inside your server-files/client_packages. Inside you HTML use JavaScript to check if the input text field are not empty. If they are empty then show an error using jQuery to edit a tag using it's ID attribute. If the input text is not empty then inside the HTML use mp.trigger to invoke a function inside your client side script. In the client side script use Event.Add inside the class' constructor. When the function is called in the client-side script use RAGE.Events.CallRemote to invoke a function in your server-side script. Inside the server-side script make a RemoteFunction attribute and use this to fetch the data from the client-side script in your server-side. Inside the server-side when the data is fetched, manipulate the data however you want. Like storing it in a file or databasethen from the server-side invoke a NAPI.Clientevent.TriggerClientEvent to invoke a function in your client-side script. And inside the client-side script when you fetch the call from the server, disable the CEF that you created in the constructor of the client-side class.

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.