Jump to content
MakeWebGames

Recommended Posts

Posted

sorry to keep being a bother im trying to get my game good enough to launch but problem im having is with my gang forums i can post in it like normal but the second i leave the post then go back to yourgang.php and click gang forums all of a sudden the post is gone it shows up like nothing was posted

 

 

function gang_forums_idx()
{
global $ir,$db,$userid,$gangdata;
echo "Welcome to your gang forums! [<a href='yourgang.php?action=forums&act2=newtopicform'>Start New Topic</a>]<br />
<table width=80% cellspacing=1><tr style='background:blue;'><th>Topic</th><th>Starter</th><th>Replies</th>
<th>Views</th><th>Last Post</th></tr>";
$tpcs=$db->("SELECT t.*,u1.username as startername,u2.username as lastpostername FROM gangforums_topics t LEFT JOIN users u1 ON t.gft_userid=u1.userid LEFT JOIN users u2 ON t.gft_lastposterid=u2.userid WHERE t.gft_gangid={$gangdata['gangID']} ORDER BY t.gft_lastpost DESC");
while($t=mysql_fetch_array($tpcs))
{
print "<tr><td><a href='yourgang.php?action=forums&topic={$t['gft_id']}'>{$t['gft_title']}</a></td><td><a href='profile.php?u={$t['gft_userid']}'>{$t['startername']}</a></td>
<td>{$t['gft_replies']}</td><td>{$t['gft_views']}</td><td>";
print date('F j Y, g:i:s a',$t['gft_lastpost']);
print "<br />By: <a href='profile.php?u={$t['gft_lastposterid']}'>{$t['lastpostername']}</a></td></tr>";
}
print "</table>";
}
function gang_forums_viewtopic()
{
global $ir,$db,$userid,$gangdata;
$tpcd=$db->("SELECT t.*,u1.* FROM gangforums_topics t LEFT JOIN users u1 ON t.gft_userid=u1.userid WHERE t.gft_id={$_GET['t']}");
$db->("UPDATE gangforums_topics SET gft_views=gft_views+1 WHERE gft_id={$_GET['t']}");
$topic=mysql_fetch_array($tpcd);
$posts[0]['username']=$topic['username'];
$posts[0]['userid']=$topic['userid'];
$posts[0]['time']=$topic['gft_starttime'];
$posts[0]['level']=$topic['level'];
$posts[0]['nr']=1;
$posts[0]['text']=str_replace("\n","<br />",$topic['gft_text']);
$cntr=0;
$pq=$db->("SELECT r.*,u.* FROM gangforums_replies r LEFT JOIN users u ON r.gfr_userid=u.userid WHERE r.gfr_topic={$_GET['t']} ORDER BY gfr_posttime ASC;");
while($r=mysql_fetch_array($pq))
{
$cntr++;
$posts[$cntr]['username']=$r['username'];
$posts[$cntr]['userid']=$r['userid'];
$posts[$cntr]['time']=$r['gfr_posttime'];
$posts[$cntr]['level']=$r['level'];
$posts[$cntr]['nr']=$cntr+1;
$posts[$cntr]['text']=str_replace("\n","<br />",$r['gfr_text']);
}
print "<table width=80% cellspacing=0><tr style='background:blue;'><th colspan=2>{$topic['gft_title']}</th></tr>";
foreach($posts as $cpost)
{
print "<tr><td>Post #{$cpost['nr']}</td><td>Time Posted: ".date('F j Y, g:i:s a',$cpost['time'])."</td></tr>
<tr><td><a href='profile.php?u={$cpost['userid']}'>{$cpost['username']}</a><br />Level: {$cpost['level']}</td><td>{$cpost['text']}</td></tr>";
}
print "</table>";
print "<br /><table width=80% cellspacing=1><tr style='background: blue;'><th>Add Reply</th></tr>";
print "<tr><td align=center><form action='yourgang.php?action=forums&reply={$_GET['t']}' method='post'><b>Your Post:</b> (no HTML, linebreaks automatically converted to <br />)<br />
<textarea rows=10 cols=80 name='textpost'></textarea><br />
<input type='submit' value='Post' /></form></td></tr></table>";
}

function gang_forums_reply()
{
global $ir,$db,$userid,$gangdata;
$t=$_GET['t'];
$post=str_replace(array("<",">","'"),array("<",">","''"),$_POST['textpost']);
$db->("INSERT INTO gangforums_replies VALUES('',$userid,{$gangdata['gangID']},$t,'$post',unix_timestamp())");
$db->("UPDATE gangforums_topics SET gft_replies=gft_replies+1,gft_lastpost=unix_timestamp(),gft_lastposterid=$userid WHERE gft_id=$t");
print "<table width=80% cellspacing=1><tr style='background:blue;'><th>News</th></tr><tr><td align=center>Reply Posted!</td></tr></table><br />";
gang_forums_viewtopic();
}

function gang_forums_newt_form()
{
global $ir,$db,$userid,$gangdata;
print "<b>Creating New Topic....</b><br />
<table cellspacing=1>
<form action='yourgang.php?action=forums&act2=newtopicsub' method='post'>
<tr><td>Title:</td><td> <input type='text' name='topictitle' value='' /></td></tr>
<tr><td><b>Your Topic:</b> <br /><small>(no HTML, linebreaks automatically converted to <br />)</small></td><td><textarea rows=7 cols=40 name='topictext'></textarea></td></tr><tr>
<td colspan=2 align=center><input type='submit' value='Post' /></td></tr></form></table>";
}

function gang_forums_newt_sub()
{
global $ir,$db,$userid,$gangdata;
$title=str_replace(array("<",">","'"),array("<",">","''"),$_POST['topictitle']);
$post=str_replace(array("<",">","'"),array("<",">","''"),$_POST['topictext']);
$db->("INSERT INTO gangforums_topics VALUES('',$userid,{$gangdata['gangID']},'$title','$post',0,0,unix_timestamp(),$userid,
unix_timestamp())");
$iq=$db->("SELECT max(gft_id) AS tid FROM gangforums_topics");
$iee=mysql_fetch_array($iq);
print "<table width=80% cellspacing=1><tr style='background:blue;'><th>News</th></tr><tr><td align=center>Topic Posted!</td></tr></table><br />";
$_GET['t']=$iee['tid'];
gang_forums_viewtopic();
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...