Erreur : Use of undefined constant - assumed ' ' in

Eléphanteau du PHP | 18 Messages

16 nov. 2013, 18:57

Bonjours à tous
Voila j'ai un gros problème avec mon site
J'ai télécharger un cms
mais il y a plain d'érreur j'ai réussie a en régler quelle que une mais pour les autre je ne comprend pas vois ces erreur :

-1 Use of undefined constant - assumed ' ' in C:\Datacenter01\public_html\teste\include\header.php on line 146

-2 Notice: Use of undefined constant - assumed ' ' in C:\Datacenter01\public_html\teste\include\header.php on line 170

-3 Notice: Use of undefined constant - assumed ' ' in C:\Datacenter01\public_html\teste\index.php on line 114

Voila les code des page:

Page header.php
<?php 
if(!file_exists('include/installation.txt')) { 
  header('Location: install/index.php');
  exit();
}
$URLMaint = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
if($maintenance == "true" AND $URLMaint != $url.'/connexion.php' AND $URLMaint != $url.'/maintenance.php') {
    if($rang != "Administrateur") {
        header('Location: '.$url.'/maintenance.php');
        exit();
    }
}
require_once('include/JSONAPI.php');
include_once('include/variables.php');

$req_nbVisite = $connexion->prepare('SELECT * FROM visites WHERE date=:date AND ip=:ip');
$req_nbVisite->execute(array(
  'date' => $date,
  'ip' => $_SERVER['REMOTE_ADDR']
));
$nbVisite = $req_nbVisite->rowCount();
if($nbVisite == "0") {
  $addVisite = $connexion->prepare("INSERT INTO visites SET date=:date, ip=:ip");
  $addVisite->execute(array(
    'date' => $date,
    'ip' => $_SERVER['REMOTE_ADDR']
  ));
}
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <title><?php echo $nom; ?> | <?php echo $titre; ?></title>
    <meta http-equiv="Content-Type" content="text/html;charset=ut8" />
    <meta re="stylesheet" href="style.css" media="screen">
    <link rel="stylesheet" media="screen" href="style.css">
    <meta name="keywords" content="CMS, minecraft, LapisCraft, <?php echo $keywords; ?>">
    <meta name="author" content="Eywek, mineconstructe, Valentin Touffet">
    <link rel="icon" href="images/favicon.gif">
    <link href="bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css">
    <link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css">
    <!-- CSS -->
    <style type="text/css">

      /* Sticky footer styles
      -------------------------------------------------- */

      html,
      body {
        height: 100%;
        background: url(<?php echo $background; ?>) no-repeat fixed;
        background-size: 100% 100%;
        /* The html and body elements cannot have any padding or margin. */
      }
      /* Wrapper for page content to push down footer */
      #wrap {
        min-height: 100%;
        height: auto !important;
        height: 100%;
        /* Negative indent footer by it's height */
        margin: 0 auto -60px;
      }

      /* Set the fixed height of the footer here */
      #push,
      #footer {
        height: 60px;
      }
      #footer {
        background-color: #E6E6E6;      }
      /* Lastly, apply responsive CSS fixes as necessary */
      @media (max-width: 767px) {
        #footer {
          margin-left: -20px;
          margin-right: -20px;
          padding-left: 20px;
          padding-right: 20px;
        }
      }



      /* Custom page CSS
      -------------------------------------------------- */
      /* Not required for template or sticky footer method. */

      #wrap > .container {
        padding-top: 60px;
      }
      .container .credit {
        margin: 20px 0;
      }

      code {
        font-size: 80%;
      }

    </style>
    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="../assets/js/html5shiv.js"></script>
    <![endif]-->
  </head>

  <body>


    <!-- Part 1: Wrap all page content here -->
    <div id="wrap">

      <!-- Fixed navbar -->
      <div class="navbar navbar-fixed-top">
        <div class="navbar-inner">
          <div class="container">
            <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>
            <!--<a class="brand" href="index.php">LapisCraft</a>-->
            <div class="nav-collapse collapse">
              <ul class="nav">
                
                <!-- NAVBAR PERSONNALISE -->
                <li <?php if($monUrl == ''.$url.'/' OR $monUrl == ''.$url.'/index.php') { echo 'class="active"'; } ?>><a style="font-family: minecraftiaregular;" href="index.php">Accueil</a></li>
                <li <?php if($monUrl == ''.$url.'/boutique.php') { echo 'class="active"'; } ?>><a style="font-family: minecraftiaregular;" href="boutique.php">Boutique</a></li>
                <li class="dropdown">
                  <a style="font-family: minecraftiaregular;" href="#" class="dropdown-toggle" data-toggle="dropdown">Serveur <b class="caret"></b></a>
                  <ul class="dropdown-menu">
                    <li><a style="font-family: minecraftiaregular;" href="banlist.php">BanList</a></li>
                    <li><a href="chat.php" style="font-family: minecraftiaregular;">Chat</a></li>
                    <li><a href="players.php" style="font-family: minecraftiaregular;">Joueurs en ligne</a></li>
                  </ul>
                <li <?php if($monUrl == ''.$url.'/support.php') { echo 'class="active"'; } ?>><a style="font-family: minecraftiaregular;" href="support.php">Support</a></li>
                <li <?php if($monUrl == ''.$url.'/voter.php') { echo 'class="active"'; } ?>><a style="font-family: minecraftiaregular;" href="voter.php">Vote</a></li>

                <?php 
                $req_onglet = $connexion->query("SELECT * FROM navbar ORDER BY ordre");
                $req_onglet->setFetchMode(PDO::FETCH_OBJ);
                while($onglets = $req_onglet->fetch()) { ?>
                <li <?php if($monUrl == $url.'/'.$onglets->url) { echo 'class="active"'; } ?> ><a style="font-family: minecraftiaregular;" href="<?php echo $onglets->url ?>"><?php echo $onglets->nom ?></a></li>
                <?php } ?>
                <!-- ### -->  
                
                <!-- RESTE TOUJOURS LA | A NE PAS SUPPRIMER | NON MODIFIABLE -->
                  <?php if(!connect()) { ?>
                  <form method="post" style="margin-left: 10px; margin-bottom: 0px; margin-top: 3px;" class="form-inline pull-right" action="connexion.php">
                  <input type="text" class="input-medium" style="width: 120px;" name="pseudo" placeholder="Pseudo">
                  <input type="password" class="input-small" style="width: 60px;" name="password" placeholder="Mot de Passe">
                  <button type="submit" style="margin-top: 1px;font-family: minecraftiaregular;" class="btn btn-primary">Connexion</button>
                  <a class="btn btn-small" aria-hidden="true" type="text" href="#inscription" role="button" data-toggle="modal" style="font-family: minecraftiaregular;">Inscription</a>
                  </form>
                  <?php } else { ?>
                      &nbsp;&nbsp;
                      <div class="btn-group">
                        <a style="font-family: minecraftiaregular;" class="btn btn-info dropdown-toggle" data-toggle="dropdown" href="#">
                        <img src="https://minotar.net/helm/<?php echo $pseudo; ?>/20">&nbsp;Mon Profil <span class="caret"></span></a>
                        </a>
                        <ul class="dropdown-menu">
                        <li><a style="font-family: minecraftiaregular;" href="profil.php">Profil</a><li>
                        <li><a style="font-family: minecraftiaregular;" href="mprofil.php">Modifier ses infos</a><li>
                        <li><a style="font-family: minecraftiaregular;" onClick="alert('La messagerie n\'est pas encore disponible !');" title="Pas encore disponible !">Messagerie</a><li>
                        <?php if($rang == "Administrateur") { ?>
                        <li class="divider"></li>
                        <li><a style="font-family: minecraftiaregular;" href="admin/admin.php">Pannel d'admin</a></li>
                        <?php } ?>
                        </ul>
                        </div>
                  <a style="font-family: minecraftiaregular;" class="btn btn-small" aria-hidden="true" type="text" href="logout.php">Déconnexion</a>
                  <?php } ?>
                  <!-- #### -->
                </li>
              </ul>
            </div>
          </div>
        </div>
      </div>
<!-- ============= Inscription =========== -->
<div id="inscription" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="inscriptionLabel" aria-hidden="true">
    <div class="modal-header">
      <button class="close" data-dismiss="modal" aria-hidden="true">×</button>
      <h3 style="font-family: minecraftiaregular;">Inscription</h3> 
    </div>
    <div class="modal-body">
    <div id="message_Inscription"></div>
      <form class="form-horizontal" method="post" action="inscription.php">
        <div class="control-group">
          <label class="control-label" for="usernameregister" style="font-family: minecraftiaregular;">Nom d'utilisateur <br> (pseudo en jeu)</label>
          <div class="controls">
            <input type="text" name="pseudo" value="">
          </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="passwordregister" style="font-family: minecraftiaregular;">Mot de passe</label>
          <div class="controls">
            <input type="password" name="password" value=""/>
          </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="passwordregister2" style="font-family: minecraftiaregular;">Confirmation</label>
          <div class="controls">
            <input type="password"  name="password2" value="" placeholder="Entrez le même mot de passe" />
          </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="emailregister" style="font-family: minecraftiaregular;">Adresse email</label>
          <div class="controls">
            <input type="text"  name="email" value="">
          </div>
        </div> 
        <div class="control-group">
    <div class="controls">
    <img src="captcha.php" alt="Captcha" id="captcha">
    <img src="images/reloadc.png" alt="Recharger l'image" title="Recharger l'image" style="cursor:pointer;position:relative;top:-7px;" onclick="document.images.captcha.src='captcha.php?id='+Math.round(Math.random(0)*1000)" /><br><br>
    <input type="text" style="height: 30px;" name="captcha" placeholder="Recopiez le code ci-dessus" required><br>
  </div>
  </div>       
    </div>
    <div class="modal-footer">
      <button class="btn" data-dismiss="modal" aria-hidden="true" style="font-family: minecraftiaregular;">Annuler</button>
      <button type="submit" class="btn btn-success" style="font-family: minecraftiaregular;">S'inscrire</button>
    </form>
    </div>
  </div>
