Answered step by step
Verified Expert Solution
Link Copied!

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?


image

$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 ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Systems Analysis And Design

Authors: Joseph Valacich, Joey George

8th Edition

0134204921, 978-0134204925

More Books

Students also viewed these Databases questions

Question

Differentiate the function. r(z) = 2-8 - 21/2 r'(z) =

Answered: 1 week ago