Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PHP SCRIPTING 1. Construct the client Html “Login.html” which contains a form wi

ID: 3583700 • Letter: P

Question

PHP SCRIPTING

1. Construct the client Html “Login.html” which contains a form with the following user information:

Name

School number

Password

Category(teacher, student, administrator)

2. Construct the server scripts ”checkIn.php”, which gets the user information and checks the user information;

If the user category is “teacher”, it says “Hello Teacher”. Name.school Number;

If the user category is “student”, it says “Hello student”. Name.school Number;

If the user category is “administrator”, it says “Hello Admin”. Name.school Number;

If the user category is none of the four listed above, it says ”Hello Stranger!”.

3. Run your client and server document with correct apache server

Explanation / Answer

Login.html

<form accept-charset="utf-8" name="feedbackform" method="post" action="#">
       <!--<div class="loginform">-->
       <div class="login-default">
      
       <table width="450px" class="loginform"
       <tr>
       <td colspan="2">
       <h2>Login Form</h2>
       <p class="feedback_comments">An asterisk (<span class="required_star"> * </span>) indicates a mandatory field.</p><br />
       </td>
       </tr>
       <tr>
       <td valign="top">
       <label for="Name">Name<span class="required_star"> * </span></label>
       </td>
       <td valign="top">
       <input class="feedback_text" type="text" name="Name" id="Name" maxlength="100" />
       </td>
       </tr>
       <tr>
       <td valign="top">
       <label for="School Number">School Number<span class="required_star"> * </span></label>
       </td>
       <td valign="top">
       <input class="feedback_textbig" type="text" name="School Number" id="School Number" maxlength="100" />
       </td>
       </tr>
<tr>
       <td valign="top">
       <label for="School Number">Password<span class="required_star"> * </span></label>
       </td>
       <td valign="top">
       <input class="feedback_textbig" type="text" name="Password" id="Password" maxlength="100" />
       </td>
       </tr>
      
<tr>
       <td valign="top">
       <label for="School Number">Category<span class="required_star"> * </span></label>
<form action="">
<div class="radiocenter">
<input type="radio" name="category" value="teacher"> Teacher<br>
<input type="radio" name="category" value="student"> Student <br>
<input type="radio" name="category" value="administrator"> Administrator<br>
<input type="radio" name="category" value="stranger"> Stranger
</div>
</form>         
</td>
      
       </tr>

       <tr>
       <td colspan="2" align="right">
       <br /><br />
       <input type="text" id="url" name="url" />
       <input type="submit" value="Submit" id="form_submit_button" class="submit_button" />
<tr>
       <td colspan="2" align="left">
       <input type="text" id="url" name="url" />
       <input type="submit" value="Cancel" id="form_submit_button" class="cancel_button" />
       </td>
       </tr>
       </table>
      

checkIn.php

For teacher's hello msg

<?php
if(!empty($_POST['name'])&&!empty($_POST['school number'])&&!empty($_POST['password'])&&!empty($_POST['category']))
{
$name = $_POST['name'];
$school number = $_POST['school number'];
$password = $_POST['password'];
$to = 'contact@schoolemail.com';
  
$body = "From: $name School Number: $school number $password:";

if ($_POST['submit']) {
if ($name != '' && $school number != '') {
{
if (mail ($to, $subject, $body, $from)) {
echo '<p>hello teacher!</p>

For student's hello msg

<?php
if(!empty($_POST['name'])&&!empty($_POST['school number'])&&!empty($_POST['password'])&&!empty($_POST['category']))
{
$name = $_POST['name'];
$school number = $_POST['school number'];
$password = $_POST['password'];
$to = 'contact@schoolemail.com';
  
$body = "From: $name School Number: $school number $password:";

if ($_POST['submit']) {
if ($name != '' && $school number != '') {
{
if (mail ($to, $subject, $body, $from)) {
echo '<p>hello student!</p>

For admin's hello msg

<?php

if(!empty($_POST['name'])&&!empty($_POST['school number'])&&!empty($_POST['password'])&&!empty($_POST['category']))
{
$name = $_POST['name'];
$school number = $_POST['school number'];
$password = $_POST['password'];
$to = 'contact@schoolemail.com';
  
$body = "From: $name School Number: $school number $password:";

if ($_POST['submit']) {
if ($name != '' && $school number != '') {
{
if (mail ($to, $subject, $body, $from)) {
echo '<p>hello admin!</p>

For stanger's hello msg

<?php

if(!empty($_POST['name'])&&!empty($_POST['school number'])&&!empty($_POST['password'])&&!empty($_POST['category']))
{
$name = $_POST['name'];
$school number = $_POST['school number'];
$password = $_POST['password'];
$to = 'contact@schoolemail.com';
  
$body = "From: $name School Number: $school number $password:";

if ($_POST['submit']) {
if ($name != '' && $school number != '') {
{
if (mail ($to, $subject, $body, $from)) {
echo '<p>hello stanger!</p>