Page index.php
<?php
$titre = "Accueil";
include('include/init.php');
include('include/header.php');
?>   
      <!-- Begin page content -->
        <div class="container">
          <div class="page-header">
           <!-- =========== ALERTE ========= -->
           <?php
              if(!empty($_GET['msg'])) {
                if($_GET['msg']=="ok") {
                  echo '<div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">&times;</button><strong>Succès:</strong> Vous êtes désormais connecté.</div>';
                }
                if($_GET['msg']=="serveroff") {
                  echo '<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">&times;</button><strong>Erreur:</strong> Le serveur est éteint donc la BanList ne peut pas être affiché.</div>';
                }
                if($_GET['msg']=="serveroffP") {
                  echo '<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">&times;</button><strong>Erreur:</strong> Le serveur est éteint donc la liste des joueurs en ligne ne peut pas être affiché.</div>';
                }
                if($_GET['msg']=="accessdeny") {
                  echo '<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">&times;</button><strong>Erreur:</strong> Vous n\'avez pas accès a cette partie du site !</div>';
                }
                if($_GET['msg']=="noco") {
                  echo '<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">&times;</button><strong>Erreur:</strong> Vous devez être connecté sur le serveur pour pouvoir voter !</div>';
                }
                if($_GET['msg']=="serveroff2") {
                  echo '<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">&times;</button><strong>Erreur:</strong> Le serveur est éteint donc vous ne pouvez pas voter !</div>';
                }
                if($_GET['msg']=="serveroffChat") {
                  echo '<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">&times;</button><strong>Erreur:</strong> Le serveur est éteint donc le chat en ligne ne peut pas être affiché !</div>';
                }
              }
              if(!empty($_GET['achat'])) {
                if($_GET['achat']=="serveroff") {
                  echo '<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">&times;</button><strong>Erreur:</strong> Le serveur est éteint donc l\'achat ne peux pas s\'effectuer.</div>';
                }
              }
            ?>
          </div>
          <!-- ===========SLIDER =========== -->
          <style type="text/css">
