survey_seahorse

Software Engineering Project - Fall 2018
Log | Files | Refs | README

admin-message.php (608B)


      1 <?php
      2 include_once 'session.php';
      3 
      4 if (!empty($_POST['message'])) {
      5     $uid = $_SESSION['uid'];
      6     $username = $_SESSION['username'];
      7     $message = $_POST['message'];
      8     $var_str = var_export($message, true);
      9     $var = "<?php\n\n\$message = $var_str;\n\n\$uid = $uid;\n\n\$user = '$username';\n\n?>";
     10     file_put_contents("txt/msg.php",$var);
     11     header("Location: ../controlpanel.php?msg=success");
     12 } elseif (isset($_POST['remove'])) {
     13     file_put_contents("txt/msg.php","");
     14     header("Location: ../controlpanel.php?msg=success");
     15 } else {
     16     header("Location: ../controlpanel.php?err=nomsg");
     17 }
     18