GetDotted Domains

Viewing Thread:
"PHP Help"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Fri 16/05/03 at 16:03
Regular
Posts: 787
I'm fiddling about with my site at the moment and I want to be able to get a few little things working using PHP.

All I want is a basic script that allows information that is submitted through a text box to appear on the site.

When I say basic I mean basic as in monkey_man's old chat scripts he used to have on his site.

Anybody know of any basic tutorials that could explain how to do this?

I've got a feint idea of what to do, just not how to do it!

Thanks.
Sun 18/05/03 at 21:21
Regular
"It goes so quickly"
Posts: 4,083
Could be this.

$File = "rightframe.txt";
if (file_exists($File)) {
$fp = fopen($File, "r");
flock($fp, 1); # Lock the File.

while (! feof($fp)) {
$Line = fgets($fp, 1024);
print "$Line
\n";
}

flock($fp, 3); # Release the File Lock.
fclose($fp);
} else {
print "

Can't include the text, file doesn't exist or
can't be opened.

\n";
}
?>
Sun 18/05/03 at 20:47
Regular
"Chavez, just hush.."
Posts: 11,080
I can't find anywhere on the web that explains it either...

I'll find something.

P.S

You know too much!

:c)
Sun 18/05/03 at 20:19
Regular
"It goes so quickly"
Posts: 4,083
Just doing it from memory ... :)
Sun 18/05/03 at 19:48
Regular
"Chavez, just hush.."
Posts: 11,080
Nope, that shows nothing up.

Are you writing these codes yourself or do you have a little archive?
Sun 18/05/03 at 19:41
Regular
"It goes so quickly"
Posts: 4,083
Try:

$File = "rightframe.txt";
if (file_exists($File)) {
$fp = fopen($File, "r");
flock($fp, 1); # Lock the File.
$Content = file($fp);
flock($fp, 3); # Release the File Lock.
fclose($fp);

foreach ($Content as $Temp) {
$Temp = stripslashes($Temp);
print $Temp."
\n";
}
} else {
print "

Can't include the text, file doesn't exist or
can't be opened.

\n";
}
?>
Sun 18/05/03 at 19:31
Regular
"Chavez, just hush.."
Posts: 11,080
$File = "rightframe.txt";
if (file_exists($File)) {
$fp = fopen($File, "r");
flock($fp, 1); # Lock the File.
$Content = fread($fp, filesize($File));
$Content = stripslashes($Content);
flock($fp, 3); # Release the File Lock.
fclose($fp);
str_replace("\n", "
", $Content);
print "$Content\n";
} else {
print "

Can't include the text, file doesn't exist or can't be opened.

\n";
}
?>

Like that?

If so it still displays the text in one line...

http://members.lycos.co.uk/phi11ip/mainpage.php is the page I'm working with, you can see the text in a line in the middle of the page.

http://members.lycos.co.uk/phi11ip/mainframe.txt is the file it comes from.
Sun 18/05/03 at 19:18
Regular
"It goes so quickly"
Posts: 4,083
Before the print command, use this:

For HTML:
str_replace("\n", "
", $Content);

For xHTML:
str_replace("\n", "
", $Content);
Sun 18/05/03 at 18:51
Regular
"Chavez, just hush.."
Posts: 11,080
Oh, and this is the code I'm using to show the txt on the main page.

$File = "main.txt";
if (file_exists($File)) {
$fp = fopen($File, "r");
flock($fp, 1); # Lock the File.
$Content = fread($fp, filesize($File));
$Content = stripslashes($Content);
flock($fp, 3); # Release the File Lock.
fclose($fp);

print "$Content\n";
} else {
print "

Can't include the text, file doesn't exist or can't be opened.

\n";
}
?>
Sun 18/05/03 at 18:50
Regular
"Chavez, just hush.."
Posts: 11,080
Nearly there!

How do I get it to display the text on seperate lines when I include it on the page?

At the moment it just comes as a big long line of text even though it's stored as seperate lines in the txt file.

Thanks, again in advance!
Sun 18/05/03 at 16:59
Regular
"Chavez, just hush.."
Posts: 11,080
That made no sense...

It does work.

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

First Class!
I feel that your service on this occasion was absolutely first class - a model of excellence. After this, I hope to stay with Freeola for a long time!
Excellent
Excellent communication, polite and courteous staff - I was dealt with professionally. 10/10

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.