Question: Pattern mvc: readme.txt Rewrite the code in this directory implementing model view controller. register.pseudo // get registration information from the user $username = $_POST['username']; $pw1

Pattern mvc:

readme.txt

Rewrite the code in this directory implementing model view controller.

register.pseudo

// get registration information from the user
$username = $_POST['username'];
$pw1 = $_POST['password1'];
$pw2 = $_POST['password2'];
// validate
if ($pw1 != $pw2 || !valid($pw1) || !valid($username))
return redirectBack(400);
// hash password
$pwHash = hash($pw1);
$title = "Welcome $username";
// initialize database
$db = getDatabase('myHost', 'mypassword', 'myDb');
$table = "users";
// create user
$success = $db->query("INSERT INTO $table (username, password)
VALUES ($username, $pwHash);");
if(!$success)
return redirectBack(500);
// set up opening tag
if(getCurrentSeason() == 'summer');
$h1Style = '

';

else
$h1Style = '

';

echo "
$title
$h1Style
Welcome $username
";

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!