<br /><?<br /> $forum = "announce"; // Keyword of forum to add subscriptions to<br /><br />// Require the library<br /> require ("main.inc.php");<br /><br />// -----------------<br />// Get the user info<br /> $userob = new user;<br /> $user = $userob -> authenticate();<br /> $html = new html;<br /><br />// -----------------------------<br />// Make sure they should be here<br /> if ($user['U_Status'] != 'Administrator'){<br /> $html -> not_right ("You must be logged in, and be a valid administrator or moderator to access this.",$Cat);<br /> }<br /><br />// ------------------------<br />// Now show them their page <br /> $html -> send_header("Autosubscribe users",$Cat);<br /><br /> $query = "<br /> SELECT B_Number<br /> FROM {$config['tbprefix']}Posts<br /> WHERE B_Board = '$forum'<br /> ORDER BY B_Number DESC LIMIT 1<br /> ";<br /> $sth = $dbh -> do_query($query);<br /> list($Last) = $dbh -> fetch_array($sth);<br /> if ($Last < 1) { $Last = 1; }<br /><br /> $query = "<br /> SELECT U_Number, U_Username<br /> FROM {$config['tbprefix']}Users<br /> WHERE U_Number > 2<br /> ";<br /> $sth = $dbh -> do_query($query);<br /> while ($row = $dbh -> fetch_array($sth)) {<br /> list ($uid, $username) = $row;<br /> print "Adding user $username (#$uid)...<br />";<br /> $query = "<br /> INSERT INTO {$config['tbprefix']}Subscribe<br /> (S_Uid, S_Board, S_Last)<br /> VALUES ($uid, '$forum', $Last)<br /> ";<br /> $sth2 = $dbh -> do_query($query);<br /> }<br /><br />// ---------------<br />// Send the footer<br /> $html -> send_footer();<br />?><br />