Précédent   Forum des professionnels en informatique > PHP > Langage > Fichiers
Fichiers Forum d'entraide sur les fichiers avec PHP. Avant de poster -> FAQ fichiers et Sources fichiers
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 10/10/2007, 18h29   #1
Invité de passage
 
Inscription : octobre 2003
Messages : 4
Détails du profil
Informations forums :
Inscription : octobre 2003
Messages : 4
Points : 1
Points : 1
Par défaut Mes include() ne marchent pas

Bonjour à tous,
je ne réussis pas à inclure mes fichier au niveau du serveur qui héberge mon site php/mysql. En local(sur mon poste et même en réseau local) tout marche; mais une fois hébergé, rien ne vas plus. Mon code php ne fonctionne plus. Le principe est que le fichier index.php appelle les autres(path.php ; header.php ; footer.php ; menu_gauche.php ; menu_droite.php,connection.php). voici les codes.

connection.php :
Code :
1
2
3
4
<?php
$con_serveur = mysql_connect("localhost", "root", "");
$db = mysql_select_db("testa",$con_serveur);
?>
path.php :
Code :
<?php $path="testa/"; ?>
header.php :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<link href="../css/style.css" rel="stylesheet" type="text/css">
</head>
 
<body>
<table cellspacing=0 cellpadding=2 width="89%" align=center>
  <tbody>
    <tr>
      <td align=middle><hr align="center" size="1" class="small">
          <div align="center" >          
              <span class="small">Tous droits r&eacute;serv&eacute;s &copy; Copyright 2007 CIM. <a href="membre_enter.php">Espace priv&eacute;</a> | <a href="admin_enter.php">Administration</a> <br>
            <span class="small">Designed and Powered by </span></span><span class="smallbold">CGICOM</span><span class="small"><span class="small">. </span>
            <SPAN id=footer>Avertissement,&nbsp;Donn&eacute;es personnelles<SPAN 
            class=footer>&nbsp;et&nbsp;</SPAN>Conditions D'utilisation </SPAN>
            <SCRIPT language=Javascript>
var footerLinks = document.getElementById('footer').getElementsByTagName('a');
for (var i=0;i<footerLinks.length;i++) {
	footerLinks[i].target = '_self';
}
                    </SCRIPT>
            </span></span></font> </p>
      </div></td>
    </tr>
    <tr>
      <td valign=center nowrap align=middle><div align="center"><span class="style6"></span> </div></td>
    </tr>
  </tbody>
</table>
menu_gauche.php :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<link href="../css/style.css" rel="stylesheet" type="text/css">
<link href="../css/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Style7 {color: #A5C8DD}
-->
</style>
<TABLE class=TBL_PERMANENT_NAVIGATION_BACKGROUND 
                  id=TBL_PERMANENT_NAVIGATION_BACKGROUND height="100%" 
                  cellSpacing=0 cellPadding=0 width="100%" bgColor=#A5C8DD 
                  border=0>
  <TBODY>
    <TR valign="top">
      <TD 
                      height=26 colspan="2" class=border_black id=FirstCell><div align="center">
        <p>Infos line <br>
            ou le
            <br>
        </p>
      </div></TD>
    </TR>
    <TR bgcolor="#015585" valign="top">
      <TD 
                      height=19 class=smallbold id=FirstCell>&nbsp;</TD>
      <TD bgcolor="#015585" class=smallbold id=FirstCell><span class="dataWhite">ORGANISATION</span></TD>
    </TR>
    <TR valign="top">
      <TD 
                      height=18 colspan="2" class=smallbold id=FirstCell><table width="98%" border="0" align="center" cellpadding="3" cellspacing="0">
        <tr>
          <td width="1%" class="data"><img src="../images/flecher.gif" width="4" height="6"></td>
          <td width="99%" class="data"><div align="left"><a href="presentation.php">Pr&eacute;sentation</a></div></td>
        </tr>
        </table></TD>
    </TR>
    <TR valign="top">
      <TD 
                      height=20 colspan="2" class=smallbold id=FirstCell>&nbsp;</TD>
    </TR>
    <TR bgcolor="#015585" valign="top">
      <TD 
                      height=20 class=smallbold id=FirstCell>&nbsp;</TD>
      <TD bgcolor="#015585" class=smallbold id=FirstCell><span class="dataWhite">ACTUALITE</span></TD>
    </TR>
    <TR valign="top">
      <TD 
                      height=20 colspan="2" class=PermTD id=FirstCell><table width="98%" border="0" align="center" cellpadding="3" cellspacing="0">
        <tr>
          <td class="data"><img src="../images/flecher.gif" width="4" height="6"></td>
          <td class="data"><div align="left"><a href="revue_presse.php">La revue de presse</a></div></td>
        </tr>        
      </table></TD>
    </TR>
 
    <td height="19">
  </TBODY>
