Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 11-14-2008, 11:41 AM   #1
xxweekxx
Confirmed User
 
Join Date: Oct 2002
Posts: 6,780
Php script line break..

Ok i found this script that shows referrer logs for traffic you send to it..
<?php
$myFile = "./data.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
fwrite($fh,"nReferer: ");
fwrite($fh, ($_SERVER['HTTP_REFERER']) );
fwrite($fh,", ");
fwrite($fh, ($_SERVER['HTTP_USER_AGENT']) );
fwrite($fh,", ");
fwrite($fh, $_SERVER['REMOTE_ADDR']);
fwrite($fh,", ");
fwrite($fh, date('l jS of F Y h:i:s A') );
fclose($fh);
?>

Anyone of making it seperate each new one and put it in a diff line.. right now it just jumbles em up..
__________________
_________________
I am the best
xxweekxx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-14-2008, 11:43 AM   #2
nojob
The Original NoJob
 
nojob's Avatar
 
Join Date: Feb 2004
Location: Jerzzey
Posts: 3,682
If you want to pay I can have one of my progammers on bench create a solution for you. If so , hit me on icq.
nojob is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-14-2008, 11:43 AM   #3
drocd
Confirmed User
 
Join Date: Aug 2007
Posts: 128
PHP Code:
<?php
$myFile 
"./data.txt";
$fh fopen($myFile'a') or die("can't open file");
fwrite($fh,"nReferer: ");
fwrite($fh, ($_SERVER['HTTP_REFERER']) );
fwrite($fh,", ");
fwrite($fh, ($_SERVER['HTTP_USER_AGENT']) );
fwrite($fh,", ");
fwrite($fh$_SERVER['REMOTE_ADDR']);
fwrite($fh,", ");
fwrite($fhdate('l jS of F Y h:i:s A')."\n");
fclose($fh);
?>
__________________
230-699
drocd is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-14-2008, 11:49 AM   #4
xxweekxx
Confirmed User
 
Join Date: Oct 2002
Posts: 6,780
thanks drocd..
__________________
_________________
I am the best
xxweekxx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-14-2008, 11:54 AM   #5
xxweekxx
Confirmed User
 
Join Date: Oct 2002
Posts: 6,780
Will the script lag if a lot of hits r sent?

I mean i dont know how reliable it is to write to a text file every time someone hits the page.
__________________
_________________
I am the best
xxweekxx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-14-2008, 12:17 PM   #6
borked
Totally Borked
 
borked's Avatar
 
Industry Role:
Join Date: Feb 2005
Posts: 6,284
Yes, Disk I/O will be a drag whore if you're getting a lot of traffic to it.

If you dont want to be scouring/parsing apache logs, hit me up on ICQ - I've just the (free) things that is right up your street....
__________________

For coding work - hit me up on andy // borkedcoder // com
(consider figuring out the email as test #1)



All models are wrong, but some are useful. George E.P. Box. p202
borked is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-14-2008, 12:28 PM   #7
borked
Totally Borked
 
borked's Avatar
 
Industry Role:
Join Date: Feb 2005
Posts: 6,284
why aren't you storing this stuff in mysql? The problem with what you have now is that there are no file locks (flock), so you're going to be getting into a whole lotta mess with those kind of file writes with traffic.

Anyway, in answer to your original question, a line break is \n. *always* in within double quotes, never single eg

fwrite($fh, $_SERVER['REMOTE_ADDR'] . "\n");
__________________

For coding work - hit me up on andy // borkedcoder // com
(consider figuring out the email as test #1)



All models are wrong, but some are useful. George E.P. Box. p202
borked is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-14-2008, 02:18 PM   #8
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
that is some horrible code
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-14-2008, 04:14 PM   #9
Tempest
Too lazy to set a custom title
 
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
Quote:
Originally Posted by borked View Post
why aren't you storing this stuff in mysql? The problem with what you have now is that there are no file locks (flock), so you're going to be getting into a whole lotta mess with those kind of file writes with traffic.
You're kidding right???
Tempest is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.