Free Web Hosting Forum
(#1 (permalink))
Old
Member
Brero-San is on a distinguished road
 
Posts: 37
Join Date: Feb 2012
Unhappy Can anyone see why this isnt working lol? - 04-24-2012, 04:28 AM

i wrote this script myself and cannot see why it isnt working D:
its supposed to log page views when put in an include.

the output is supposed to look like
Code:
May 17, 2012 12:50 am    test    150.101.28.41    /page.php?variable=example
It doesnt produce any errors but no output appears in log.txt
both this file and log.txt are chmod777
PHP Code:
<?
$logfile 
log.txt;
$today date("F j, Y, g: i a");
$name test;
$ip getenv("REMOTE_ADDR");
$page $_SERVER['REQUEST_URI'];

#logging time :D

$lgfp fopen($logfile,"a");

$logline $today "\t";
$logline .= $name "\t";
$logline .= $ip "\t";
$logline .= $page "\n";

fputs($lgfp,$logline);
fclose($lgfp);

?>


3 week review
Reply With Quote
Sponsored Links
(#2 (permalink))
Old
d3iti's Avatar
Super Moderator
d3iti is on a distinguished road
 
Posts: 6,620
Join Date: Jul 2009
Location: Spain
Default 04-24-2012, 07:16 AM

Hi,
Try using a different file type. txt files are not allowed in 000webhost for security.
It is also highly recommended that you use quotation marks to determine where to start and end a string:
PHP Code:
<? 
$logfile 
'log.txt';    // add quotation
$today date("F j, Y, g: i a"); 
$name 'test';      // add quotation
$ip getenv("REMOTE_ADDR"); 
$page $_SERVER['REQUEST_URI']; 
.....
?>


Recuerda realizar copias de seguridad de tus sitios web. Si este mensaje te ayudó puedes pulsar sobre el botón karma
Reply With Quote
(#3 (permalink))
Old
Member
Brero-San is on a distinguished road
 
Posts: 37
Join Date: Feb 2012
Default 04-25-2012, 11:30 PM

k thanks for that


3 week review
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com