php file reader?
#1

Is it possible to make a php page that reads a file (tlog.ini) and writes the data there on to the page. If so, how? I need it to do this every time the file changes. I want this for a way to see the chat in my server on the site. PLEASE HELP!!!
Reply
#2

Why not just use MySQL??
Reply
#3

it's possible check this
Reply
#4

PHP код:
<?php
$file 
"/folder/tlog.ini"//sets the files location
$f fopen($file"r"); //opens the file for reading only
while ( $line fgets($f1000) ) { //loops through the files contents
print $line//prints the contents to the browser
}
?>
Let me know if this is what you wanted. If not, I can help you out with what your going for. I think I know what your trying it accomplish.

Also @ Steven : He asked for PHP coding not MySQL! Obviously he has his script setup to store all chat into a file (not MySQL) and would like to use that file to display its contents into a web page for live viewing for people that arent in game.

Nice idea, makes your website interactive with your server!
Reply
#5

Quote:
Originally Posted by SuperS82
Посмотреть сообщение
<?php

$file = "/folder/tlog.ini"; //sets the files location
$f = fopen($file, "r"); //opens the file for reading only
while ( $line = fgets($f, 1000) ) { //specifies the line to read
print $line; //prints the lines contents to the browser
}

?>
Off Topic:

There is
PHP код:
 hi 
brackets
Reply
#6

Quote:
Originally Posted by SuperS82
Посмотреть сообщение
PHP код:
<?php
$file 
"/folder/tlog.ini"//sets the files location
$f fopen($file"r"); //opens the file for reading only
while ( $line fgets($f1000) ) { //loops through the files contents
print $line//prints the contents to the browser
}
?>
Let me know if this is what you wanted. If not, I can help you out with what your going for. I think I know what your trying it accomplish.

Also @ Steven : He asked for PHP coding not MySQL! Obviously he has his script setup to store all chat into a file (not MySQL) and would like to use that file to display its contents into a web page for live viewing for people that arent in game.

Nice idea, makes your website interactive with your server!
Ok, i got it to sort of work, but it doesnt automatically update. how do i fix this? also, can i have it on a remote pc or does it have to be on the same coputer?
Reply
#7

Quote:
Originally Posted by sciman001
Посмотреть сообщение
Ok, i got it to sort of work, but it doesnt automatically update. how do i fix this? also, can i have it on a remote pc or does it have to be on the same coputer?
In that case, it has to be on a webserver. Or you can install http://www.wampserver.com/en/
Reply
#8

Quote:
Originally Posted by Mike Garber
Посмотреть сообщение
In that case, it has to be on a webserver. Or you can install http://www.wampserver.com/en/
Ok.. it works but u hav 2 predd f5 to get it to load... how i fix that?
Reply
#9

anyone??
Reply
#10

PLEASE SOMEONE!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)