You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if(!$is_admin){die("You do not have permission to do this.");}
if(!isset($_POST['display_name']) or $_POST['display_name'] == ''){die('invalid request, display_name is empty');}
if(!isset($_POST['teachers'])){die('invalid request, teachers is empty');}
$teachers = str_getcsv($_POST['teachers']);
if(count($teachers) < 1){die('invalid request, no teachers specified');}
foreach($teachers as $teacher_uid){
runSql('check_user_existance_by_uid', 'SELECT * FROM user_ WHERE uid = $1;', array($teacher_uid)) or die('teacher does not exist w/ id '.$teacher_uid);
}
$classid = base64_encode(random_bytes(16));
runSql('new_class', 'INSERT INTO class (classid, display_name) VALUES ($1, $2);', array($classid, san($_POST['display_name']))) or die('failed to create class');