<commit_before><?php
/*
//Copyright (c) 2013 <NAME>.
//All rights reserved. This program and the accompanying materials
//are made available under the terms of the GNU Affero General Public License v3.0 which accompanies this distribution, and is available at
//http://www.gnu.org/licenses/agpl.html
//
//Contributors:
//    <NAME> - initial API and implementation
*/ 


?>

<div id="content">

<?php
$right_required = "EditSite";
If(isset($_SESSION['level']) && CheckRights($_SESSION['level'], $right_required)){

//Once the information is submitted, store it in the database
If(!empty($_POST)){

//Escape entered info

	$escapedgroup = mysql_real_escape_string($_POST['group']);
    $groupType = $_POST['grouptype'];

//Verify that the group name is not already taken

	$query = "select * from groups where name='$escapedgroup'";
	$pwq = mysql_query($query, $master);
	$num = mysql_num_rows($pwq);

	If(!empty($num)){
		echo "That group name is not unique. group not created.";
	}
	else{

		$query = "insert into groups (name, creator, type) values ('$escapedgroup', $user, $groupType); ";
		$upd = mysql_query($query, $master);

		
	}

}

//First, find all current days
    
    $groupt_sql = "select id, name from `grouptypes`";
    $groupt_res = mysql_query($groupt_sql, $master);
	$query="SELECT g.name as name, t.name as type FROM groups as g LEFT JOIN grouptypes as t on g.type=t.id ORDER BY name ASC";
	$mem_result = mysql_query($query, $master);

?>
<p>

This page allows for adding new groups to FestivalTime.

</p>
<form action="index.php?disp=add_groups" method="post">
<table border="1">
<tr>
<th>group</th>
<th>group type</th>
</tr>
<tr>
<td>
<input type="text" name="group" maxlength="100" size ="100"><commit_msg>fixed typo, added key to add groups<commit_after><?php
/*
//Copyright (c) 2013 <NAME>.
//All rights reserved. This program and the accompanying materials
//are made available under the terms of the GNU Affero General Public License v3.0 which accompanies this distribution, and is available at
//http://www.gnu.org/licenses/agpl.html
//
//Contributors:
//    <NAME> - initial API and implementation
*/ 


?>

<div id="content">

<?php
$right_required = "EditSite";
If(isset($_SESSION['level']) && CheckRights($_SESSION['level'], $right_required)){

//Once the information is submitted, store it in the database
If(!empty($_POST)){

//Escape entered info

	$escapedgroup = mysql_real_escape_string($_POST['group']);
    $groupType = $_POST['grouptype'];

//Verify that the group name is not already taken

	$query = "select * from groups where name='$escapedgroup'";
	$pwq = mysql_query($query, $master);
	$num = mysql_num_rows($pwq);

	If(!empty($num)){
		echo "That group name is not unique. group not created.";
	}
	else{
	    $key="";
        for ($i=0; $i < 10; $i++) { 
            $key .= randAlphaNum();
        }
		$query = "insert into groups (name, creator, type, key) values ('$escapedgroup', $user, $groupType, $key); ";
		$upd = mysql_query($query, $master);

		
	}

}

//First, find all current days
    
    $groupt_sql = "select id, name from `grouptypes`";
    $groupt_res = mysql_query($groupt_sql, $master);
	$query="SELECT g.name as name, t.name as type FROM groups as g LEFT JOIN grouptypes as t on g.type=t.id ORDER BY name ASC";
	$mem_result = mysql_query($query, $master);

?>
<p>

This page allows for adding new groups to FestivalTime.

</p>
<form action="index.php?disp=add_groups" method="post">
<table border="1">
<tr>
<th>group</th>
<th>group type</th>
</tr>
<tr>
<td>
<input type="text" name="group" maxlength="100" size ="30">
{'fraction_non_alphanumeric': 0.15942028985507245, 'fraction_numerical': 0.007803790412486065, 'mean_word_length': 4.3170370370370375, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2623302', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1191, 'n_words': 381}