-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforumlink.php
More file actions
85 lines (76 loc) · 2.57 KB
/
forumlink.php
File metadata and controls
85 lines (76 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/***************************************************************************
* forumlink.php
* -----------------
* begin : Vendredi 15 Septembre 2006
* copyright : crewstyle - http://crewstyle.free.fr <crewstyle@free.fr>
* version : 2.0.7 - 01/10/2006 13:31
*
* $Id : forumlink.php, v 2.0.7 - 01/10/2006 13:31 - crewstyle Exp $
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if (defined('IN_PHPBB'))
{
die('Hacking attempt');
exit;
}
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.' . $phpEx);
//
// Start initial var setup
//
if ( isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]) )
{
$forum_id = ( isset($HTTP_GET_VARS[POST_FORUM_URL]) ) ? intval($HTTP_GET_VARS[POST_FORUM_URL]) : intval($HTTP_POST_VARS[POST_FORUM_URL]);
}
else if ( isset($HTTP_GET_VARS['forum']))
{
$forum_id = intval($HTTP_GET_VARS['forum']);
}
else
{
$forum_id = '';
}
$sql = 'SELECT forum_link
FROM ' . FORUMS_TABLE . '
WHERE forum_id=' . $forum_id;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain forum information', '', __LINE__, __FILE__, $sql);
}
if ( !($row = $db->sql_fetchrow($result)) )
{
message_die(GENERAL_MESSAGE, 'This forum doesn\'t exist !');
}
if( !empty($row['forum_link']) )
{
$sql = 'UPDATE ' . FORUMS_TABLE . '
SET forum_link_count=forum_link_count+1
WHERE forum_id=' . $forum_id;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update forum information', '', __LINE__, __FILE__, $sql);
}
$forum_link = ( (!preg_match('#^(http|ftp):\/\/#i', $row['forum_link'])) ? 'http://' : '') . $row['forum_link'];
$header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE') ) ) ? 'Refresh: 0; URL=' : 'Location: ';
header($header_location . append_sid($forum_link, true) );
exit();
}
else
{
$header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE') ) ) ? 'Refresh: 0; URL=' : 'Location: ';
header($header_location . append_sid("index.$phpEx", true) );
exit();
}
$db->sql_freeresult($result);
?>