thebobby Posted September 21, 2013 Posted September 21, 2013 (edited) <? error_reporting('0'); include 'header.php'; include 'bbcodes.php'; $newgmail = "0"; $result = mysql_query("UPDATE `grpgusers` SET `gmail` = '".$newgmail."' WHERE `id`='".$_SESSION['id']."'"); if($user_class->gangmail > 0){ $resulte = mysql_query("UPDATE `grpgusers` SET `gangmail`='0' WHERE `id`='".$user_class->id."'"); } if($user_class->gang < 1) { echo Message("You are not in a gang.");include 'footer.php'; die(); } if ($user_class->gang != 0) { $gang_class = New Gang($user_class->gang); } if (isset($_POST['submit'])) { $error = ($_POST['message'] == "") ? "You need to have a message!" : $error; if($error == ""){ $_POST['title'] = str_replace ('"', '"', $_POST['title']); $_POST['title'] = str_replace ("'", "'", $_POST['title']); $_POST['message'] = str_replace ('"', '"', $_POST['message']); $_POST['message'] = str_replace ("'", "'", $_POST['message']); $clock = date("d M H:i:s"); $time = time(); $result = mysql_query("INSERT INTO `gangmail` (`when`, `poster`,`date`, `title`, `message`, `gangid`)VALUES"." ('".$time."', '$user_class->id','$clock', '".strip_tags($_POST['title'])."', '".strip_tags($_POST['message'])."', '".$gang_class->id."')"); $resultbb = mysql_query("UPDATE `grpgusers` SET `gmail` = `gmail` + 1 WHERE `gang` = '{$gang_class->id}'"); } else { echo Message($error); } } ?> <script language="JavaScript" type="text/javascript"> <!-- function emoticon(myValue) { var myField = document.getElementById('msgtext'); //IE support if (document.selection) { var temp; myField.focus(); sel = document.selection.createRange(); temp = sel.text.lenght; sel.text = myValue; if (myValue.length == 0) { sel.moveStart('character', myValue.length); sel.moveEnd('character', myValue.length); } else { sel.moveStart('character', -myValue.length + temp); } sel.select(); } //MOZILLA/NETSCAPE support else if (myField.selectionStart || myField.selectionStart == '0') { var startPos = myField.selectionStart; var endPos = myField.selectionEnd; myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length); myField.focus(); myField.selectionStart = startPos + myValue.length; myField.selectionEnd = startPos + myValue.length; } else { myField.value += myValue; myField.focus(); } } </script> <? ?> <tr> <td class="contentcontent"><form method='post'> <table width='100%'> <center> <? echo bbcode_popup(); ?> </center> <tr> <td width='25%'>Message:</td> <td width='75%'><textarea name='message' cols='70' rows='4' ></textarea></td> </tr> <tr> <td width='25%'>Submit:</td> <td width='75%'><center> <input type='submit' name='submit' class='button' value='Post'> </center></td> </tr> </table> </form></td> </tr> <? $date = mysql_query("SELECT * from `gangmail` WHERE `gangid` = '".$gang_class->id."' ORDER BY `when` DESC LIMIT 40"); $result = mysql_query("SELECT * from `gangmail` WHERE `gangid` = '".$gang_class->id."' ORDER BY `when` DESC LIMIT 40"); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $user_ads = New User($row['poster']); ?> <script type="text/JavaScript"> function timedRefresh(timeoutPeriod) { setTimeout("location.reload(true);",timeoutPeriod); } </script> </head> <body onload="JavaScript:timedRefresh(10000);" <tr> <td class="contentcontent"><table width='100%'> <tr> <td width='25%' align='center' class='highlight'><img src="<?= $user_ads->avatar ?>" width='100' height='100' border='0'></a><br> <?= $user_ads->formattedname ?> <br> <?= ($row['date']) ?> <br></td> <td width='75%' colspan='4' class='highlight'><?= $bbcode->parse($row['message']) ?> </span></td> </tr> </table></td> </tr></body> <? } ?> <? include 'footer.php'; ?> Edited September 22, 2013 by KyleMassacre added code tags Quote
KyleMassacre Posted September 22, 2013 Posted September 22, 2013 what exactly are you looking for here? Quote
thebobby Posted September 22, 2013 Author Posted September 22, 2013 this make page refresh i want this gangmail to post message when a new message is posted with out refreshing page manually ?> <script type="text/JavaScript"> function timedRefresh(timeoutPeriod) { setTimeout("location.reload(true);",timeoutPeriod) ; } </script> </head> <body onload="JavaScript<b></b>:timedRefresh(10000);" <tr> <td class="contentcontent"><table width='100%'> <tr> <td width='25%' align='center' class='highlight'><img src="<?= $user_ads->avatar ?>" width='100' height='100' border='0'></a> <?= $user_ads->formattedname ?> <?= ($row['date']) ?> </td> <td width='75%' colspan='4' class='highlight'><?= $bbcode->parse($row['message']) ?> </span></td> </tr> </table></td> </tr></body> <? } ?> Quote
KyleMassacre Posted September 22, 2013 Posted September 22, 2013 sniko posted a little something about making an ajax chat and you can see it Here Quote
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.