Featured Worklog

Price Search



PC Apex Sponsor


PC Apex Sponsors



PC Apex RSS Feeds

RSS Feed for PC Apex Reviews & ArticlesRSS Feed for PC Apex PC Modding WorklogsRSS Feed for the PC Apex Daily DisturbanceRSS Feed for the latest PC Apex Site NewsRSS Feed for PC Apex Affiliate and Web NewsRSS Feed for PC Apex Deals and Steals

Go Back   Apex Community Forums // Other Forums // Designers Corner // Coding / Scripting / Programming

Coding / Scripting / Programming Discussions on all manner of coding and scripting.

Reply
 
LinkBack Thread Tools Display Modes
Old 20-June-06, 03:52 AM   #1 (permalink)
Apex Techie II
^RUmeY_-'s Avatar
Default PHP - Exporting data?

Hey guys,

Just wondering because i am re-desgining my businesses website and just wondering if you know how to export certint data from the output of a php file, So an example would be:

< ? php
print ("Your IP Address is: ");
echo getenv ('REMOTE_ADDR');
? >

The clients would translate into something like this:

Your IP Address is: ***.***.***.***

But then record somehow back on to the server?
i was thinking if you could record into a text file in a special format but i have tryed searching the internet and asking freinds but nobody has any ideas, mabee putting into mySQL but i currently dont know how to use php and mySQL.
Cheers
^RUmeY_- is offline     Reply With Quote
Sponsored Links
Old 24-June-06, 05:15 AM   #2 (permalink)
Apex Techie II
Ward's Avatar
Thumbs up Re: PHP - Exporting data?

I'm not exactly sure what you're trying to do here. If you just want to write to a file, php can do that easily. It looks like maybe you're wanting to log IP Addresses. MySQL would be the best way to go, instead of logging to a text file. However, here's a quick snippet that would log visitor IP addresses:

PHP Code:
<?
$ip 
$_SERVER["REMOTE_ADDR"];    // Grab user IP address
$timestamp date("F jS, Y g:i A");          // Grab date, fancy format
print "Your IP Address is ".$ip;                 // Output user IP address to browser

$fp fopen("log.txt","a");                            // Open 'log.txt' and place pointer at end of file (append)
$output $timestamp." - ".$ip."\r\n";       // Create string that will be written to file (add return+newline at end)
fwrite($fp$output);                                    // Write string to file
fclose($fp);                                                   // Close file
?>
Ward is offline     Reply With Quote
Old 24-June-06, 08:20 PM   #3 (permalink)
Apex Techie II
^RUmeY_-'s Avatar
Talking Re: PHP - Exporting data?

Hey Ward,

Thanks a ton man, works a treat on my servers, perfect for what i wanted thanks
^RUmeY_- is offline     Reply With Quote
Old 24-June-06, 08:33 PM   #4 (permalink)
Apex Techie II
Ward's Avatar
Default Re: PHP - Exporting data?

No problem, glad it worked for ya. I still recommend using MySQL to track visitors though, since this could cause problems with high traffic. The problem is when 2 people hit the site at the same time. 2 Instances of the script will run at the same time, and one will get a file sharing error when it tries to open the log file (because its already open with the other instance). For low traffic though, it should work okay.
Ward is offline     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 On
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ars Technica // AOL data leak may give data retention bill new life Gizmo Ars Technica RSS 0 13-August-06 04:00 PM
Exporting Opera Bookmarks to I.E jinx© Internet / Network Tweaks 0 17-May-04 10:30 PM
Exporting Trillian buddy lists? Jonny English Other PC Problem / Help 5 03-February-04 07:31 PM
exporting ut2k3 models to lightwave? Cibressus Anything Goes 0 18-August-03 07:39 PM


All times are GMT -5. The time now is 05:54 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC5
Copyright PCApex.com, GameApex.com, ForumApex.com 2001 - 2008
Advertisements

Page generated in 0.17388 seconds with 9 queries