Action |
29th May 2009 01:00 |
Quiz Shout
Hi ya
I have modified a old staff shout script for use as a quiz shout,
i have created a sql etc
problem i have when i click on send its displays the display again either at the bottom of the plugin or inside the iframe again.
could someone have a look and let me know where im going wrong pls
Action
code is
PHP Code:
<?php /* +-------------------------------------------------------------------------- | TS Special Edition v.4.1 | ======================================== | by xam | (c) 2005 - 2007 Template Shares Services | http://templateshares.net | ======================================== | Web: http://templateshares.net | Time: December 2, 2007, 10:26 pm | Signature Key: TSSE16342007 | Email: contact@templateshares.net | TS SE IS NOT FREE SOFTWARE! +--------------------------------------------------------------------------- */ require_once('./global.php'); gzip(); dbconn(); loggedinorreturn(); maxsysop(); $is_mod = is_mod($usergroups); if (!$is_mod)
$insert=false; $lang->load('ff'); begin_main_frame(); ?>
<script language=javascript> function SmileIT(smile,form,text){ document.forms[form].elements[text].value = document.forms[form].elements[text].value+" "+smile+" "; document.forms[form].elements[text].focus(); } function winop(form,name) { link='moresmiles.php?form='+form+'&text='+name newWin=window.open(link,'moresmile','height=500,width=400,resizable=yes,scrollbars=yes'); if (window.focus) {newWin.focus()} } </script>
<table width='100%' border='0' cellspacing='0' cellpadding='0' color='black'><tr><td class=text> <form action='quizshoutbox.php' method='get' target='sbox' name='shbox' onSubmit=\"mySubmit()\"> <center>Message: <input type='text' maxlength=320 name='shbox_text' size='90'> <input type='submit' value='Send'> <input type='hidden' name='sent' value='yes'> <a href="javascript: winop('shbox','shbox_text')">EXTRA smilies</a><a href="javascript: SmileIT(';-)','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/wink.gif width="20" height="20" border=0></a><a href="javascript: SmileIT(':-P','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/tongue.gif width="20" height="20" border=0></a><a href="javascript: SmileIT(':-)','shbox','shbox_text')"><img border=0 src=<?=$pic_base_url;?>smilies/smile1.gif></a><a href="javascript: SmileIT(':w00t:','shbox','shbox_text')"><img border=0 src=<?=$pic_base_url;?>smilies/w00t.gif></a><a href="javascript: SmileIT(':-D','shbox','shbox_text')"><img border=0 src=<?=$pic_base_url;?>smilies/grin.gif></a><a href="javascript: SmileIT(':lol:','shbox','shbox_text')"><img border=0 src=<?=$pic_base_url;?>smilies/laugh.gif></a><a href="javascript: SmileIT(':-/','shbox','shbox_text')"><img border=0 src=<?=$pic_base_url;?>smilies/confused.gif></a><a href="javascript: SmileIT(':-(','shbox','shbox_text')"><img border=0 src=<?=$pic_base_url;?>smilies/sad.gif></a><a href="javascript: SmileIT(':-O','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/ohmy.gif border=0></a><a href="javascript: SmileIT('8-)','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/cool1.gif width="18" height="18" border=0></a><a href="javascript: SmileIT(':sly:','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/sly.gif width="18" height="18" border=0></a><a href="javascript: SmileIT(':greedy:','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/greedy.gif width="18" height="18" border=0></a><a href="javascript: SmileIT(':weirdo:','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/weirdo.gif width="18" height="18" border=0></a><a href="javascript: SmileIT(':sneaky:','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/sneaky.gif width="18" height="18" border=0></a><a href="javascript: SmileIT(':wacko:','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/wacko.gif width="18" height="18" border=0></a><a href="javascript: SmileIT(':angel:','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/angel.gif width="18" height="18" border=0></a><a href="javascript: SmileIT(':nugget:','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/nugget.gif width="18" height="18" border=0></a><img src=<?=$pic_base_url;?>smilies/angry.gif width="18" height="18" border=0></a><a href="javascript: SmileIT(':mml:','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/mml.gif width="18" height="18" border=0></a><a href="javascript: SmileIT(':blink:','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/blink.gif width="18" height="18" border=0></a><a href="javascript: SmileIT(':evilmad:','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/evilmad.gif width="18" height="18" border=0></a><a href="javascript: SmileIT(':shutup:','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/shutup.gif width="18" height="18" border=0></a><a href="javascript: SmileIT(':ras:','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/ras.gif width="18" height="18" border=0></a><a href="javascript: SmileIT(':nuke:','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/nuke.gif width="18" height="18" border=0></a><a href="javascript: SmileIT(':?:','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/question.gif width="18" height="18" border=0></a><a href="javascript: SmileIT(':!:','shbox','shbox_text')"><img src=<?=$pic_base_url;?>smilies/excl.gif width="18" height="18" border=0></a></center>
<iframe src='quizshoutbox.php' width='100%' height='300' frameborder='0' name='sbox' marginwidth='0' marginheight='0'></iframe> </td></tr></table></form> <? // DELETE SHOUT ? if (isset($_GET['del']) && $usergroups['canstaffpanel'] == 'yes' && is_valid_id($_GET['del'])) sql_query("DELETE FROM quizshoutbox WHERE id=".sqlesc($_GET['del']));
// EDIT SHOUT ? if (isset($_GET['edit']) && $usergroups['canstaffpanel'] == 'yes' && is_valid_id($_GET['edit'])) { $sql=sql_query("SELECT id,text FROM quizshoutbox WHERE id=".sqlesc($_GET['edit'])); $res=mysql_fetch_array($sql); if (!empty($res)) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="expires" content="0"> <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="text/html; charset=<?=$charset;?>" /> <style type="text/css"> #specialbox{ border: 1px solid gray; width: 600px; background: #FBFCFA; font: 11px verdana, sans-serif; color: #443; padding: 3px; outline: none; }
#specialbox:focus{ border: 1px solid black; } .btn { cursor:pointer; border:outset 1px #ccc; background:#999; color:#666; font-weight:bold; padding: 1px 2px; background:url(<?=$pic_base_url;?>formbg.gif) repeat-x left top; } </style> </head> <body bgcolor=#F5F4EA> <?php echo '<form method=post action=quizshoutbox.php>'; echo '<input type=hidden name=id value='.(int)$res['id'].'>'; echo '<textarea name=text rows=3 id=specialbox>'.htmlspecialchars($res['text']).'</textarea>'; echo '<input type=submit name=save value='.$lang->global['buttonsave'].' class=btn>'; echo '</form></body></html>'; die; } }
// UPDATE SHOUT? if (isset($_POST['text']) && $usergroups['canstaffpanel'] == 'yes' && is_valid_id($_POST['id'])) { $text = trim($_POST['text']); $id = (int)$_POST['id']; if (isset($text) && isset($id) && is_valid_id($id)) sql_query("UPDATE quizshoutbox SET text = ".sqlesc($text)." WHERE id=".sqlesc($id)); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="expires" content="0"> <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="text/html; charset=<?=$charset;?>" /> <META HTTP-EQUIV=REFRESH CONTENT="40; URL=quizshoutbox.php"> <style type="text/css"> A {color: #000000; font-weight: bold; } A:hover {color: #FF0000;} .small {font-size: 9pt; font-family: tahoma; } .date {font-size: 7pt;} .error { color: #990000; background-color: #FFF0F0; padding: 7px; margin-top: 5px; margin-bottom: 10px; border: 1px dashed #990000; } BODY { background-color: #F0F0E6; SCROLLBAR-3DLIGHT-COLOR: #004E98; SCROLLBAR-ARROW-COLOR: #004E98; SCROLLBAR-DARKSHADOW-COLOR: white; SCROLLBAR-BASE-COLOR: white; } </STYLE> </head> <body bgcolor=#F5F4EA> <?
if($_GET["sent"]=="yes") if(!$_GET["shbox_text"]) { $userid=0+$CURUSER["id"]; } else { $userid=(int)$CURUSER['id']; $msg = flood_check ('quizshoutbox messages', $CURUSER['last_shout'], true); if ($msg != '') { print $msg; $insert=false; } else $insert=true;
$username=htmlspecialchars(trim($CURUSER["username"])); $date=time(); $added=get_date_time(); $text=trim($_GET["shbox_text"]); if ($insert == 1) { sql_query("INSERT INTO quizshoutbox (id, userid, username, date, added, text) VALUES ('id'," . sqlesc($userid) . ", " . sqlesc($username) . ", " . sqlesc($date) . ", " . sqlesc($added) . ", " . sqlesc($text) . ")") or sqlerr(__FILE__, __LINE__); print "<script type=\"text/javascript\">parent.document.forms[0].shbox_text.value='';</script>"; } }
$res = sql_query("SELECT s.id as shoutid,s.date as shoutdate,s.text,u.username,u.id as userid,u.donor,u.warned,g.namestyle FROM quizshoutbox s LEFT JOIN users u ON (s.userid=u.id) LEFT JOIN usergroups g ON (u.usergroup=g.gid) ORDER BY s.date DESC LIMIT 0, 50") or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($res) == 0) print($eol); else { print("<table border=0 cellspacing=0 cellpadding=2 width='100%' align='left' class='small'>\n");
while ($arr = mysql_fetch_array($res)) { $usercolor = get_user_color($arr['username'], $arr['namestyle']); if ($usergroups['canstaffpanel'] == 'yes') { $del="<span class='date'>[<a href=quizshoutbox.php?del=".$arr['shoutid'].">x</a>]</span>\n"; $edit="<span class='date'>[<a href=quizshoutbox.php?edit=".$arr['shoutid'].">e</a>]</span>\n"; } $pm = "<span class='date'>[<a target=_blank href=sendmessage.php?receiver=$arr[userid]>pm</a>]</span>\n"; print("<tr><td>\n<span class='date'>[".strftime("%Y.%m.%d %H:%M",$arr["shoutdate"])."]</span>\n$del $edit $pm <a href='userdetails.php?id=".$arr["userid"]."' target='_blank'>$usercolor</a>\n" . ($arr["donor"] == "yes" ? "<img src='".$pic_base_url."star.gif' alt='".$lang->global['imgdonated']."' title='".$lang->global['imgdonated']."'>\n" : "") . ($arr["warned"] == "yes" ? "<img src='".$pic_base_url."warned.gif' alt='".$lang->global['imgwarned']."' title='".$lang->global['imgwarned']."'>\n" : "") . " ".format_comment($arr["text"])."\n</td></tr>\n"); } print("</table>"); } ?> <? end_main_frame(); ?> </body> </html>
Bump: Any ideas with the above?
|