</TABLE>
menu_droite.php :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<link href="../css/style.css" rel="stylesheet" type="text/css">
<link href="../css/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <?php
	$sqlrubrique =" select * from rubrique where idrubrique > 0 AND statut=1 ";
	//$sqltheme = $sqltheme." order by titretheme ";
	//echo $sql;exit;
	$rstrubrique=mysql_query($sqlrubrique);
	$nb_lignes = mysql_num_rows($rstrubrique);
	if ($nb_lignes>0)
		{
		$i=0;
		While($rowrubrique=mysql_fetch_object($rstrubrique))
			{	
			$i++;
?>
  <tr>
    <td width="100%" colspan="4"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
        <tr>
          <td width="100%" bgcolor="#A5C8DD"><div align="left"><a href="<?php if ($rowrubrique->idrubrique==2)echo "infos_pratiques.php"; if ($rowrubrique->idrubrique==4)echo "documentation.php";?>"><img src="../images/rubriques/<?php echo $rowrubrique->image; ?>"  alt="" border="0"></a> </div></td>
        </tr>
        <tr>
          <td  bgcolor="#015585"><span class="smallTitlewitebold"><?php echo $rowrubrique->titre ?></span></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="4"><table width="100%" border="1" cellpadding="1" cellspacing="0" bordercolor="#015585">
        <?php
	$sql =" select * from article where idarticle > 0 AND statut =1";
	//if($_REQUEST['txt_recherche']){$sql = $sql." And nomprenomabonne like '%".$_REQUEST['txt_recherche']."%'";}
	$sql = $sql." And idrubrique=".$rowrubrique->idrubrique;
	$sql = $sql." order by priorite ";
	$sql = $sql." LIMIT 0,2 ;";
	//echo $sql;exit;
	$rst1=mysql_query($sql);
	$nb_lignes = mysql_num_rows($rst1);
	if ($nb_lignes>0)
		{
		$j=0;
		While($row=mysql_fetch_object($rst1))
			{	
			$j++;
?>
        <tr>
          <td valign="top"><div align="center">
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td><span class="smallbold"><?php echo $row->titre;?></span><br>
                      <span class="small"> <?php echo $row->resume;?><br>
                    </span></td>
                </tr>
                <tr>
                  <td><div align="right"><span class="data"><a href="article_details.php?op=0<?php echo '&id='. $row->idarticle;?>" >Lire &gt;&gt;</a></span></div></td>
                </tr>
              </table>
          </div></td>
          <?php }
					 ?>
        </tr>
        <?php
	}
?>
    </table></td>
    <?php }?>
  </tr>
  <?php
		}
?>
</table><br>
<p align="center">&nbsp;</p>
index.php :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php 
include 'connection.php';
include 'sessioncontrol_membre.php';
?>
<html>
<head>
<title>test[index]</title>
<link href="../css/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
	background-color: #015585;
}
 
-->
</style></head>
 
