include_once不工作,但当我删除一些方法工作?

时间:2018-04-02 09:42:02

标签: php

大家好,不工作的原因是什么?include_once? 我认为我的方法有问题,因为我使用了(带有方法和接口的类) 如果您想了解更多信息,请告诉我。 我需要解决方案,因为我准备了一个项目:/

这是我的页面config.php

<?php 

include_once '../connexion/Connexion.php';
include_once '../Services/UtilisateurService.php'; 
 include_once '../Services/AssocService.php';
session_start();

$nom = '';
$motpass = '';
    $profile='';
    $observation='';
$id = 0;
$update = false;

if (isset($_POST['save'])) 
    {

            $nom = $_POST['nom'];
    $motpass = $_POST['password'];
            $profile = $_POST['profil'];
            $observation = $_POST['observation'];
            $dot=new UtilisateurService();
            $ope=new Utilisateur(NULL,$nom,$password,$profil,$observation);
            $dot->create($ope);

            $_SESSION['message'] = "Utilisateur Enregistre"; 
    header('location: ../Goperateur.php');
}

if (isset($_POST['update'])) 
{ 
            $es = new AssocService(); 
            $es->update($es->finById($id));
    $_SESSION['message'] = "Utilisateur Modifier!";
        header('location: ./Goperateur.php');

}

  if(isset($_POST['ajouter']))
    {   
        $nom=$_POST['nom'];
        $password=$_POST['password'];
        $profil=$_POST['profil'];
        $observation=$_POST['observation'];
        $dot=new UtilisateurService();
        $ope=new Utilisateur($idd,$nom,$password,$profil,$observation);
        $dot->create($ope);
        header("location:./Goperateur.php");

    }

if (isset($_GET['id'])) 
{       
    $id = $_GET['id'];
        $es = new AssocService();
        $es->delete($es->findById($id));

    $_SESSION['message'] = "Utilisateur suprimer"; 
    header('location: ../Goperateur.php');
}

这是我的页面索引

<?php include_once './action/configOperateur.php';?>
   <?php 
    if (isset($_GET['edit'])) {
        $id = $_GET['edit'];
        $update = true;
        $record = mysqli_query($db, "SELECT * FROM  utilisateur WHERE id_utilisateur=$id");

        if (count($record) == 1 ) {
            $n = mysqli_fetch_array($record);
            $nom = $n['nom'];
            $motpass = $n['mot_passe'];
                        $profile=$n['profil'];
                        $observation=$n['observation'];
        }
    }
?>
</head>
<body>

    <div id="wrapper">
        <nav class="navbar navbar-default navbar-cls-top " role="navigation" style="margin-bottom: 0">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button> 
            </div>
  <div style="color: white;
padding: 15px 50px 5px 50px;
float: right;
font-size: 16px;">

