new line (again) - works on my computer but not my hosts server?!?!? (Posted by Justin Stayton)
i have a script that will print the ip address of the visitor, and then print a new line. it works fine on my computer using sambar server, but on linux it prints in between each ip. whats wrong?
the code:
## Your IP address
$yourip = "000.000.000.000";
## Visitors IP address
$visitorip = $ENV{'REMOTE_ADDR'};
## Path to the counter file
$countfile = "/home/fireburn/ftp/cgi-bin/count/count.dat";
## Path to the log file
$logfile = "/home/fireburn/ftp/cgi-bin/count/log.dat";
print "Content-type: text/html\n\n";
open(COUNT, "$countfile");
$count = <COUNT>;
$count++;
close (COUNT);
open(COUNT, ">$countfile");
print COUNT "$count";
close (COUNT);
open(LOG, "$logfile");
$log = <LOG>;
close (LOG);
open(LOG, ">>$logfile");
print LOG "$visitorip";
print LOG "\n";
close (LOG);
print "$count";
----------
[red]FireBurn Web Publishing[/red]: fireburn.com
Low cost web design, graphic design, and more!
Justin Stayton - [email] [icq]
Federico Carnales posted this at 17:24 — 11th November 1999.
They have: 69 posts
Joined: Apr 1999
It seems to me like the file is being created on the linux server, and you are downloading it through FTP to a windows system. In that case, download the file in ASCII mode instead of binary, and the file should have the correct new lines instead of these squares.
----------
Reviews of the best resources for webmasters in your e-mail every week!
Subscribe for [red]FREE[/red] by going to http://www.web-reviews.com/
Rob Pengelly posted this at 02:39 — 12th November 1999.
They have: 850 posts
Joined: Jul 1999
OK, this is a long shot, but try combining
print LOG "$visitorip";
print LOG "\n";
to make
print LOG "$visitorip\n";
----------
[red][Rob P][/red]
[[email protected]]--[[icq]16560402[/icq]]
http://www.thehungersite.com - http://www.therainforestsite.com
http://www.ratemymullet.com - Beauty is only mullet deep.
Justin S posted this at 04:22 — 12th November 1999.
They have: 2,076 posts
Joined: Jun 1999
Thats what I'm doing wrong, thanks Frederico! To robp: I tried that before but for some reason it didnt work...
----------
[red]FireBurn Web Publishing[/red]: fireburn.com
Low cost web design, graphic design, and more!
Justin Stayton - [email] [icq]
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.