<body >
<table width="775"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="12"><img src="../images/bord_haut_gauche.gif" width="12" height="12"></td>
    <td width="756" background="../images/ligne_haut.gif"><img src="../images/tab/tab_ul.gif" width="2" height="7"></td>
    <td width="12"><img src="../images/bord_haut_droit.gif" width="12" height="12"></td>
  </tr>
  <tr>
    <td background="../images/ligne_gauche.gif">&nbsp;</td>
      <td valign="top" bgcolor="#A5C8DD"><table width="100%" height="100" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><?php  include "header.php"; ?></td>
            </tr>
            <tr>
              <td><div align="center">
                <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
                  <tr>
                    <td width="25%" valign="top" bgcolor="#A5C8DD"><?php  include "menu_gauche.php";?></td>
                    <td width="50%" valign="top" bgcolor="#F2F2F2"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td height="25" class="smallTitlewitebold">&nbsp;</td>
                      </tr>
                      <tr>
                        <td height="25" bgcolor="#015585" class="bkg_rouge"><div align="center">
                          INFORMATIONS GENERALES </div></td>
                      </tr>
                      <tr>
                        <td valign="top"><hr align="JUSTIFY" size="1" class="smallboldjaune">
                          </td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                      </tr>
                    </table></td>
                    <td width="25%" valign="top" bgcolor="#A5C8DD"><?php  include "menu_droite.php";?></td>
                  </tr>
                </table>
              </div></td>
            </tr>
          </table>
          </td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td><?php  include "footer.php";?></td>
        </tr>
      </table></td>
 
    <td background="../images/ligne_droite.gif">&nbsp;</td>
  </tr>
  <tr>
    <td><img src="../images/bord_bas_gauche.gif" width="12" height="12"></td>
    <td background="../images/ligne_droite.gif"><img src="../images/tab/tab_dl.gif" width="2" height="7"></td>
    <td><img src="../images/bord_bas_droit.gif" width="12" height="12"></td>
  </tr>
</table>
</body>
</html>
Elisée A. est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/10/2007, 19h15   #2
Membre émérite
 
Avatar de ozzmax
 
Inscription : novembre 2005
Messages : 986
Détails du profil
Informations personnelles :
Âge : 29

Informations forums :
Inscription : novembre 2005
Messages : 986
Points : 863
Points : 863
Envoyer un message via MSN à ozzmax
salut moi je mets tjrs mes includes comme premiere instruction
mais j'utilise avec des parentheses comme suit

Code :
1
2
3
4
5
6
 
<?
include("../Classes/cDBConnect.php");
session_start();
....
?>
Pour le chemin d'accès il va aller voir directement dans le dossier de ta page donc les pages que t'include devraient être là, si ce n'est pas le cas ca ne marchera pas
__________________
La perfection n'est pas un but, l'amélioration constante devrait l'être!
La position des Développeurs de developpez avec les explications
ozzmax est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 11/10/2007, 16h18   #3
Membre du Club
 
Inscription : juillet 2003
Messages : 69
Détails du profil
Informations forums :
Inscription : juillet 2003
Messages : 69
Points : 68
Points : 68
pour ne pas me soucier des includepath, je fait généralement mes include comme ça :


Code :
1
2
<?php
include dirname(__FILE__).'/dossier/fichier.php';
sans oublier d'utiliser include_once/require/require_once en cas de besoin
de plus, je le ferme jamais les balise php (?>) à la fin de mes fichiers inclus (on est jamais à l'abris d'un caractère invisible caché), pour éviter les problèmes avec l'envoi de header.
parksto est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/10/2007, 10h26   #4
Membre confirmé
 
Inscription : février 2003
Messages : 285
Détails du profil
Informations forums :
Inscription : février 2003
Messages : 285
Points : 255
Points : 255
Envoyer un message via ICQ à Sion_Sempai Envoyer un message via MSN à Sion_Sempai Envoyer un message via Yahoo à Sion_Sempai
le plus simple, si tu connais le dossier de tes includes, c'est de partir du root

Code :
include($_SERVER['DOCUMENT_ROOT'].'/chemin/fichier.php');
Sion_Sempai est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/10/2007, 16h34   #5
Invité de passage
 
Inscription : octobre 2003
Messages : 4
Détails du profil
Informations forums :
Inscription : octobre 2003
Messages : 4
Points : 1
Points : 1
Par défaut Fin du pb des include()

Bounjour, le code que je vous est exposé était parfait, c'est en fait le serveur de mon hébergeur qui faisait problème. Donc ne vous inquiétez plus tout vas bien. Merci aussi pour ceux qui ont contribués!
A+++++++++++++ sur Develeppoez.net
Elisée A. est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 06h34.


 
 
 
 
Partenaires

Hébergement Web