[SOLVED] Shoutbox r...
 
Notifications
Clear all

[SOLVED] Shoutbox repeating entries

6 Posts
4 Users
0 Reactions
2,281 Views
(@jacci)
Posts: 503
Honorable Member
Topic starter
 

efic 3.2
no mods yet
nothing done to script

http://www.pretendercentre.com/missingtest/index.php

i have just included the shoutbox in my index, using the coding

{shoutbox_content} in index.tpl

and  in variables.php
$blocks["shoutbox"]["status"] = '1';

the shoutbox is showing fine and it will let me shout, but i am getting multiple shouts of the same entry.

jacci
03/04/07 07:23 pm [Edit]
try again
jacci
03/04/07 07:22 pm [Edit]
try again
jacci
03/04/07 03:46 pm [Edit]
try again
jacci
03/04/07 03:40 pm [Edit]
hi

i did the actual two shouts, the hi at 340 and the try again at 346
the 'try again' seems to propogate now every time i press refresh

thanks


why is nothing ever easy?
url: http://www.pretendercentre.com/missingpieces/     
php: 5.2.5  msql: 5.0.45-community
efic version: 3.4.3           latest patches: yes
bridges: none              mods: challenges, displayword, beta-search

 
Posted : 04/03/2007 4:29 am
(@tammy)
Posts: 2577
Member Moderator
 

Every time you refresh you're submitting that shout again.  It's not a bug, it's how it's written.


 
Posted : 04/03/2007 11:01 pm
(@jacci)
Posts: 503
Honorable Member
Topic starter
 

Oh i see how that works now, if you havent gone anywere esle, it is like you are still in the shoutbox.

That woudl explain why some of my entries get repeated endlessly and some didnt.

thanks tammy


why is nothing ever easy?
url: http://www.pretendercentre.com/missingpieces/     
php: 5.2.5  msql: 5.0.45-community
efic version: 3.4.3           latest patches: yes
bridges: none              mods: challenges, displayword, beta-search

 
Posted : 04/03/2007 11:42 pm
(@itanshi)
Posts: 381
Reputable Member
 

There are standard methods to solve this.

A cookie



<?php
# After posting:
setcookie('flood_protection', '1', time()+30);
# Then check, on post:
if(isset($_COOKIE['flood_protection'])) {
      print "Stop flooding!";
}
?>

and javascript



var formSubmitted = false;

function toValidateAndSubmitForm(){
if (formSubmitted){
  alert('You can only submit the form once, please be patient')
  return false;
}

else{
  formSubmitted = true;
  //code here to validate and submit the form
  return true;
  }

}

<form onsubmit="return toValidateAndSubmitForm()">

The basic idea is to set a variable in global scope. When the form is
submitted, the first time, change the variables value. If its been submitted
already, do not submit it again.

You can also disable the submit button after a post, but that will not address the refresh. A redirect out of the shoutbox is probably best, although with my setup it wouldn't work that easily. I have it on every page.


I am rebuilding efiction! Join us on irc! #efiction at www.mibbit.com Instructions for irc πŸ˜€ Alpha released!

 
Posted : 05/03/2007 12:35 am
(@amerna)
Posts: 28
Eminent Member
 

Where do I install the cookie and the javascript and what do you mean with "//code here to validate and submit the form"

I'm sorry, I'm a complete efiction-newbie with no knowledge about javascript,cookies and whatsoever.


Site: http://fanfiction.janeites.net
Version: 3.5.2
Bridges: None
Modules: Betareader, Challenges, Storyend
PHP: 5.2.9
MySQL: 5.0.67

 
Posted : 08/09/2007 1:19 pm
(@itanshi)
Posts: 381
Reputable Member
 

I assume that means the efiction.org code this modifies. I'm not completely sure what to do either, so for now I just delete extra entries


I am rebuilding efiction! Join us on irc! #efiction at www.mibbit.com Instructions for irc πŸ˜€ Alpha released!

 
Posted : 23/11/2007 1:23 am
Share: