Answered step by step
Verified Expert Solution
Question
1 Approved Answer
How do you hash a password (hardcode the password to a hash() ) which was already created in combination of the database using php/sql? $conn
How do you hash a password (hardcode the password to a hash() ) which was already created in combination of the database using php/sql?
$conn = mysqli_connect("localhost: 3306", "root","",""); if (mysqli_connect_errno()) { echo " Failed to connect to MySQL: " } else { } echo " Connected to DB "; // Create database/table and inserts into table $createDB="CREATE DATABASE IF NOT EXISTS testuserdb; "; $createDB.="USE testuserdb;"; $createDB.="CREATE TABLE IF NOT EXISTS users (userName varchar(50) not null primary key, userPassword varchar(255) not null);"; $createDB.="INSERT INTO users (userName, userPassword) VALUES ('joe_bloggs', 'Today123'), ('mark_stevens', 'Tomorrow321"')"; if (mysqli_multi_query($conn, $createDB)) { } else { } mysqli_connect_error() . " "; echo " Database testuserdb and users table created successfully "; do-while loops used to cycle through and process each createDB */ do mysqli_next_result($conn); while (mysqli_more_results($conn)); echo " Error failed to create table. " mysqli_error($conn) ." ";
Step by Step Solution
There are 3 Steps involved in it
Step: 1
To hash passwords in PHP you can use the passwordhash function Heres how you ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started