Example #1
0
*
*    You should have received a copy of the GNU General Public License
*    along with eLabFTW.  If not, see <http://www.gnu.org/licenses/>.
*
********************************************************************************/
require_once '../inc/common.php';
// check id
if (is_pos_int($_POST['id'])) {
    $id = $_POST['id'];
} else {
    die(_("The id parameter is not valid!"));
}
// we update the name of a team via sysconfig.php
if (isset($_POST['team_name'])) {
    $sysconfig = new \Elabftw\Elabftw\SysConfig();
    if (!$sysconfig->editTeam($id, $_POST['team_name'])) {
        echo 'Error updating team name';
    }
    exit;
}
// we only update status
if (isset($_POST['status'])) {
    if (is_pos_int($_POST['status'])) {
        $status = $_POST['status'];
    } else {
        exit;
    }
    $sql = "UPDATE experiments \n        SET status = :status \n        WHERE userid = :userid \n        AND id = :id";
    $req = $pdo->prepare($sql);
    $result = $req->execute(array('status' => $status, 'userid' => $_SESSION['userid'], 'id' => $id));
    // we only update visibility