* (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 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 '../../includes/includes.php'; sec_session_start(); if (!isset($_SESSION['username'])) { header("Location: ../../logout.php"); exit; } //Check parameters if (!dbCheckDevName_exist($_GET['devName'])) { $message = "Impossible to delete. This device is already deleted."; header('Location: ../error.php?errorMessage=' . $message); exit; } else { $message = dbDeleteDevice($_GET['devName']); if ($message == 'true') { header('Location: ../deleteDevice_success.php?devName=' . $_GET['devName']); exit; } else { header('Location: ../error.php?errorMessage=' . $message); exit; } }
include_once '../../includes/includes.php'; sec_session_start(); if (!isset($_SESSION['username'])) { header("Location: ../../logout.php"); exit; } if (isset($_GET['opt'])) { $check = dbCheckCorrectDevPwd($_POST['devName'], $_POST['devActualPwd']); if ($check == true) { if ($_GET['opt'] == "info") { $result = dbCheckDevName_format($_POST['devNewName']); if ($result == false) { header('Location: ../devDetails.php?devName=' . $_POST['devName'] . '&errorMessage=New device name has not correct format'); exit; } $result = dbCheckDevName_exist($_POST['devNewName']); if ($_POST['devName'] != $_POST['devNewName'] && $result == true) { header('Location: ../devDetails.php?devName=' . $_POST['devName'] . '&errorMessage=New device name already exist'); exit; } $email = dbGetUserEmail($_SESSION['username']); if ($email == false) { header('Location: ../../error.php?err=Please log in again'); exit; } //Change info $result = dbChangeBasicInfo($_POST['devName'], $_POST['devNewName'], $_POST['devNewType'], $_POST['devNewPrivacy'], $_POST['devNewStatus']); if ($result == true) { /* send email functions. It doesn't work in local $to = $email; $subject = "Device changes: Basic info";
function dbCheckNewDevName($devName) { //valid devname (alphanumeric + 6 characters min if (!dbCheckDevName_format($devName)) { return "Device name is not valid"; } if (dbCheckDevName_exist($devName)) { return "This device name already exists. Please choose another one"; } return true; }