<?php
 
    session_start();
 
    require_once('config.php');
 
    $url="./managegroups.php";
 
    // if (empty($_POST['group']))
 
    if (empty($_GET['group']))
 
    //Oublie d'un champ
 
    {
 
        echo '<script type="text/javascript">window.location="'.$url.'";</script>';
 
    }
 
    else
 
    //On check le mot de passe
 
    {
 
    if(!empty($_GET["delete"])){
 
        $query=$bdd->prepare('SELECT * FROM groups WHERE name=:name');
 
        // $query->bindValue(':name',$_POST['group'],PDO::PARAM_STR);
 
        $query->bindValue(':name',$_GET['group'],PDO::PARAM_STR);
 
        $query->execute();
 
        $data=$query->fetch();
 
        ?>
 
        <!--<form id="properties" method="POST">-->
 
        <fieldset>
 
        <legend>Properties</legend>
 
        <p>
 
        <label for="name">oldname</label><input name="name" type="text" id="name" value="<?php echo $data['name'];?>" disabled="disabled"/><br>
 
        <label for="description">description</label><textarea name="description" ROWS="4" COLS="40" id="description" ><?php echo nl2br(stripslashes(htmlspecialchars($data['description'])));?></textarea><br>
 
        <label for="startaccesstime">startaccesstime</label><input name="startaccesstime']; ?>" type="text" id="startaccesstime" value="<?php echo $data['startaccesstime'];?>" disabled="disabled"/><br>
 
        <label for="endaccesstime">endaccesstime</label><input name="endaccesstime" type="text" id="endaccesstime" value="<?php echo $data['endaccesstime'];?>"  disabled="disabled"/><br>
 
        <label for="datecreation">datecreation</label><input name="datecreation" type="text" id="datecreation"  value="<?php echo $data['datecreation'];?>" disabled="disabled"/><br>
 
        <label for="recurrence">recurrence</label><input name="recurrence" type="text" id="recurrence"  value="<?php echo $data['recurrence'];?>" disabled="disabled"/><br>
 
        <label for="days">days</label><input name="days" type="text" id="days" value="<?php echo $data['days'];?>" disabled="disabled"/> <span style="font-size:12px;">use for custom recurrence only, example= friday,monday,saturday</span> <br >
 
        </p>
 
        </fieldset>
 
        <p><input type="submit" value="Submit" /></p>
 
        <!--</form><div id="manage2"></div>-->
 
        <?php    
 
        $query->CloseCursor();
 
    }else{
 
 
        $query=$bdd->prepare('SELECT * FROM groups WHERE name=:name');
 
        // $query->bindValue(':name',$_POST['group'],PDO::PARAM_STR);
 
        $query->bindValue(':name',$_GET['group'],PDO::PARAM_STR);
 
        $query->execute();
 
        $data=$query->fetch();
 
        ?>
 
        <!--<form id="properties" method="POST">-->
 
 
        <legend>Properties</legend>
 
        <p>
 
        <label for="name">oldname</label><input name="oldname" type="text" id="oldname" value="<?php echo $data['name'];?>" disabled="disabled"/><br>
 
        <label for="name">name</label><input name="name" type="text" id="name" value="<?php echo $data['name'];?>"/><br>
 
        <label for="description">description</label><textarea name="description" ROWS="4" COLS="40" id="description" ><?php echo $data['description'];?></textarea><br>
 
        <label for="startaccesstime">startaccesstime</label><input name="startaccesstime']; ?>" type="text" id="startaccesstime" value="<?php echo $data['startaccesstime'];?>" /><br>
 
        <label for="endaccesstime">endaccesstime</label><input name="endaccesstime" type="text" id="endaccesstime" value="<?php echo $data['endaccesstime'];?>" /><br>
 
        <label for="datecreation">datecreation</label><input name="datecreation" type="text" id="datecreation"  value="<?php echo $data['datecreation'];?>"/><br>
 
        <?php
 
                        $rang = array
 
                        ('dayly','weekly','monthly','quartely','yearly','once','custom'); 
 
                        echo'<label for="recurrence">recurrence</label>';
 
                        echo'<select name="recurrence" id="recurrence">';
 
                        for($i=0;$i<7;$i++)
 
                        {
 
                            if ($rang[$i] == $data['recurrence'])
 
                                {
 
                                echo'<option value="'.$data['recurrence'].'" selected="selected">'.$data['recurrence'].'</option>';
 
                            }
 
                            else
 
                            {
 
                                echo'<option value="'.$rang[$i].'">'.$rang[$i].'</option>';
 
                            }
 
                        }
 
                echo'</select><br>';
 
        ?>
 
        <label for="days">days</label><input name="days" type="text" id="days" value="<?php echo $data['days'];?>"/> <span style="font-size:12px;">use for custom recurrence only, example= friday,monday,saturday</span> <br >
 
        </p>
 
 
        <p><input type="submit" value="Submit" /></p>
 
        <!--</form><div id="manage2"></div>-->
 
        <?php
 
        $query->CloseCursor();}
 
    }
 
?>
 
 |