Register with PHP

  1. Setting Up Database
  2. Please open localhost/phpmyadmin and create a new database (here I named it regis)
  3. Create a new table with the name users
  4. Create a column with “id”, “username”, “email”, “password”, “name”. On id add primary_key, auto_increment. This can be created using 4. phpmyadmin or SQL code, it’s up to you which one you want to create
  5. Connect the database created with PHP with the name “config.php” so that the database can be connected and can be used.
  6. Open localhost:8000/config.php, if there is no error then the database configuration with PHP has been successful, if there is an error it is possible that there is a writing error or missing a semicolon.
  7. Creating the main page
  8. Create a PHP file with the name index.php , this page serves as a landing page, it only contains HTML and styles.
  9. Create the display as you wish with the login and register buttons for easy user interface.
  10. Connect register button with href to register.php
  11. Go to localhost:8000/index.php .
  12. Creating a register feature with PHP
  13. Create a register.php file
  14. Connect register.php with config.php with the function require_once(); so that the code in config.php can be used in register.php
  15. Create code to save the database that will be input by the user
  16. Perform filters and encryption of the inputted data, this serves so that hackers cannot easily attack your website.
  17. Passwords do not need to be filtered so that users can use symbols to enter passwords so that passwords are more secure
  18. After filtering, then create a query with the object $db, :name, :username, :email, :password are placeholders. The goal is to avoid SQL Injection attacks.
  19. After that, we bind the parameters or fill the placeholders with the values ​​we get from the filter results.
  20. Execute the query with $saved = $stmt->execute($params); , this execution will return true if successful.
  21. Then create a form to register with the attribute action=”” which will be sent to the website itself, namely register.php .
  22. Website registration is ready to use
  23. Conclusion and Closing

In a good website, of course, we need to register and login so that users can interact with further website features, it can also be for admins who want to access the admin page.

The need for digital IT is needed in daily activities, Bead IT Consultant is the right choice as your partner, visit our website by clicking this link: www.beadgroup.com