<script> document.write(new Date().toLocaleDateString()); </script>
<a href="#" class="btn btn-danger square-btn-adjust">Se déconnecter </a> </div>
        </nav>   
           <!-- /. NAV TOP  -->
                <nav class="navbar-default navbar-side" role="navigation">
            <div class="sidebar-collapse">
                <ul class="nav" id="main-menu">
                <li class="text-center">
                                    <img src="assets/img/radeema.png" class=""/>
                    </li>
                    <li>
                        <a href="index.php"><i class="fa fa-dashboard fa-3x"></i>Tableau de bord</a>
                    </li>
                     <li>
                         <a  href="Operateur.php"><i class="fa fa-desktop fa-3x"></i> Gestion des Operateurs</a>
                    </li>
                    <li>
                        <a  href="dotation/DotationForm.php"><i class="fa fa-cloud" style="font-size:36px"></i> Gestion de Dotation</a>
                    </li>
                    <li>
                        <a   href=""><i style="font-size:36px" class="fa">&#xf114;</i> Gestion des Puces</a>
                    </li>   
                      <li  >
                        <a  href=""><i class="fa fa-table fa-3x"></i> Gestion Des Entites</a>
                    </li>
                    <li  >
                        <a  href=""><i class="fa fa-male" style="font-size:36px"></i> Gestion de Personnels </a>
                    </li>
                    <li  >
                        <a  href="AssPersPuce.php"><i class="fa fa-male" style="font-size:36px"></i> Association Personnels-Puces </a>
                    </li>
        </ul>
            </div>

        </nav>  
        <!-- /. NAV SIDE  -->
        <div id="page-wrapper" >
            <div id="page-inner">
                <div class="row">
                    <div class="col-md-12">
                        <h2>Gestion des operateurs </h2> 
                        <h5> </h5>
                    </div>
                </div>              
                 <!-- /. ROW  -->
                  <hr />
                   <?php if (isset($_SESSION['message'])): ?>
                  <div style="margin: 30px auto; 
    padding: 10px; 
    border-radius: 5px; 
    color: #3c763d; 
    background: #dff0d8; 
    border: 1px solid #3c763d;
    width: 50%;
    text-align: center;">
        <?php 
            echo $_SESSION['message']; 
            unset($_SESSION['message']);
        ?>
    </div>
    <?php endif ?>

                <div class="row">
                <div class="col-md-12">
                    <!-- Form Elements -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-md-6">
                                    <form method="post" action="">
                                        <div class="form-group">
                                                    <label>Nom</label>
                                                    <input type="text" name="nom" class="form-control" placeholder="entre le nom Complet" value="<?php echo $nom; ?>"/>
                                        </div>
                                        <div class="form-group">
                                                    <label>Mot de Pass</label>
                                                    <input type="text" name="password" class="form-control" placeholder="entre mot de pass" value="<?php echo $motpass; ?>"/>
                                        </div>
                                        <div class="form-group">
                                                    <label>Selectioner le profil</label>
                                                    <select name="profil" class="form-control">
                                                        <?php if($profile=='operateur') 
                                                        {?>
                                                        <option value="admin">Operateur</option>
                                                        <option value="operateur">Admin</option>
                                                        <?php } 
                                                        else 
                                                        {
                                                            ?>
                                                        <option value="admin">Admin</option>
                                                        <option value="operateur">Operateur</option>
                                                        <?php }?>
                                                    </select>
                                        </div>
                                        <div class="form-group">
                                                    <label>Observation</label>
                                                    <textarea type="text" name="observation" class="form-control" rows="3" ><?php echo $observation; ?></textarea>
                                        </div>
                                                <?php if ($update == false): ?>
        <button class="btn btn-primary" type="submit" name="ajouter" >Ajouter</button>
<?php else: ?>
    <button class="btn " type="submit" name="update" style="background: #556B2F;" >Modifier</button>
<?php endif ?>
                                                <button name="annuler" type="reset" class="btn btn-default">Annuler</button>
                                    </form>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
        </div>

    <hr/>
        <div class="col-md-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                             Liste des Operateur
                        </div>
                        <div class="panel-body">
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                    <thead>
                                        <tr>
                                            <th>Nom</th>
                                            <th>Motsepass</th>
                                            <th>Profil</th>
                                            <th>Observation</th>
                                            <th>Modifier</th>
                                            <th>Suprimer</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr class="odd gradeX">

                                        <?php
                                            require_once './Services/UtilisateurService.php';
                                            require_once './Classes/Utilisateur.php';
                                            $dot=new UtilisateurService();
                                            foreach ($dot->findAll() as $key=>$e) 
                                            {
                                        ?>
                                            <form method="post" action="Operateur.php">   
                                            <tr>
                                                <td class="center"><?php echo $e->getNom();?></td>
                                                <td class="center"><?php echo $e->getMotdepasse();?></td>
                                                <td class="center"><?php echo $e->getProfil();?></td>
                                                <td class="center"><?php echo $e->getObservation();?></td>

                                                <td><a href="<?php echo "Goperateur.php?&edit=".$e->getId_ut().""?>">Modifier</a></td>
                                                <td><a href="<?php echo "./action/configOperateur.php?&id=".$e->getId_ut()."" ?>">Suprimer</a></td>
                                            </tr>

                                        <?php

                                        }

                                        ?>
                                         </tr>
                                    </tbody>
                                </table>

0 个答案:

没有答案