Question: Need some assistance with PHP form handling, and uploading the contents of a form to a txt file. This my program, that needs to be

Need some assistance with PHP form handling, and uploading the contents of a form to a txt file.

This my program, that needs to be modified:

$redirect = false;

$username = trim($_POST['username']);

$password = trim($_POST['password']);

$verify = trim($_POST['verify_password']);

$email = trim($_POST['email']);

if(!preg_match('/^[a-z]([a-z]|[0-9]){6}([a-z]|[0-9])*[0-9]+$/i', $username))

{

$redirect = true;

}

elseif(!preg_match('/((?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[,.\/?*!])){8}/', $password))

{

$redirect = true;

}

elseif($password != $verify)

{

$redirect = true;

}

elseif(!preg_match('/^[a-z][a-z0-9.+]{3,}([a-z]|[0-9])+@{1}(yahoo\.com|yahoo\.ca)$/i', $email))

{ //(?=.{15,})

$redirect = true;

}

if($redirect)

{

header('Location: index.html');

exit();

}

?>

COMP 3015

COMP 3015

Thanks!

-----------------------------------------------------------------------------------------------------------

Once the form is successfully filled out, I need to record each user into a txt file named 'signups.txt' Separate each form field with an '@' Hash the password using md5() The format should be: username@passwordhash@email

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 Programming Questions!