Reading and printing in Php

Programming, for all ages and all languages.
Kon-Tiki

Re:Reading and printing in Php

Post by Kon-Tiki »

No way of doing that in php? :-\
Oh, and found another slight flaw. It takes refreshing the page as an input too, leaving the guestbook with empty entries from time to time.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Reading and printing in Php

Post by Candy »

Kon-Tiki wrote: Oh, and found another slight flaw. It takes refreshing the page as an input too, leaving the guestbook with empty entries from time to time.
Yup, you use IE.

Stop using IE.

The flaw you found has been fixed by M$ and posted to windowsupdate.
Kon-Tiki

Re:Reading and printing in Php

Post by Kon-Tiki »

I've only accessed my guestbook through Opera :P
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Reading and printing in Php

Post by Candy »

Kon-Tiki wrote: I've only accessed my guestbook through Opera :P
Ok, now I'm surprised. I did see a fix for IE posting empty POST replies on windowsupdate... Not that I use IE either...

Still, refreshing the page might auto-post again, not sure what opera does but it shouldn't.
Eero Ränik

Re:Reading and printing in Php

Post by Eero Ränik »

No, only part of it is in JavaScript, the one which adds the smilies into the textbox when clicking on the buttons. You could as well have people just type :) into the textbox, the rest is handled with PHP.
Kon-Tiki

Re:Reading and printing in Php

Post by Kon-Tiki »

I could do that list of smilies in pure html too, through a drop-down menu (like the color dropdown menu in this board) which has img-tags instead of text... I hope... if it's even possible to add img-tags in those things.
Eero Ränik

Re:Reading and printing in Php

Post by Eero Ränik »

Yes, but it must be added to the textbox too, if you don't include this function, it kind of beats the purpose of having a list at all...
Kon-Tiki

Re:Reading and printing in Php

Post by Kon-Tiki »

Can't I have it so that it adds code to the textbox, like *:)*, then it looks those codes up and replaces them with img-tags, all done in php and hmtl?
Eero Ränik

Re:Reading and printing in Php

Post by Eero Ränik »

Searching them and replacing them is written in PHP, but you can't just add them to a textbox with normal HTML. Of course you could have a list of buttons which will send the message away to a PHP-script which will add the smiley to it and show the message using the VALUE attribute of the textbox, but it would be pointless...
Kon-Tiki

Re:Reading and printing in Php

Post by Kon-Tiki »

Alrighty. I won't try to understand that piece of code as much as the others, because it's not php, but I'll use the javascript part.
Kon-Tiki

Re:Reading and printing in Php

Post by Kon-Tiki »

Ok, smilies work, except for three. They have >, < or both in their code (like you have :*) as code for :) - but without the * - ) Any ideas on how to fix this? To view what could be wrong, this is my code.

Edit:And crap, that bugfix for the reloading bug isn't really working >_<
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Reading and printing in Php

Post by Candy »

Kon-Tiki wrote: Ok, smilies work, except for three. They have >, < or both in their code (like you have :*) as code for :) - but without the * - ) Any ideas on how to fix this? To view what could be wrong, this is my code.

Edit:And crap, that bugfix for the reloading bug isn't really working >_<
Are you applying the smileys after the html-fix? If so, the < and > characters are < and > respectively. Match them instead.
Kon-Tiki

Re:Reading and printing in Php

Post by Kon-Tiki »

YAAAAAAAAAH! They work ;D ;D ;D Now one more fix and I'm settled. I'm trying to get that refreshing bug out by adding a check for $_POST['comment'], seeing if it's NULL or not. If it's not, it starts writing everything to a file, if it is, it doesn't. After that and before including that file, I have this:

Code: Select all

$_POST['Comment'] = "";
It's supposed to set $_POST['Comment'] to NULL, so that it won't pass that check at a reload, but it doesn't work =/
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Reading and printing in Php

Post by Candy »

Kon-Tiki wrote: After that and before including that file, I have this:

Code: Select all

$_POST['Comment'] = "";
It's supposed to set $_POST['Comment'] to NULL, so that it won't pass that check at a reload, but it doesn't work =/
What if you don't set it at all, and instead use

Code: Select all

if (isset($_POST['Comment']))
?

Other option would be to use

Code: Select all

$_POST['Comment'] = NULL;
?
Kon-Tiki

Re:Reading and printing in Php

Post by Kon-Tiki »

The if(isset($_POST['comment'])) doesn't work. It has the same effect as no if at all.

Now for testing the $ = NULL; thingy...
Nope, still doesn't work :-\
Post Reply