mail($to,$subject,$txt,$headers);
            */
         header('Location: ../devDetails.php?devName=' . $_POST['devNewName'] . '&success=Device info was changed');
         exit;
     } else {
         header('Location: ../devDetails.php?devName=' . $_POST['devName'] . '&errorMessage=Impossible to change device info');
         exit;
     }
 } else {
     if ($_GET['opt'] == "pwd") {
         if ($_POST['devNewPwd'] == $_POST['devConfirmNewPwd']) {
             if (strlen($_POST['devNewPwd']) < 6) {
                 header('Location: ../devDetails.php?devName=' . $_POST['devName'] . '&errorMessage=New password should have 6 or more characters');
                 exit;
             }
             $email = dbGetUserEmail($_SESSION['username']);
             if ($email == false) {
                 header('Location: ../../error.php?err=Please log in again');
                 exit;
             }
             //change password
             $result = dbChangeDevPwd($_POST['devName'], $_POST['devNewPwd']);
             if ($result == true) {
                 /* send email functions. It doesn't work in local
                    $to = $email;
                    $subject = "Device changes: Password";
                    $txt = "There were some changes in your ".$_POST['devName']." device.\r\n\r\n"
                          ."New Password: "******"From: no_replay@".$_SERVER[HTTP_HOST]."\r\n";
                    mail($to,$subject,$txt,$headers);
                    */
示例#2
0
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
include_once 'outputs/includeOutputs.php';
include_once '../includes/includes.php';
//session management
sec_session_start();
if (!isset($_SESSION['username'])) {
    header("Location: ../logout.php");
    exit;
}
//Set variables
$username = $_SESSION['username'];
$email = dbGetUserEmail($username);
$role = dbGetUserRole($username);
/*************
 * PRINT HTML
 *************/
$header = new outputHeader();
$header->printSimpleHeader("IoT MyAdmin - Profile");
$header->closeHeader();
openBody();
printNavbarAndSidebar("blank");
printBody($username, $email, $role);
closeBody();
$footer = new outputFooter();
$footer->closeHtml();
/**************************************************************************
 * custom html code