/* ============ CUSTOMIZE SLIDER ========= */
    /* Carousel base class */

    .carousel .container {
      position: relative;
      z-index: 9;
    height:335px;
    width:975px;
    }

    .carousel-control {
      height: 80px;
      margin-top: 0;
      font-size: 120px;
      text-shadow: 0 1px 1px rgba(0,0,0,.4);
      background-color: transparent;
      border: 0;
      z-index: 10;
    }

    .carousel .item {
    /*background: url(images/slider/background.png);*/
    width: 975; 
    height: 335;
    }
    .carousel img {
      position: absolute;
    top: -3px;
    left: 94px;
    z-index:99;
    }

     .carousel-caption {
      padding: 10px 20px;
      margin-top: 200px;
    }
    .carousel-caption h1,
    .carousel-caption .lead {
      margin: 0;
      line-height: 1.25;
      color: #fff;
      text-shadow: 0 1px 1px rgba(0,0,0,.4);
    }
    .carousel-caption .btn {
      margin-top: 10px;
    }
          </style>
<!-- HEADER DE LA PAGE --> 
<?php 
// SLIDER REQUETE
$sql = $connexion->query('SELECT * FROM slider ORDER BY id');
$sql->setFetchMode(PDO::FETCH_OBJ);
?>
<div class="container">
  <div class="page-header">
  </div>
  <div class="span12" style="margin-top: -50px;">
    <div id="myCarousel" class="carousel slide">
      <div class="carousel-inner pull-left" style="margin-left: -60px;margin-bottom: 20px;">
      <?php $numero = 0; while($req = $sql->fetch()) { $numero++; ?>
        
        <div class="item <?php if($numero == 1) { echo 'active'; } ?>">
          <img src="<?php echo $req->image; ?>" width="975" height="335" style="z-index:1" alt="" class="img-rounded"> 
          <div class="container">
            <div class="carousel-caption" style="z-index:2;margin-left: -4px;width: auto;">
              <h4 style="font-family: minecraftia;text-decoration: underline;"><?php echo $req->titre; ?> :</h4>
              <p style="font-family: minecraftia;"><?php echo $req->contenu; ?></p>
            </div>
          </div>
        </div>
      
      <?php } ?>
        
        
      </div>
      <a class="left carousel-control pull-left" href="#myCarousel" data-slide="prev" style="top: 150px;margin-left: -30px;">&lsaquo;</a>
      <a class="right carousel-control pull-right" href="#myCarousel" data-slide="next" style="top: 150px;margin-right: 95px;">&rsaquo;</a>
    </div>
           </div>
        <!-- ======== CONTENUE DE LA PAGE ========== -->
  </div>
  <div class="row-fluid">
    <div class="span8">
      <div class="news-plugin" style="width: 750px;">
      <h1 style="text-align: center;font-family: minecraftiaregular;">News</h1><br>

      <?php // LIENS PAGE
        $req_nbrNews2 = $connexion->query('SELECT * FROM news');
        $nbrNews2 = $req_nbrNews2->rowCount();
        $NewsParPage = 3;
        $TotalNews = $nbrNews2;
        $nombreDePages  = ceil($TotalNews / $NewsParPage);
        if (isset($_GET['page']))
        {
          $page = $_GET['page']; // On récupère le numéro de la page indiqué dans l'adresse (livreor.php?page=4)
        }
        else // La variable n'existe pas, c'est la première fois qu'on charge la page
        {
          $page = 1; // On se met sur la page 1 (par défaut)
        }
      ?>
      <?php // AFFICHER NEWS 
        $premiereNews_Afficher = ($page - 1) * $NewsParPage;
        $sql = $connexion->query('SELECT * FROM news ORDER BY id DESC LIMIT ' . $premiereNews_Afficher . ', ' . $NewsParPage . '');
        $sql->setFetchMode(PDO::FETCH_OBJ);
        while($req = $sql->fetch()) { 
        // NBR DE COMMENTAIRES
        $sql3 = $connexion->query('SELECT * FROM comment WHERE news=\'' . $req->id . '\'');
        $nbr_comment = $sql3->rowCount();
      ?>
      <?php 
      if($nbrNews2 < 1) {
        echo 'Aucune news n\'a été postée';
      }
      ?>
                <div class="thumbnail" style="width: 720px;background-color: white;auto;margin: 10px;">

                  <div class="caption">
                    <?php if($req->image == NULL) { } else { ?>
                  <img src="<?php echo $req->image; ?>" class="img-rounded" style="width: 250px;float: left;margin-right: 5px;" alt="">
                  <?php } ?>
                    <h3><?php echo stripslashes($req->titre); ?></h3>
                    <p><?php echo stripslashes($req->description); ?></p>
                    <p><a href="comment.php?news=<?php echo $req->id; ?>" class="btn btn-info pull-left"><?php echo $nbr_comment; ?> commentaire<?php if($nbr_comment > 1) { echo 's'; } ?></a></p>
                    <p><a href="news.php?id=<?php echo $req->id; ?>" class="btn btn-success pull-right">Lire la suite &raquo;</a></p><br><br>
                  </div>
                </div>
      <?php
} // Fin de la boucle qui liste les news.
?>
</div>
<?php

