| [ PHPXref.com ] | [ Generated: Sun Jul 20 16:49:42 2008 ] | [ Chipmunk Forum 1.3 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 session_start(); 3 include "connect.php"; 4 ?> 5 <?php 6 print "<link rel='stylesheet' href='style.css' type='text/css'>"; 7 print "<table class='maintable'>"; 8 print "<tr class='headline'><td><center>Move Thread</center></td></tr>"; 9 print "<tr class='forumrow'><td>"; 10 if(isset($_GET['ID'])) 11 { 12 $ID=$_GET['ID']; 13 } 14 else if(isset($_POST['threadid'])) 15 { 16 $ID=$_POST['threadid']; 17 } 18 19 $user=$_SESSION['user']; 20 $getuser="SELECT * from b_users where username='$user'"; 21 $getuser2=mysql_query($getuser) or die("Could not get user info"); 22 $getuser3=mysql_fetch_array($getuser2); 23 $gettopic="SELECT * from b_posts, b_users where b_posts.ID='$ID' and b_users.userID=b_posts.author"; 24 $gettopic2=mysql_query($gettopic) or die("Could not get topic"); 25 $gettopic3=mysql_fetch_array($gettopic2); 26 if($getuser3[status]<1 || ($getuser3[status]<=$gettopic3[status]&&$getuser3[userID]!=$gettopic3[userID])) 27 { 28 die("<table class='maintable'><tr class='headline'><td><center>Move Thread</center></td></tr><tr class='forumrow'><td><center>You do not have permission to move this thread</center></td></tr></table>"); 29 } 30 31 if($gettopic3['threadparent']!='0') 32 { 33 die("<table class='maintable'><tr class='headline'><td><center>Move Thread</center></td></tr><tr class='forumrow'><td><center>You must move a thread start post.</center></td></tr></table>"); 34 } 35 else 36 { 37 if(isset($_POST['submit'])) 38 { 39 $threadid=$_POST['threadid']; 40 $movedfrom=$_POST['movedfrom']; 41 $moveto=$_POST['moveto']; 42 $getnum="SELECT COUNT(*) from b_posts where threadparent='$threadid'"; 43 $getnum2=mysql_query($getnum) or die("Could not get number of subsequent threads"); 44 $getnum3=mysql_result($getnum2,0); 45 $changedposts=$getnum3+1; 46 $updatethread="update b_posts set postforum='$moveto' where ID='$threadid'"; 47 mysql_query($updatethread) or die("Could not update thread"); 48 $updaterest="update b_posts set postforum='$moveto' where threadparent='$threadid'"; 49 mysql_query($updaterest) or die("Could not update posts"); 50 $getfromforum="SELECT * from b_posts where postforum='$movedfrom' order by telapsed DESC, ID DESC limit 1"; 51 $getfromforum2=mysql_query($getfromforum) or die("Could not get moved from forum"); 52 $getfromforum3=mysql_fetch_array($getfromforum2); 53 $gettoforum="SELECT * from b_posts where postforum='$moveto' order by telapsed DESC, ID DESC limit 1"; 54 $gettoforum2=mysql_query($gettoforum) or die("COuld not get moved to forum"); 55 $gettoforum3=mysql_fetch_array($gettoforum2); 56 $updatefromforum="UPDATE b_forums set lastpostuser='$getfromforum3[lastpost]', numtopics=numtopics-1, numposts=numposts-'$changedposts', lastpost='$getforumfrom3[timepost]' where ID='$movedfrom'"; 57 mysql_query($updatefromforum) or die("Could not update forum 1"); 58 $updatetoforum="Update b_forums set lastpostuser='$gettoforum3[lastpost]', numtopics=numtopics+1, numposts=numposts+'$changedposts', lastpost='$gettoforum3[timepost]' where ID='$moveto'"; 59 mysql_query($updatetoforum) or die(mysql_error()); 60 print "Thread moved, <A href='index.php'>Back to Forum</a>"; 61 62 63 } 64 else 65 { 66 print "<form action='movethread.php' method='post'>"; 67 print "Move this thread to..<br>"; 68 print "<input type='hidden' name='threadid' value='$ID'>"; 69 print "<input type='hidden' name='movedfrom' value='$gettopic3[postforum]'>"; 70 print "<select name='moveto'><br>"; 71 $getavailableforums="SELECT * from b_forums where permission_min<='$getuser3[status]' order by parentID ASC"; 72 $getavailableforums2=mysql_query($getavailableforums) or die("Could no get available Forums"); 73 while($getavailableforums3=mysql_fetch_array($getavailableforums2)) 74 { 75 print "<option value='$getavailableforums3[ID]'>$getavailableforums3[name]</option><br>"; 76 } 77 print "</select><br>"; 78 print "<input type='submit' name='submit' value='Move thread'></form>"; 79 } 80 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |