0){ header("Location: admin.php?userexist#account"); }else{ $statement = mysqli_query($con,"UPDATE accounts SET username='".mysqli_real_escape_string($con,$_POST['username'])."' WHERE ID='".$_SESSION['id']."'"); header('Location: worker.php?logout'); } } } ?> prepare('SELECT id, password FROM accounts WHERE username = ?')) { $stmt->bind_param('s', $_SESSION['name']); $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows > 0) { $stmt->bind_result($id, $password); $stmt->fetch(); if (password_verify($_POST['oldpassword'], $password)) { $npassword = password_hash($_POST['password1'], PASSWORD_DEFAULT); $statement = mysqli_query($con,"UPDATE accounts SET password='".mysqli_real_escape_string($con,$npassword)."' WHERE ID='".$_SESSION['id']."'"); if($statement) { header("Location: admin.php?pwupdated#account"); } } else { header("Location: admin.php?pwrong#account"); } } else { header("Location: admin.php?pwrong#account"); } $stmt->close(); } } else { header("Location: admin.php?pwnotmatch#account"); } } ?> 0){ header("Location: admin.php?userexist#users"); }else{ $newpw = password_hash($_POST['password'], PASSWORD_DEFAULT); $statement = mysqli_query($con, "INSERT INTO accounts (username, password, role) VALUES ('".mysqli_real_escape_string($con,$_POST['username'])."', '".mysqli_real_escape_string($con,$newpw)."', '".mysqli_real_escape_string($con, $_POST['role'])."')"); if($statement) { header("Location: admin.php?usercreated#users"); } } } } } ?> console.log('Debug Objects: " . $output . "' );"; } function sMaintenance() { include('config.php'); $con = mysqli_connect($config['DBHOST'], $config['DBUSER'], $config['DBPWD'], $config['DBNAME']); if ( mysqli_connect_errno() ) { exit('MySQl Connection failed with error: ' . mysqli_connect_error()); } $services = mysqli_query($con, "SELECT priority, groupid, name, id, status FROM services ORDER BY priority DESC"); $find = False; while($servicelist = mysqli_fetch_array($services)){ if(strpos($servicelist['status'], "Maintenance") !== false) { $find = True; } } return $find; } function sOffline() { include('config.php'); $con = mysqli_connect($config['DBHOST'], $config['DBUSER'], $config['DBPWD'], $config['DBNAME']); if ( mysqli_connect_errno() ) { exit('MySQl Connection failed with error: ' . mysqli_connect_error()); } $services = mysqli_query($con, "SELECT priority, groupid, name, id, status FROM services ORDER BY priority DESC"); $find = False; while($servicelist = mysqli_fetch_array($services)){ if(strpos($servicelist['status'], "Offline") !== false) { $find = True; } } return $find; } ?>