PHP

Fermé
php-facile - 5 janv. 2010 à 16:50
 php-facile - 6 janv. 2010 à 12:04
Bonjour,
Comment avoir des informations sur la personne qui est sur mon site dans un fichier texte.

21 réponses

totofrancois Messages postés 398 Date d'inscription jeudi 19 novembre 2009 Statut Membre Dernière intervention 2 août 2013 44
5 janv. 2010 à 17:00
Bonjour,

utilise les variable d'environnement PHP
http://www.plb.fr/ccm/php/phpenv.php

et sauvegarde les dans un fichier
0
Comment ?
0
totofrancois Messages postés 398 Date d'inscription jeudi 19 novembre 2009 Statut Membre Dernière intervention 2 août 2013 44
5 janv. 2010 à 17:05
<?php

$info = $HTTP_USER_AGENT.' - '.$REMOTE_ADDR ;

$fp = fopen("fichier.txt","w");

fputs($fp,$info);

fclose($fp);

?>

tu pourrais chercher un peu !
0
Marcha Pas.

Notice: Undefined variable: HTTP_USER_AGENT in *\index.php on line 3

Notice: Undefined variable: REMOTE_ADDR in *\index.php on line 3
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
totofrancois Messages postés 398 Date d'inscription jeudi 19 novembre 2009 Statut Membre Dernière intervention 2 août 2013 44
5 janv. 2010 à 17:10
fallait pas faire copier coller aussi !

1ere ligne de google :

Résultats 1 à 10 sur un total d'environ 811 000 pour http_user_agent php (0,31 secondes)
Résultats de recherche

PHP Facile! Le langage PHP - Les variables prédéfinies
<?php echo "Vous utilisez un systeme d'exploitation de type: "; if (ereg("Linux", $_SERVER["HTTP_USER_AGENT"])) { echo "linux (un excellent choix)"; ...
www.phpfacile.com/...php/variables_predefinies_1.php5 - En cache - Pages similaires -

il faut rajouter les $_SERVER[".."];
0
Je comprend rien.
Exemple :
0
totofrancois Messages postés 398 Date d'inscription jeudi 19 novembre 2009 Statut Membre Dernière intervention 2 août 2013 44
5 janv. 2010 à 17:16
moi c fonctionne ! :
<?php

$info = $_SERVER["HTTP_USER_AGENT"].' - '.$_SERVER["REMOTE_ADDR"] ;

echo $info;

$fp = fopen("fichier.txt","w");

fputs($fp,$info);

fclose($fp);

?>

si ca marche pas vérifie la version de php
0
Marche bien.
Mais ca supprime la ligne d'avant.
0
Comment faire.
0
totofrancois Messages postés 398 Date d'inscription jeudi 19 novembre 2009 Statut Membre Dernière intervention 2 août 2013 44
5 janv. 2010 à 17:24
la réponse est la et je te la donnerais pas ! Il faut chercher un minimum !

https://www.php.net/manual/fr/function.fopen.php
0
Merci.
Comment retourner à la ligne.
0
totofrancois Messages postés 398 Date d'inscription jeudi 19 novembre 2009 Statut Membre Dernière intervention 2 août 2013 44
5 janv. 2010 à 17:32
$info .= "\n"
0
Je le place où ?
0
totofrancois Messages postés 398 Date d'inscription jeudi 19 novembre 2009 Statut Membre Dernière intervention 2 août 2013 44
5 janv. 2010 à 17:35
tu n'a aucune notion de programmation ?

$info = $_SERVER["HTTP_USER_AGENT"].' - '.$_SERVER["REMOTE_ADDR"] ;

$info .= "\n";

$fp = fopen("fichier.txt","a");

fputs($fp,$info);
0
Marche pas !
0
totofrancois Messages postés 398 Date d'inscription jeudi 19 novembre 2009 Statut Membre Dernière intervention 2 août 2013 44
5 janv. 2010 à 17:42
si tu ouvre ton fichier avec autre chose que le bloc note de windows cela fonctionne !!! vérifié
0
Marche pas avec firefox.
0
totofrancois Messages postés 398 Date d'inscription jeudi 19 novembre 2009 Statut Membre Dernière intervention 2 août 2013 44
5 janv. 2010 à 17:45
fait voir le résultat
0
partie 2 : http://www.commentcamarche.net/forum/affich-16013043-php-partie2
0
http://www.monsterup.com/image.php?url=upload/1262775756774.png
0