Page 2 of 2

Re:Reading and printing in Php

Posted: Sun Apr 18, 2004 7:24 am
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.

Re:Reading and printing in Php

Posted: Sun Apr 18, 2004 7:56 am
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.

Re:Reading and printing in Php

Posted: Sun Apr 18, 2004 9:26 am
by Kon-Tiki
I've only accessed my guestbook through Opera :P

Re:Reading and printing in Php

Posted: Sun Apr 18, 2004 9:37 am
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.

Re:Reading and printing in Php

Posted: Sun Apr 18, 2004 10:25 am
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.

Re:Reading and printing in Php

Posted: Sun Apr 18, 2004 11:51 am
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.

Re:Reading and printing in Php

Posted: Sun Apr 18, 2004 11:55 am
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...

Re:Reading and printing in Php

Posted: Sun Apr 18, 2004 1:15 pm
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?

Re:Reading and printing in Php

Posted: Mon Apr 19, 2004 7:44 am
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...

Re:Reading and printing in Php

Posted: Mon Apr 19, 2004 8:03 am
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.

Re:Reading and printing in Php

Posted: Mon Apr 19, 2004 1:21 pm
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 >_<

Re:Reading and printing in Php

Posted: Mon Apr 19, 2004 1:47 pm
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.

Re:Reading and printing in Php

Posted: Mon Apr 19, 2004 1:58 pm
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 =/

Re:Reading and printing in Php

Posted: Mon Apr 19, 2004 2:21 pm
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;
?

Re:Reading and printing in Php

Posted: Mon Apr 19, 2004 3:38 pm
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 :-\