Read/write to files in PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yasiraq
Forum Newbie
Posts: 1
Joined: Thu Jul 22, 2004 7:12 pm

Read/write to files in PHP

Post by yasiraq »

Hi,

I am a newbie. Just trying to figure out the power of PHP and that's why I am here.

I have managed to got my answers now I am interested in how to read textfiles in PHP and writing to them as well.

Thanks
Last edited by yasiraq on Fri Jul 23, 2004 7:14 am, edited 5 times in total.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

All of those are possible and if you do a quick google you will find them in a sec.

Better yet search these forums! They have all been discussed several times.
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Im sure I saw a request for this on RAC, mabey im wrong, anyway go with Phenom's idea...
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

look at your phpinfo, $_SERVER global is what you should draw your attention too.

for example, $_SERVER['REMOTE_ADDR']; is the ip.

I suggest if you have access to a MySQL db, make a table to store the information and you can easily compare and contrast information.

Good luck
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

1. Date & time of the request
2. Name of file requested
3. IP Address of the visitor
4. User Agent name of the visitor
5. And if possible, the site from which the visitor was referred.

Code: Select all

#date
date("F j, Y, g:i a");  

#file no idea at this moment.

#ip as Tim said

#broser used
$_SEVER['HTTP_USER_AGENT'] ;

#site referer
$_SERVER['REFER'];
Can all be found on php.net
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

* $_SERVER['HTTP_REFERER']
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

i actually used both feyd...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

:? what?

$_SERVER['REFER'] doesn't exist, I was correcting that..
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Yea i know you was i am trying to get some of my old files to recall that statement..

cant find it .. $_SERVER['HTTP_REFERER'] doesnt seem to work with my php5, weird. neither does the any of the other ones.
Post Reply