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 31/07/2007, 21h32   #1
Futur Membre du Club
 
Inscription : janvier 2005
Messages : 64
Détails du profil
Informations personnelles :
Localisation : France, Rhône (Rhône Alpes)

Informations forums :
Inscription : janvier 2005
Messages : 64
Points : 16
Points : 16
Par défaut Affichage contenu d'un fichier / mise en forme

Bonjour,

Voila mon pb : avec le code suivant :

Code :
1
2
3
system("sudo /usr/sbin/smartctl -A /dev/hda > /tmp/smart_hda.txt"); 
$donnees = file_get_contents('/tmp/smart_hda.txt'); 
echo $donnees;
j'affiche un fichier texte et l'affichage sous mon navigateur n'est pas du tout le meme que dans mon fichier :
Fichier :
Code x :
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
smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 32
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  3 Spin_Up_Time            0x0027   175   175   063    Pre-fail  Always       -       23354
  4 Start_Stop_Count        0x0032   253   253   000    Old_age   Always       -       476
  5 Reallocated_Sector_Ct   0x0033   253   253   063    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000a   253   252   000    Old_age   Always       -       0
  8 Seek_Time_Performance   0x0027   250   238   187    Pre-fail  Always       -       56823
  9 Power_On_Hours          0x0032   251   251   000    Old_age   Always       -       850
 10 Spin_Retry_Count        0x002b   253   252   157    Pre-fail  Always       -       0
 11 Calibration_Retry_Count 0x002b   253   252   223    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   252   252   000    Old_age   Always       -       527
189 Unknown_Attribute       0x003a   100   100   000    Old_age   Always       -       0
190 Unknown_Attribute       0x0022   063   058   000    Old_age   Always       -       622460965
192 Power-Off_Retract_Count 0x0032   253   253   000    Old_age   Always       -       0
193 Load_Cycle_Count        0x0032   253   253   000    Old_age   Always       -       0
194 Temperature_Celsius     0x0032   031   253   000    Old_age   Always       -       37
195 Hardware_ECC_Recovered  0x000a   253   252   000    Old_age   Always       -       2478
196 Reallocated_Event_Count 0x0008   253   253   000    Old_age   Offline      -       0
197 Current_Pending_Sector  0x0008   253   253   000    Old_age   Offline      -       0
198 Offline_Uncorrectable   0x0008   253   253   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0008   191   138   000    Old_age   Offline      -       64
200 Multi_Zone_Error_Rate   0x000a   253   252   000    Old_age   Always       -       0
201 Soft_Read_Error_Rate    0x000a   253   252   000    Old_age   Always       -       0
202 TA_Increase_Count       0x000a   253   252   000    Old_age   Always       -       0
203 Run_Out_Cancel          0x000b   253   252   180    Pre-fail  Always       -       0
204 Shock_Count_Write_Opern 0x000a   253   252   000    Old_age   Always       -       0
205 Shock_Rate_Write_Opern  0x000a   253   252   000    Old_age   Always       -       0
207 Spin_High_Current       0x002a   253   252   000    Old_age   Always       -       0
208 Spin_Buzz               0x002a   253   252   000    Old_age   Always       -       0
210 Unknown_Attribute       0x0032   253   252   000    Old_age   Always       -       0
211 Unknown_Attribute       0x0032   253   252   000    Old_age   Always       -       0
212 Unknown_Attribute       0x0032   253   252   000    Old_age   Always       -       0


Navigateur :

Code x :
1
2
smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen Home page is http://smartmontools.sourceforge.net/ === START OF READ SMART DATA SECTION === SMART Attributes Data Structure revision number: 32 Vendor Specific SMART Attributes with Thresholds: ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 3 Spin_Up_Time 0x0027 175 175 063 Pre-fail Always - 23354 4 Start_Stop_Count 0x0032 253 253 000 Old_age Always - 476 5 Reallocated_Sector_Ct 0x0033 253 253 063 Pre-fail Always - 0 7 Seek_Error_Rate 0x000a 253 252 000 Old_age Always - 0 8 Seek_Time_Performance 0x0027 250 238 187 Pre-fail Always - 56823 9 Power_On_Hours 0x0032 251 251 000 Old_age Always - 850 10 Spin_Retry_Count 0x002b 253 252 157 Pre-fail Always - 0 11 Calibration_Retry_Count 0x002b 253 252 223 Pre-fail Always - 0 12 Power_Cycle_Count 0x0032 252 252 000 Old_age Always - 527 189 Unknown_Attribute 0x003a 100 100 000 Old_age Always - 0 190 Unknown_Attribute 0x0022 063 058 000 Old_age Always - 622460965 192 Power-Off_Retract_Count 0x0032 253 253 000 Old_age Always - 0 193 Load_Cycle_Count 0x0032 253 253 000 Old_age Always - 0 194 Temperature_Celsius 0x0032 031 253 000 Old_age Always - 37 195 Hardware_ECC_Recovered 0x000a 253 252 000 Old_age Always - 2478 196 Reallocated_Event_Count 0x0008 253 253 000 Old_age Offline - 0 197 Current_Pending_Sector 0x0008 253 253 000 Old_age Offline - 0 198 Offline_Uncorrectable 0x0008 253 253 000 Old_age Offline - 0 199 UDMA_CRC_Error_Count 0x0008 191 138 000 Old_age Offline - 64 200 Multi_Zone_Error_Rate 0x000a 253 252 000 Old_age Always - 0 201 Soft_Read_Error_Rate 0x000a 253 252 000 Old_age Always - 0 202 TA_Increase_Count 0x000a 253 252 000 Old_age Always - 0 203 Run_Out_Cancel 0x000b 253 252 180 Pre-fail Always - 0 204 Shock_Count_Write_Opern 0x000a 253 252 000 Old_age Always - 0 205 Shock_Rate_Write_Opern 0x000a 253 252 000 Old_age Always - 0 207 Spin_High_Current 0x002a 253 252 000 Old_age Always - 0 208 Spin_Buzz 0x002a 253 252 000 Old_age Always - 0 210 Unknown_Attribute 0x0032 253 252 000 Old_age Always - 0 211 Unknown_Attribute 0x0032 253 252 000 Old_age Always - 0 212 Unknown_Attribute 0x0032 253 252 000 Old_age Always - 0


Si quelqu'un peut m'aider d'avance merci, je comprend plus rien...
Franckinux est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 31/07/2007, 21h56   #2
Modérateur
 
Avatar de mathieu
 
Inscription : juin 2003
Messages : 4 893
Détails du profil
Informations forums :
Inscription : juin 2003
Messages : 4 893
Points : 4 466
Points : 4 466
déjà tu as besoin de la fonction "nl2br" pour convertir les saut de lignes du fichier en saut de ligne html
ensuite tu as besoin des balises "pre" pour afficher le texte avec des caractères à largeur fixe
et pour finir il y a la fonction "htmlspecialchars" pour afficher correctement les caractères "&" "<" et ">"

donc essaye ça :
Code :
1
2
3
4
$donnees = file_get_contents('/tmp/smart_hda.txt'); 
echo '<pre>';
echo nl2br(htmlspecialchars($donnees));
echo '</pre>';
__________________
Modérateur PHP
mathieu est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 31/07/2007, 23h06   #3
Futur Membre du Club
 
Inscription : janvier 2005
Messages : 64
Détails du profil
Informations personnelles :
Localisation : France, Rhône (Rhône Alpes)

Informations forums :
Inscription : janvier 2005
Messages : 64
Points : 16
Points : 16
ahh ça marche !!

merciiiii
Franckinux 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 08h28.


 
 
 
 
Partenaires

Hébergement Web