Tenaciousmug Posted November 2, 2012 Share Posted November 2, 2012 Okay, when this shoutbox runs on my page and I'm going into my inventory and use an item or something and put it in my virtual shop, it puts TWO in or if I stay there for 5 minutes, LOADS of the same item in the shop... It just keeps redoing my action everytime it reloads the shoutbox.. Here is my code for the shoutbox ON my layout: <div id="chat"> <? $checkonline = time() - 1800; $online1 = mysql_query("SELECT * FROM login WHERE lastactive >= $checkonline"); $online2 = mysql_num_rows($online1); ?> <p style="text-align:center;"><b><? echo $online2; ?></b> Users Online</p> <? if($clearance >= 4) { echo '<br /><p style="text-align:center;"><a href="adminsb.php">SB Admin</a></p>'; } if($sbdisablebattle == 'yes' || $sbdisablebreed == 'yes') { echo '<br /><p style="text-align:center;">Shoutbox disabled whilst breeding or battling.</p>'; } else { echo '<form name="myForm" action="postbox.php" method="post"> <textarea id="message" name="message" wrap="physical" rows="5" onkeydown="textCounter(document.myForm.message,document.myForm.remLen1,79)" onkeyup="textCounter(document.myForm.message,document.myForm.remLen1,79)"></textarea> <br /> <div class="clearfix" style="width:100%;"> <input readonly type="text" name="remLen1" maxlength="3" value="79" style="color:#474747;width:15px;background:none;border:none;float:left;font-size:9px;margin-right:2px;"> <span style="font-size:9px;margin-right:6px;float:left;">Characters Left</span> </div> <div class="clearfix" style="width:100%;margin-top:-15px;"> <input name="location" id="location" type="hidden" value="'.$url.'" /> <input type="Submit" name="Submit" value="POST" class="button" style="float:right;" /> </div> </form>'; } if($usrdet[sbauto] == 'no') { echo '<br /><p style="text-align:center;"><a href="settings.php?auto=yes">Turn ON Auto SB</a></p>'; } else { echo '<br /><p style="text-align:center;"><a href="settings.php?auto=no">Turn OFF Auto SB</a></p>'; } if($usrdet[sbauto] == 'no') { $sb = mysql_query("SELECT * FROM sb WHERE blocked = 'no' ORDER BY id DESC LIMIT 15"); while ($sbresults = mysql_fetch_array( $sb )) { echo '<div class="shoutbox_post fixed_width" style="background-color: '.$sbresults[colour].';">'; echo '<div class="shout_header"><p><img src="#" /><b><a href="http://www.dstable.com/profile.php?name='.$sbresults[user].'">'.$sbresults[user].'</b></a></p></div>'; if($clearance >= 7) { echo '<sub><a href="admindelsb.php?id='.$sbresults[id].'&act=block&user='.$sbresults[user].'">Block</a> - <a href="admindelsb.php?id='.$sbresults[id].'&act=del&user='.$sbresults[user].'">Delete</a></sub>'; } echo '<div class="shout_body">'.$sbresults[message].'</div>'; echo '</div>'; } } else { echo ' <script> $(document).ready(function() { $("#responsecontainer").load("shout6.php"); var refreshId = setInterval(function() { $("#responsecontainer").load(\'shout6.php?randval=\'+ Math.random()); }, 9000); $.ajaxSetup({ cache: false }); }); </script> <div id="responsecontainer"> </div> '; } ?> </div> Then here is the shout6.php page it loads: <? $conn = mysql_pconnect('localhost', 'username', 'password') or die ( header ( 'Location: noconnect.php' ) ); mysql_select_db('jdstable_dstable', $conn); $sb = mysql_query("SELECT * FROM sb WHERE blocked = 'no' ORDER BY id DESC LIMIT 15"); while ($sbresults = mysql_fetch_array( $sb )) { echo '<div class="shoutbox_post fixed_width" style="background-color: '.$sbresults[colour].';">'; echo '<div class="shout_header clearfix"><p><img src="#" /><b><a href="http://www.dstable.com/profile.php?name='.$sbresults[user].'" style="float:left;">'.$sbresults[user].'</a></b>'; echo '<span style="float:left;margin-left:5px;">'; if($sbresults[user] == 'Jooshy') {echo '<img src="http://www.dstable.com/images/icon_mod.gif"><img src="http://www.dstable.com/images/icon_program.gif">';} if($sbresults[user] == 'Tim') {echo '<img src="http://www.dstable.com/images/icon_mod.gif"><img src="http://www.dstable.com/images/icon_program.gif">';} if($sbresults[user] == 'DracoTarcheInazuma') {echo '<img src="http://www.dstable.com/images/icon_staff.gif" width="14" height="14">';} if($sbresults[user] == 'Nortiker') {echo '<img src="http://www.dstable.com/images/icon_mod.gif"><img src="http://www.dstable.com/images/icon_art.gif">';} if($sbresults[user] == 'Annasaur' || $sbresults[user] == 'Knight') {echo '<img src="http://www.dstable.com/images/icon_art.gif">';} if($sbresults[user] == 'Fenikkusu') {echo '<img src="http://www.dstable.com/images/icon_mod2.gif"><img src="http://www.dstable.com/images/icon_writer.gif">';} if($sbresults[user] == 'Mage') {echo '<img src="http://www.dstable.com/images/icon_mod2.gif"><img src="http://www.dstable.com/images/icon_writer.gif">';} if($sbresults[user] == 'Prinx') {echo '<img src="http://www.dstable.com/images/icon_mod2.gif"><img src="http://www.dstable.com/images/icon_writer.gif">';} if($sbresults[user] == 'Yakumo') {echo '<img src="http://www.dstable.com/images/icon_mod2.gif">';} if($sbresults[user] == 'Thaddeusgrey') {echo '<img src="http://www.dstable.com/images/icon_art.gif">';} if($sbresults[user] == 'lilpeanut') {echo '<img src="http://www.dstable.com/images/icon_program.gif">';} echo '</span></p></div>'; if($clearance >= 7) { echo '<sub><a href="admindelsb.php?id='.$sbresults[id].'&act=block&user='.$sbresults[user].'">Block</a> - <a href="admindelsb.php?id='.$sbresults[id].'&act=del&user='.$sbresults[user].'">Delete</a></sub>'; } echo '<div class="shout_body">'.$sbresults[message].'</div>'; echo '</div>'; } ?> Does anyone have any idea why it would be resubmitting the actions over and over again that I'm doing as long as I stay on that page? It just keeps refreshing the page every 3-5 seconds since that is when the shoutbox refreshes? Quote Link to comment https://forums.phpfreaks.com/topic/270222-ajax-refreshing-entire-page/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.