Home arrow Forum Forum Direct access [solved]
  Welcome, Guest. Please login or register.
Did you miss your activation email?
December 02, 2008, 06:28:30 PM
Home New Posts Search Calendar


Login with username, password and session length
+  Joomla Forum
|-+  Joomla Hacks
| |-+  Joomla-SMF Forum Support
| | |-+  Joomla-SMF 2.0.x (Moderators: -Wolverine, kai920)
| | | |-+  Forum Direct access [solved]
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: Forum Direct access [solved]  (Read 2085 times)
Marco
Joomla Newbie
*

Karma: +0/-3
Offline Offline

Posts: 32


View Profile
Forum Direct access [solved]
« on: December 09, 2007, 05:48:00 PM »

Please, someone can suggest me how do prevent direct access to the forum?
my forum is bridged and i would like tu prevent access like www.site.com/smf/index.php

i remember a 3d here, i tried to search it but i diden't find the post...
thanks in advance...

joomla 1.0.13
jsmf bridge
smf 1.1.4
« Last Edit: December 29, 2007, 07:22:27 AM by Marco » Logged

Joomla 1.0.12 - SMF 1.1.1 - JSMF 2.0.1 - CB none - PHP 4.4.4 - MySQL 4.0.27.
dafebe
Joomla Newbie
*

Karma: +1/-0
Offline Offline

Posts: 32


View Profile
Re: Forum Direct access
« Reply #1 on: December 09, 2007, 06:54:49 PM »

Hi you must put this

Code:
// Redirect users who try to access /forum directly
if (strpos($_SERVER['QUERY_STRING'], 'dlattach') === false &&
    strpos($_SERVER['QUERY_STRING'], 'verificationcode') === false &&
    strpos($_SERVER['QUERY_STRING'], 'action=post2') === false &&
    strpos($_SERVER['QUERY_STRING'], 'action=spellcheck') === false &&
    strpos($_SERVER['QUERY_STRING'], 'action=splittopics') === false &&
    strpos($_SERVER['QUERY_STRING'], 'action=stats') === false)
{
    if(!defined('_VALID_MOS')){ header("Location: /index.php?option=com_smf&Itemid=3&".$_SERVER['QUERY_STRING']); }
}

after
Code:
<?php
/**********************************************************************************
* index.php                                                                       *
***********************************************************************************
* SMF: Simple Machines Forum                                                      *
* Open-Source Project Inspired by Zef Hemel (zef@zefhemel.com)                    *
* =============================================================================== *
* Software Version:           SMF 1.1.4                                           *
* Software by:                Simple Machines (http://www.simplemachines.org)     *
* Copyright 2006-2007 by:     Simple Machines LLC (http://www.simplemachines.org) *
*           2001-2006 by:     Lewis Media (http://www.lewismedia.com)             *
* Support, News, Updates at:  http://www.simplemachines.org                       *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under   *
* the terms of the provided license as published by Simple Machines LLC.          *
*                                                                                 *
* This program is distributed in the hope that it is and will be useful, but      *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY    *
* or FITNESS FOR A PARTICULAR PURPOSE.                                            *
*                                                                                 *
* See the "license.txt" file for details of the Simple Machines license.          *
* The latest version can always be found at http://www.simplemachines.org.        *
**********************************************************************************/


/* This, as you have probably guessed, is the crux on which SMF functions.
Everything should start here, so all the setup and security is done
properly.  The most interesting part of this file is the action array in
the smf_main() function.  It is formatted as so:

'action-in-url' => array('Source-File.php', 'FunctionToCall'),

Then, you can access the FunctionToCall() function from Source-File.php
with the URL index.php?action=action-in-url.  Relatively simple, no?
*/

this work but insert quote form Topic Summary do't work for me Sad

cmq dal nome mi sa che sei italiano Cool
Logged
dafebe
Joomla Newbie
*

Karma: +1/-0
Offline Offline

Posts: 32


View Profile
Re: Forum Direct access
« Reply #2 on: December 09, 2007, 07:13:28 PM »

Look here
« Last Edit: December 10, 2007, 04:54:03 AM by dafebe » Logged
Superdaantje
Joomla Guru
*****

Karma: +266/-23
Offline Offline

Posts: 370


Aka Livebox


View Profile WWW
Re: Forum Direct access
« Reply #3 on: December 10, 2007, 03:30:26 AM »

http://www.simplemachines.org/community/index.php?topic=81152.msg541379#msg541379
There went somthing wrong above so here is the same link with no tags
Logged

My Projects
Joomlabridge.org JSMF 2.0.2.1 Bridge Support and Downloads
Dutchjoomla.org Dutch Joomla Community (more then 60.000 members)
D.Wagner Webservices
dafebe
Joomla Newbie
*

Karma: +1/-0
Offline Offline

Posts: 32


View Profile
Re: Forum Direct access
« Reply #4 on: December 10, 2007, 04:59:50 AM »

hehe sorry  Wink
Logged
Marco
Joomla Newbie
*

Karma: +0/-3
Offline Offline

Posts: 32


View Profile
Re: Forum Direct access
« Reply #5 on: December 15, 2007, 05:30:04 PM »

Ok, tks... it works!!

i've added the code:

Code:
// Redirect users who try to access /forum directly
if (strpos($_SERVER['QUERY_STRING'], 'dlattach') === false && strpos($_SERVER['QUERY_STRING'], 'verificationcode') === false)
{
        if(!defined('_VALID_MOS')){ header("Location: /index.php?option=com_smf&Itemid=yourItemidNum&".$_SERVER['QUERY_STRING']); }
}

i have only 2 problems:
the preview function won't works
i get a lot of errors in the errors log like:

/smf/index.php?option=com_smf&amp;Itemid=1274&amp;topic=20852.0 
2: Cannot modify header information - headers already sent
File: /var/www/vhosts/thegunners.it/httpdocs/templates/pda/index.php
Linea: 64

and:

/smf/index.php?option=com_smf&amp;Itemid=1274&amp;action=post2;board=1;preview;xml 
8: Undefined offset: 0
File: /var/www/vhosts/thegunners.it/httpdocs/components/com_smf/smf.class.php
Linea: 449

is there a way to fix it?
thanks in advance...


PS: si.. sono italiano  Wink





« Last Edit: December 15, 2007, 05:35:51 PM by Marco » Logged

Joomla 1.0.12 - SMF 1.1.1 - JSMF 2.0.1 - CB none - PHP 4.4.4 - MySQL 4.0.27.
Marco
Joomla Newbie
*

Karma: +0/-3
Offline Offline

Posts: 32


View Profile
Re: Forum Direct access
« Reply #6 on: December 20, 2007, 03:27:53 AM »

Please, any suggestion?
Logged

Joomla 1.0.12 - SMF 1.1.1 - JSMF 2.0.1 - CB none - PHP 4.4.4 - MySQL 4.0.27.
Marco
Joomla Newbie
*

Karma: +0/-3
Offline Offline

Posts: 32


View Profile
Re: Forum Direct access [solved]
« Reply #7 on: December 29, 2007, 07:21:40 AM »

Ok, i fixed it.

the right code (works well without errors) i used is in the lines below:

Code:
// Redirect users who try to access /forum directly
if (strpos($_SERVER['QUERY_STRING'], 'dlattach') === false &&
    strpos($_SERVER['QUERY_STRING'], 'verificationcode') === false &&
    strpos($_SERVER['QUERY_STRING'], 'action=post2') === false &&
    strpos($_SERVER['QUERY_STRING'], 'action=spellcheck') === false &&
    strpos($_SERVER['QUERY_STRING'], 'action=splittopics') === false &&
    strpos($_SERVER['QUERY_STRING'], 'action=stats') === false)
{
    if(!defined('_VALID_MOS')){ header("Location: /index.php?option=com_smf&Itemid=(****)&".$_SERVER['QUERY_STRING']); }
}

where (****) is your item id number
Logged

Joomla 1.0.12 - SMF 1.1.1 - JSMF 2.0.1 - CB none - PHP 4.4.4 - MySQL 4.0.27.
RJ
Joomla Newbie
*

Karma: +1/-2
Offline Offline

Posts: 34


View Profile WWW
Re: Forum Direct access [solved]
« Reply #8 on: January 04, 2008, 09:44:10 AM »

Ok, i fixed it.

the right code (works well without errors) i used is in the lines below:

Code:
// Redirect users who try to access /forum directly
if (strpos($_SERVER['QUERY_STRING'], 'dlattach') === false &&
    strpos($_SERVER['QUERY_STRING'], 'verificationcode') === false &&
    strpos($_SERVER['QUERY_STRING'], 'action=post2') === false &&
    strpos($_SERVER['QUERY_STRING'], 'action=spellcheck') === false &&
    strpos($_SERVER['QUERY_STRING'], 'action=splittopics') === false &&
    strpos($_SERVER['QUERY_STRING'], 'action=stats') === false)
{
    if(!defined('_VALID_MOS')){ header("Location: /index.php?option=com_smf&Itemid=(****)&".$_SERVER['QUERY_STRING']); }
}

where (****) is your item id number
I just implemented this code and it works well on my site... a little too well! The wap functionality is now "broken". Trying to access the site via my mobile now attempts to load the forum in the wrapper. It makes sense of course, but is there a way to add code to make the exception for wap?
Logged

RJ
Atlanta, GA
fortistr
Joomla Newbie
*

Karma: +0/-1
Offline Offline

Posts: 15


View Profile
Re: Forum Direct access [solved]
« Reply #9 on: March 10, 2008, 11:14:21 PM »

qute and preview function brokenn
Logged
Marco
Joomla Newbie
*

Karma: +0/-3
Offline Offline

Posts: 32


View Profile
Re: Forum Direct access [solved]
« Reply #10 on: March 11, 2008, 05:04:43 AM »

I just implemented this code and it works well on my site... a little too well! The wap functionality is now "broken". Trying to access the site via my mobile now attempts to load the forum in the wrapper. It makes sense of course, but is there a way to add code to make the exception for wap?

i dont't know if it is possibile but, i've seen a special component with a special template for mobile access on the joomla website.... you can try...
Logged

Joomla 1.0.12 - SMF 1.1.1 - JSMF 2.0.1 - CB none - PHP 4.4.4 - MySQL 4.0.27.
Stef
Joomla Newbie
*

Karma: +1/-1
Offline Offline

Posts: 5


View Profile
Re: Forum Direct access [solved]
« Reply #11 on: March 17, 2008, 07:05:45 PM »

Ok, i fixed it.

the right code (works well without errors) i used is in the lines below:

Code:
// Redirect users who try to access /forum directly
if (strpos($_SERVER['QUERY_STRING'], 'dlattach') === false &&
    strpos($_SERVER['QUERY_STRING'], 'verificationcode') === false &&
    strpos($_SERVER['QUERY_STRING'], 'action=post2') === false &&
    strpos($_SERVER['QUERY_STRING'], 'action=spellcheck') === false &&
    strpos($_SERVER['QUERY_STRING'], 'action=splittopics') === false &&
    strpos($_SERVER['QUERY_STRING'], 'action=stats') === false)
{
    if(!defined('_VALID_MOS')){ header("Location: /index.php?option=com_smf&Itemid=(****)&".$_SERVER['QUERY_STRING']); }
}

where (****) is your item id number
Works very well for me !!! Thank you
Logged
Pages: [1] Go Up Print 
« previous next »
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Joomla Forum | Powered by SMF 1.1 RC1.
© 2001-2005, Lewis Media. All Rights Reserved.
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!

Joomla Hacks is a Joomla Components, Joomla Modules, Joomla Templates, & Joomla Mambots resource portal. None of the text or images in this public website may be copied without the expressed written consent of the authors. Copyright 2005 by JoomlaHacks.com. Powered by Joomla. All rights reserved.
Terms of Use
Joomla Hacks



Joomla Hacks
German Lang French Lang Italian Lang Spanish Lang Japanese Lang Chinese Lang
Search Contact About Advertise Blogs Topsites Submit News Register Login