header('Location: list.php'); } } elseif ($op == "register") { $username = $_POST['username']; $password = $_POST['password']; $password2 = $_POST['password2']; $err = ""; if (strlen(trim($password)) > 0) { if (trim($password) != trim($password2)) { $err = "The passwords are not equal."; } } if ($err == "") { $err = insert_user($username, $password, array('users'), 0); $err = insert_credential($username, "", "InfrastructureManager", "", $username, $password, '', '', '', '', '', '', ''); $err = insert_credential($username, "", "VMRC", "http://servproject.i3m.upv.es:8080/vmrc/vmrc", "micafer", "ttt25", '', '', '', '', '', '', ''); } if (strlen($err) > 0) { header('Location: index.php?error=' . $err); } else { header('Location: index.php?info=User added successfully'); } } elseif ($op == "add") { $username = $_POST['username']; $password = $_POST['password']; $password2 = $_POST['password2']; $groups = $_POST['user_groups']; $permissions = $_POST['permissions']; $err = ""; if (strlen(trim($password)) > 0) { if (trim($password) != trim($password2)) {
if (isset($_POST['tenant'])) { $tenant = $_POST['tenant']; } if (isset($_FILES['proxy']['tmp_name'])) { $proxy = file_get_contents($_FILES['proxy']['tmp_name']); } if (isset($_FILES['public_key']['tmp_name'])) { $public_key = file_get_contents($_FILES['public_key']['tmp_name']); } if (isset($_FILES['private_key']['tmp_name'])) { $private_key = file_get_contents($_FILES['private_key']['tmp_name']); } if (isset($_FILES['certificate']['tmp_name'])) { $certificate = file_get_contents($_FILES['certificate']['tmp_name']); } $err = insert_credential($imuser, $id, $type, $host, $username, $password, $token_type, $project, $proxy, $public_key, $private_key, $certificate, $tenant); if (strlen($err) > 0) { header('Location: error.php?msg=' . urlencode($err)); } else { header('Location: credentials.php'); } } elseif ($op == "edit") { if (isset($_POST['id'])) { $rowid = $_POST['rowid']; $id = $_POST['id']; $type = $_POST['type']; $host = ""; $username = ""; $password = ""; $token_type = ""; $project = "";