Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x
Author Message
neralex
Site Admin



Joined: Aug 22, 2007
Posts: 1775

PostPosted: Wed Jun 13, 2012 10:20 am Reply with quote

In the hope you do not send thousands of Lemmings to me ... Smile

I have a small module and its placed in home. Now i have tried to make it not possible to surf on the module directly, if its placed in home.

I tried this one in the index.php of the module:

Code:
list($main_module) = $db->sql_fetchrow($db->sql_query('SELECT main_module FROM ' . $prefix . '_main'));

if ($main_module == $module_name) {
   $mod_rawurl =(isset($_SERVER['HTTPS'])?'https':'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
   $module_link = (isset($_SERVER['HTTPS'])?'https':'http') . '://' . $nukeurl . '/modules.php?name=' . $module_name;
   if ($mod_rawurl == $module_link) {
      Header('Location: ./');   
      exit;         
   }
}


It works but my question is: give it an easier way to do this?

Laughing


Last edited by neralex on Wed Jun 13, 2012 10:56 am; edited 3 times in total 
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team



Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Wed Jun 13, 2012 10:50 am Reply with quote

I haven't tried this but it might work...

Code:
if (defined('HOME_FILE')) {

  // your module content
} else {
  // code for exit
}


or

Code:
if (!defined('HOME_FILE')) {

  // code for exit
}
 
View user's profile Send private message Visit poster's website
neralex







PostPosted: Wed Jun 13, 2012 10:54 am Reply with quote

spasticdonkey, it works! thanks!! Smile

RavensScripts
 
neralex







PostPosted: Wed Jun 13, 2012 11:19 am Reply with quote

Code:
if (!defined('HOME_FILE')) {   

   if (!is_admin($admin)) {   
      Header('Location: ./');   
      exit;
   }
}


Now can surf admins only on the module directly. All other jumps back on the index!

This is realy cool! Smile
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©