echo '<center><div class="btn-toolbar" style="margin-top: 15px;">
        <div class="btn-group">';
        for ($i = 1 ; $i <= $nombreDePages ; $i++) {
            echo '<a class="btn ';
            if($page == $i) { echo 'active'; }
            echo '" href="?page=' . $i . '">' . $i . '</a> ';
        }
        echo '</div></div></center>';
?>

          
    </div>
<?php include('include/menudroite.php'); ?>
</div>
</div>
</div>
</div>
</div>
</div>

<?php 
include('include/footer.php'); 
?>
Si quelle quin peut m'aider a trouver le problème se serait sympa
Merci :)
Theskinline01

ViPHP
xTG
ViPHP | 7331 Messages

16 nov. 2013, 19:20

C'est bizarre... Je dirai qu'il y a des caractères non imprimables. Dans le code on voit :
''
Mais l'erreur interprète :
' '
Regardes avec un éditeur de texte comme notepad++ (qui permet d'afficher les caractères non imprimables) si tu ne vois rien à ces endroits.

Eléphanteau du PHP | 18 Messages

16 nov. 2013, 19:28

C'est bizarre... Je dirai qu'il y a des caractères non imprimables. Dans le code on voit :
''
Mais l'erreur interprète :
' '
Regardes avec un éditeur de texte comme notepad++ (qui permet d'afficher les caractères non imprimables) si tu ne vois rien à ces endroits.
Bonjour
Merci pour ta raiponce :)

Ces sa que je ne comprend car quand je vais dans header.php avec notpad a la ligne 146 et 170
Il y a sa : Ligne 146:
<?php if(!connect()) { ?>

et a la 170 :
 <?php } ?>
Donc il y a pas de ' ' a ces ligne la

ViPHP
xTG
ViPHP | 7331 Messages

16 nov. 2013, 20:13

Pour la ligne 170 je n'ai pas d'explication...
Pour la ligne 146 vérifies que la fonction connect() existe et se trouve dans un fichier inclut dans cette page.

Eléphanteau du PHP | 18 Messages

16 nov. 2013, 20:44

Pour la 146 ces partie tout seul Oo comprend vraiment pas la
Et la 170 sa reste

Eléphanteau du PHP | 18 Messages

16 nov. 2013, 20:54

Personne a une solution ?