3 * Special Ops One message boards
4 * Copyright © 2002-2005 Anthony Parsons
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * See file docs/LICENSE for full license terms.
25 if ( version_compare(PHP_VERSION
, '5.0', '<') ) {
26 header('HTTP/1.1 500 Internal Server Error');
27 die('PHP 5.0 or higher is required.');
30 error_reporting(E_ALL|E_STRICT
);
33 require 'include/sqlconn.php';
35 // Timer thing at bottom of page
36 define('START_TIME', microtime(1));
40 'name' => 'MINESWEEPERBOARDOJ',
47 '<img src="imglib/add" alt="Added '.$strings['cookies'].'" class="imgadd"/>',
48 '<img src="imglib/take" alt="Taken '.$strings['cookies'].'" class="imgtake"/>',
49 '<img src="imglib/closed" alt="*Closed*" class="imgclose"/>',
50 '<img src="imglib/deleted" alt="*Deleted*" class="imgdel"/>'
53 //custom header strings
54 $cfg['headers'] = array(
55 'Text-Only' => 'Special Ops Boards'
58 $cfg['headers2'] = array_values($cfg['headers']);
61 $cfg['levels'] = array(
64 -1 => 'SUSPENDED_USER',
78 foreach ( $cfg['levels'] as $number => $level )
79 define($level, $number);
82 if ( isset($_COOKIE['userid'], $_COOKIE['password']) )
83 $u = mysql_fetch_assoc(mysql_unbuffered_query('SELECT * FROM `users` WHERE `user` = '.intval($_COOKIE['userid']).' LIMIT 1'));
85 isset($_SERVER['HTTP_USER_AGENT']) ?
null : $_SERVER['HTTP_USER_AGENT'] = '-';
87 if ( !empty($u) && $u['password'] === $_COOKIE['password'] ) {
89 $userinfo['level'] = intval($userinfo['level']);
90 mysql_query('UPDATE `users` SET
91 `last_active` = NOW(),
92 `last_ip` = INET_ATON(\''.$_SERVER['REMOTE_ADDR'].'\'),
93 `useragent` = \''.mysql_real_escape_string(htmlentities($_SERVER['HTTP_USER_AGENT'])).'\'
94 WHERE `user` = '.$userinfo['user'].' LIMIT 1');
96 $userinfo['timeoffset'] = $userinfo['timezone'] * 3600; //bitfields are gay
100 setcookie('userid', '-', 1);
101 setcookie('password', '-', 1);
102 $userinfo = array('header' => 0, 'timezone' => 0, 'topics_page' => 35, 'messages_page' => 35, 'level' => PENDING_EMAIL
);
105 /* Global Functions */
110 return '"c'.(1+
(++
$c&1)).'"';
114 function date2($timestamp = 0)
117 if ( empty($userinfo['dateformat']) )
118 return gmdate('Y-m-d H:i:s', $timestamp +
$userinfo['timezone']);
119 return gmdate($userinfo['dateformat'], $timestamp +
$userinfo['timezone']);
123 function stop ($msg = '')
126 trigger_error('Use of stop() is deprecated - echo the message and call footer() directly', E_USER_WARNING
);
127 print_r(debug_backtrace());
131 $urlstring = isset($_GET['b']) ?
'b='.intval($_GET['b']).( isset($_GET['t']) ?
';t='.intval($_GET['t']) : '' ) : '';
132 define('URL_STRING', '?'.$urlstring);
133 define('URL_APPEND', ';'.$urlstring);
135 // Returns idletime (not used much now)
136 function idletime($lastsec)
138 return(time() - $lastsec > 86400 ?
floor((time() - $lastsec) / 86400).'d ' : '').gmdate('G\hi\ms\s', time() - $lastsec);
141 // Makes userids into links
142 function userlink($id, $name = null)
150 if ( empty($users[$id]) )
152 list($users[$id]) = mysql_fetch_row(mysql_query('SELECT `name` FROM `users` WHERE `user` = '.intval($id)));
155 if ( empty($userinfo['user']) )
158 return '<a href="whois?u='.$id.URL_APPEND
.'">'.$users[$id].'</a>';
166 <p
><a href
="http://specialops.ath.cx/">Special Ops
1.25-dev
</a
> |
167 <?php
echo round(microtime(1) - START_TIME
, 4) ?
>s |
168 ©
2003-2005 <a href
="http://specialops.ath.cx/contact">Ant P
</a
></p
>