Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['insert'])){
- $hostname = "localhost";
- $username = "root";
- $password = "";
- $databaseName = "change_management";
- $connect = mysqli_connect($hostname, $username, $password, $databaseName);
- $user = $_POST['user'];
- $passcode = $_POST['passcode'];
- $sql = "SELECT * FROM admin WHERE username = '" . $user . "' and passcode ='".md5($passcode)."'";
- $result = mysqli_query($connect,$sql);
- $row = mysqli_fetch_array($result,MYSQLI_ASSOC);
- $count = mysqli_num_rows($result);
- // If result match $myusername and $mypassword, table row must be 1 row
- if($count ==0) {
- echo "<font color=red><strong>Authentication failed - Invalid credentials</font></strong><br><br>";
- }else {
- $change_id = $_POST['change_id'];
- $approval_disposition = $_POST['approval_disposition'];
- $approval_reason = $_POST['approval_reason'];
- $approval_impact = $_POST['approval_impact'];
- $user = $_POST['user'];
- $approval_date = date('Y/m/d');
- $approval_expiry_date = date('Y/m/d', strtotime('+2 weeks'));
- $query = "UPDATE change_request_tbl SET approval_disposition='$approval_disposition', approval_reason='$approval_reason', approval_impact='$approval_impact', approval_name='$user', approval_date='$approval_date', approval_expiry_date='$approval_expiry_date' WHERE change_id='$change_id'";
- $query = "SELECT `change_requestor` FROM `change_request_tbl` WHERE `change_id` = $change_id";
- $result1 = mysqli_query($connect,$query);
- while ($row = mysqli_fetch_array($result1))
- $to = "******, ****, ****, *****, $row[change_requestor]";
- $subject = "New Change Acceptance Board (CAB) Approval";
- $message = "
- <html>
- <head>
- <style>
- body {font-family: Calibri;}
- body {font-style: italic;}
- .table {
- background-color: white;
- }
- </style>
- <title>Change Acceptance Board Approval</title>
- </head>
- <body>
- <p>A new Change Acceptance Board (CAB) Approval has been submitted:</p>
- <table border=4 bordercolor=black class=table>
- <tr>
- <th>Change ID:</th>
- <th>Disposition:</th>
- <th>Reason for Rejection or Exceptions:</th>
- <th>Impact (By CAB):</th>
- <th>Approved/Rejected by:</th>
- <th>Date Approved:</th>
- <th>Approval Expiry Date*:</th>
- </tr>
- <tr>
- <td>$change_id</td>
- <td>$approval_disposition</td>
- <td>$approval_reason</td>
- <td>$approval_impact</td>
- <td>$user</td>
- <td>$approval_date</td>
- <td>$approval_expiry_date</td>
- </tr>
- </table>
- <p>*This change must be completed by the Expiry Date. If this is not achieved a second CAB Request must be raised referencing this Change ID.</p>
- </body>
- </html>
- ";
- $headers = "MIME-Version:1.0" . "rn";
- $headers .= "Content-type:text/html;charset=UTF-8" . "rn";
- $headers .='From: <******>' . "rn";
- mail($to,$subject,$message,$headers);
- echo "Your CAB Approval Form has been submitted. You will receive an email confirmation shortly.<br><br>";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement