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 15:25
Regular
"Chavez, just hush.."
Posts: 11,080
So I was doing it correctly after all that. I tried doing that but it didn't work.

Stupid / or \, whatever one that was anoying me.

Thanks again.
Sun 18/05/03 at 11:46
Regular
"It goes so quickly"
Posts: 4,083
7th line of that code:

Replace ...
fputs($fp, $Data);
... with ...
fputs($fp, "$Data\n");
... or ...
fputs($fp, "\n$Data");
Sun 18/05/03 at 03:47
Regular
"Eff, you see, kay?"
Posts: 14,156
\n is newline.
Sun 18/05/03 at 00:04
Regular
"Chavez, just hush.."
Posts: 11,080
OK, when the stuff gets written to the file, how do I make it write to a new line instead of just adding to an ever increasing sentence?

I've been looking around for ages as I wanted to find this out myself but all I could find was that /n is a new line and something to do with setting $string = "/n";

How would I go by changing this code to make it write to a new line?

if ($Data) {
$File = "quotes.txt";
if (file_exists($File)) {
$fp = fopen($File, "w");
flock($fp, 2); # Lock the File.
fputs($fp, $Data);
flock($fp, 3); # Release the File Lock.
fclose($fp);
print "

All done!

\n";
} else{
print "

can't find file.

\n";
}
} else {
print "

Nothing Entered

\n";
}
?>
Fri 16/05/03 at 19:58
Regular
"Chavez, just hush.."
Posts: 11,080
I'm literally just experimenting with different things at the moment so I don't need to worry about the validation yet.

I just want to test the basics and get the site with a nice layout before I do anythig to it.

http://members.lycos.co.uk/phi11ip/mainpage.php

That's VERY basic but I've got only a little bit of code on that page with two bits...

I just want to see how things work and get a nice picture going.

Anyway, thatnks for your help. I'll ask again if I need help.
Fri 16/05/03 at 19:34
Regular
"It goes so quickly"
Posts: 4,083
Ah, if you wanna include Image HTML and have it actuall show up, use this as well, after the $Data = stripslashes($Data) call:

$Data = str_replace("<img ", " $Data = str_replace(">", ">", $Data);

This should change the tag back to regular HTML
Fri 16/05/03 at 19:28
Regular
"hockeyphotos.com"
Posts: 84
Do put some data validation in there to stop people posting nasty code to your site!

Chris.
Fri 16/05/03 at 19:26
Regular
"Chavez, just hush.."
Posts: 11,080
Thanks for all this help!

That now allows me to add pictures to the HTML code that I input without them being completely buggered up!

Got a nice little layout designed. I've just got to fill up the spaces now...
Fri 16/05/03 at 18:58
Regular
"It goes so quickly"
Posts: 4,083
$Data = stripslashes($Data);

However, you'll be unable to use the basic to place the text within a page, you'll need to use:

$File = "whatever.inc";
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";
}
?>
Fri 16/05/03 at 18:47
Regular
"Chavez, just hush.."
Posts: 11,080
Now, how do I get rid of those \' bits every time I try to put a ' there?

I rememeber someone mentioning it here, just can't remember what it was...

I just want to get a page working so that I can easily update the main text on my site by going to a text box. I'll probably make a guestbook soon when I can be bothered.

So far though it's gonna look pretty good. I've got a nice little design going.

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

10/10
Over the years I've become very jaded after many bad experiences with customer services, you have bucked the trend. Polite and efficient from the Freeola team, well done to all involved.
Many thanks!!
Registered my website with Freeola Sites on Tuesday. Now have full and comprehensive Google coverage for my site. Great stuff!!
John Shepherd

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.