Deleting, then refreshing page deletes next post as well
Deleting, then refreshing page deletes next post as well
Script URL:
Version of script: 1.7
Hosting company: Hostmonster
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution: Delet*
Write your message below:
If I delete a post, then refresh the guestbook page with the small "message has been deleted" informational message that appears, I find that the next post is deleted as well. This is in Firefox 3.6.3.
I don't want to delete posts just by refreshing the page! Is there a way to control that behavior?
Version of script: 1.7
Hosting company: Hostmonster
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution: Delet*
Write your message below:
If I delete a post, then refresh the guestbook page with the small "message has been deleted" informational message that appears, I find that the next post is deleted as well. This is in Firefox 3.6.3.
I don't want to delete posts just by refreshing the page! Is there a way to control that behavior?
Hello Judy,
I just tested and can confirm your findings.
Furthermore, each time I refresh the page when the "post has been deleted" message is shown, I lose another message.
This is indeed an unwanted (and dangerous) behaviour and hopefully Klemen knows a way on how to change this behaviour.
Greetings,
Henrie
I just tested and can confirm your findings.
Furthermore, each time I refresh the page when the "post has been deleted" message is shown, I lose another message.
This is indeed an unwanted (and dangerous) behaviour and hopefully Klemen knows a way on how to change this behaviour.
Greetings,
Henrie
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
This is expected behaviour, because GBook posts don't have assigned IDs but get deleted by line numbers. So if you click on "a=delete&num=0" it will always delete the first line in the entries.txt file.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
GBook entries are stored in lines in the entreis.txt files. To delete an entry GBook actually deletes a line from the enires.txt file.
If you refresh the page your browser submits the command to delete the line you just deleted again to GBook so that line is deleted again.
Example: if your entires file has 5 lines:
AAAA
BBBB
CCCC
DDDD
EEEEE
You decide to delete one post (for exampl ethe 2nd post), GBook will delete line 2. The result will be:
AAAA
CCCC
DDDD
EEEE
Because you refresh the page and click the "Retry" button the browser again sends request to delete 2nd line, so the 2nd line is deleted again. The result is:
AAAA
DDDD
EEEE
If you refreshed again, it would again delete 2nd line:
AAAA
EEEE
and so on...
If you refresh the page your browser submits the command to delete the line you just deleted again to GBook so that line is deleted again.
Example: if your entires file has 5 lines:
AAAA
BBBB
CCCC
DDDD
EEEEE
You decide to delete one post (for exampl ethe 2nd post), GBook will delete line 2. The result will be:
AAAA
CCCC
DDDD
EEEE
Because you refresh the page and click the "Retry" button the browser again sends request to delete 2nd line, so the 2nd line is deleted again. The result is:
AAAA
DDDD
EEEE
If you refreshed again, it would again delete 2nd line:
AAAA
EEEE
and so on...
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
See http://www.dweephor.com/images/gberror.jpg .
There is absolutely nothing to indicate to the user that another post will be deleted if this display is refreshed. And then another ... and another ...
There is absolutely nothing to indicate to the user that another post will be deleted if this display is refreshed. And then another ... and another ...
@Klemen
I think Judy is right and that the current behaviour is not expected. I understand that the browser (in my case FF warns me that it resubmit previous data requests) will delete the data on resubmitting even though it is not indicated by the address bar. But still I think this is unwanted behaviour. Maybe you could introduce an extra step in the process of displaying the "Selected entry was successfully removed!" message so that on refreshing the page it will not delete another entry but just refreshes displaying the page.
@Judy
You can write the warning message yourself. Change in the file language.inc.php line to something like
Greetings,
Henrie
Judy and I are saying that after the line in gbook.txt has been deleted the GBook shows the guestbook again with the message "Selected entry was successfully removed!". The address bar of the browser shows only the address http://www.mywebsite.com/gbook/gbook.php. So it is not clear that on refreshing the page it will send "a=delete&num=0" again.Klemen wrote:This is expected behaviour, because GBook posts don't have assigned IDs but get deleted by line numbers. So if you click on "a=delete&num=0" it will always delete the first line in the entries.txt file.
I think Judy is right and that the current behaviour is not expected. I understand that the browser (in my case FF warns me that it resubmit previous data requests) will delete the data on resubmitting even though it is not indicated by the address bar. But still I think this is unwanted behaviour. Maybe you could introduce an extra step in the process of displaying the "Selected entry was successfully removed!" message so that on refreshing the page it will not delete another entry but just refreshes displaying the page.
@Judy
You can write the warning message yourself. Change in the file language.inc.php line
Code: Select all
$lang['t37']='Selected entry was successfully removed!';
Code: Select all
$lang['t37']='Selected entry was successfully removed!<br />Don\'t click refresh as it will delete another entry. <a href="gbook.php">Click on this text</a> or the \'View guestbook\' link to stop deleting messages.';
Henrie
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
"Maybe you could introduce an extra step in the process of displaying the "Selected entry was successfully removed!" message so that on refreshing the page it will not delete another entry but just refreshes displaying the page."
That would be perfect, Henrie. My browser doesn't warn me; I simply found one less post each time I would refresh the guestbook display. If there is an action tagged to the display of the "successfully removed" entry to end the deletion process, the issue would be solved.
In the meantime, I'll change the wording so the other moderators don't make that mistake. Thank you for the instructions.
That would be perfect, Henrie. My browser doesn't warn me; I simply found one less post each time I would refresh the guestbook display. If there is an action tagged to the display of the "successfully removed" entry to end the deletion process, the issue would be solved.
In the meantime, I'll change the wording so the other moderators don't make that mistake. Thank you for the instructions.
resfreh problem
Like Judy and Henrie i encountered the same problem.
The same happens also after adding a new entry.
After refresh every time the last added entry is added again
I would like to find a way to prevent this to prevent a polution of my guestbook.
Anyone suggestions?
The same happens also after adding a new entry.
After refresh every time the last added entry is added again
I would like to find a way to prevent this to prevent a polution of my guestbook.
Anyone suggestions?
This was introduced to skip a separate confirmation page (a "your post has been submitted/deleted ... click to continue" page).
But yes, I see why it's a problem and will include a check to just show the main guestbook page on refresh in future versions.
But yes, I see why it's a problem and will include a check to just show the main guestbook page on refresh in future versions.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools