FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » Variable
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Variable [message #27386] Tue, 06 September 2005 18:54 Go to next message
Melf is currently offline  Melf   Germany
Messages: 28
Registered: August 2005
Location: Germany
Karma: 0
Junior Member
Hello,

Where does the Fudforum put ( or safe ) the variable "$FUD_OPT_1" ?


Thx for your help.

Re: Variable [message #27387 is a reply to message #27386] Tue, 06 September 2005 20:12 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
It is stored in GLOBALS.php. Why are you asking?

Best regards.

Frank
Re: Variable [message #27405 is a reply to message #27386] Wed, 07 September 2005 09:32 Go to previous messageGo to next message
Melf is currently offline  Melf   Germany
Messages: 28
Registered: August 2005
Location: Germany
Karma: 0
Junior Member
Hello...

/**
   
     *  @return boolean TRUE => System is 
     *                          disabled.                     
     */
    function system_closed()
    {
        $closed = false;

        // Readout the status of the forum
        
         return $closed;
    }



Maybe u can help me top filout the missing function.

[Updated on: Wed, 07 September 2005 09:33]

Report message to a moderator

Re: Variable [message #27415 is a reply to message #27405] Wed, 07 September 2005 13:31 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
<?php
if (!($GLOBALS['FUD_OPT_1'] & 1)) {
exit(
"forum is disabled");
}
?>


FUDforum Core Developer
Re: Variable [message #27416 is a reply to message #27415] Wed, 07 September 2005 13:49 Go to previous messageGo to next message
Melf is currently offline  Melf   Germany
Messages: 28
Registered: August 2005
Location: Germany
Karma: 0
Junior Member
Ilia wrote on Wed, 07 September 2005 09:31

<?php
forum is disabled
");
?>



Thank you Smile

But,

Can't I put "$DISABLED_REASON" instead of that ? Because I it is maybe better, if I want to change the Message in the Admin Menu.

If I put that one you wrote in, I alwaz have to change the "forum is disabled", or not ?



and where do I have to put your Code in? Can you maybe show me the final Code ?

[Updated on: Wed, 07 September 2005 13:50]

Report message to a moderator

Re: Variable [message #27417 is a reply to message #27416] Wed, 07 September 2005 14:25 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
You can use $GLOBALS['DISABLED_REASON'], sure...

Put the code in the place of the comment inside your function.


FUDforum Core Developer
Re: Variable [message #27418 is a reply to message #27386] Wed, 07 September 2005 14:29 Go to previous messageGo to next message
Melf is currently offline  Melf   Germany
Messages: 28
Registered: August 2005
Location: Germany
Karma: 0
Junior Member
<?php
/**
     *  @return boolean TRUE => System ist gerade für
     *                          Wartungsarbeiten gesperrt.
     */
    function system_closed ()
	{
	$closed = true ;

if (!($GLOBALS['FUD_OPT_1'] & 1)) {
exit($GLOBALS['DISABLED_REASON']);
} 
          
return $closed;
	}
	?>


Like this?
Re: Variable [message #27420 is a reply to message #27418] Wed, 07 September 2005 14:34 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
yes.

FUDforum Core Developer
Re: Variable [message #27421 is a reply to message #27386] Wed, 07 September 2005 14:53 Go to previous messageGo to next message
Melf is currently offline  Melf   Germany
Messages: 28
Registered: August 2005
Location: Germany
Karma: 0
Junior Member
But when I fill the Code into the Index.php file and cut this part of the index.php instead, nothing does happen and I can still see the whole forum ( http://movie-fact.de/fuforum27/forum/index.php ). Do you know why?

	

	/* before we go on, we need to do some very basic activation checks */
	if (!($FUD_OPT_1 & 1)) {
		fud_use('errmsg.inc');
		exit($DISABLED_REASON . __fud_ecore_adm_login_msg);
	}
	if (!$FORUM_TITLE && @file_exists($WWW_ROOT_DISK.'install.php')) {
		fud_use('errmsg.inc');
	        exit(__fud_e_install_script_present_error);
	}

	if ($FUD_OPT_2 & 16384 && $t != 'getfile') {
		ob_start(array('ob_gzhandler', (int)$PHP_COMPRESSION_LEVEL));
	}

	if ($t == 'rview') {
		if (isset($_GET['th']) || isset($_GET['goto'])) {
			$t = $_GET['t'] = d_thread_view;
		} else if (isset($_GET['frm_id'])) {
			$t = $_GET['t'] = t_thread_view;
		} else {
			$t = $_GET['t'] = 'index';
		}
	} else if (ereg('[^a-z_]', $t) || !@file_exists($WWW_ROOT_DISK . fud_theme . $t . '.php')) {
		$t = 'index';
	}

	if ($FUD_OPT_2 & 524288 && isset($_COOKIE[$COOKIE_NAME.'1']) && $t != 'error') {
		fud_use('errmsg.inc');
		exit(__fud_banned__);
	}

[Updated on: Wed, 07 September 2005 14:54]

Report message to a moderator

Re: Variable [message #27422 is a reply to message #27421] Wed, 07 September 2005 14:57 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Did you load GLOBALS.php where the settings are found?

FUDforum Core Developer
Re: Variable [message #27423 is a reply to message #27386] Wed, 07 September 2005 15:17 Go to previous messageGo to next message
Melf is currently offline  Melf   Germany
Messages: 28
Registered: August 2005
Location: Germany
Karma: 0
Junior Member
i dont know what u mean.

look, i uploaded the file ( with the code u gave me ) to another place:

http://movie-fact.de/fuforum27/forum/test.php


But where is the Disabled-Message?
Re: Variable [message #27425 is a reply to message #27423] Wed, 07 September 2005 15:41 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
You need to add the following before your code:

include("/path/to/forum/GLOBALS.php");


Best regards.

Frank
Re: Variable [message #27426 is a reply to message #27423] Wed, 07 September 2005 16:43 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Not sure, I suspect the variable is not in the scope.

FUDforum Core Developer
Re: Variable [message #27428 is a reply to message #27386] Wed, 07 September 2005 17:59 Go to previous messageGo to next message
Melf is currently offline  Melf   Germany
Messages: 28
Registered: August 2005
Location: Germany
Karma: 0
Junior Member
Ilia, you are right, naudefj's tip doesnt work...

But what can I do instead?

[Updated on: Wed, 07 September 2005 17:59]

Report message to a moderator

Re: Variable [message #27454 is a reply to message #27386] Thu, 08 September 2005 17:22 Go to previous messageGo to next message
Melf is currently offline  Melf   Germany
Messages: 28
Registered: August 2005
Location: Germany
Karma: 0
Junior Member
no idea?
Re: Variable [message #27457 is a reply to message #27454] Thu, 08 September 2005 20:21 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Dunno, see what variables are available...

FUDforum Core Developer
Re: Variable [message #27460 is a reply to message #27386] Thu, 08 September 2005 20:46 Go to previous messageGo to next message
Melf is currently offline  Melf   Germany
Messages: 28
Registered: August 2005
Location: Germany
Karma: 0
Junior Member
which variables do u mean? these, which are in GLOBALS.php?
Re: Variable [message #27461 is a reply to message #27460] Thu, 08 September 2005 20:47 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
yeah.

FUDforum Core Developer
Re: Variable [message #27527 is a reply to message #27386] Sun, 11 September 2005 15:02 Go to previous messageGo to next message
Melf is currently offline  Melf   Germany
Messages: 28
Registered: August 2005
Location: Germany
Karma: 0
Junior Member
I think I know where ther Problem is:

require('./GLOBALS.php');


In this one.

Where to find this file?


Re: Variable [message #27528 is a reply to message #27527] Sun, 11 September 2005 17:10 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Inside the forum's include/ directory.

FUDforum Core Developer
Re: Variable [message #27532 is a reply to message #27386] Sun, 11 September 2005 17:21 Go to previous messageGo to next message
Melf is currently offline  Melf   Germany
Messages: 28
Registered: August 2005
Location: Germany
Karma: 0
Junior Member
When the code looks like that:

require('./GLOBALS.php');


It works..

But when the code look likes that ( and it has to do )

require('http://www.movie-fact.de/fuforum27/forum/include/GLOBALS.php');


It doesn't work...

Look here..thes error message comes:

http://movie-fact.de/fuforum27/forum/index.php


Maybe u know what to do ?

[Updated on: Sun, 11 September 2005 17:21]

Report message to a moderator

Re: Variable [message #27534 is a reply to message #27532] Sun, 11 September 2005 17:23 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
You cannot open .php remotely, since you'll get the executed result (empty page) rather the the script.

FUDforum Core Developer
Re: Variable [message #27537 is a reply to message #27386] Sun, 11 September 2005 18:07 Go to previous messageGo to next message
Melf is currently offline  Melf   Germany
Messages: 28
Registered: August 2005
Location: Germany
Karma: 0
Junior Member
Ok, but do you have an idea, what i can do instead?

the result must be a script, wich shall be inlcuded in another script....so when the forum is offline, the script has to be offline too...
Re: Variable [message #27548 is a reply to message #27537] Mon, 12 September 2005 14:03 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
The GLOBALS.php file is always available no matter if the forum is online or offline.

FUDforum Core Developer
Re: Variable [message #27553 is a reply to message #27386] Mon, 12 September 2005 14:30 Go to previous messageGo to next message
Melf is currently offline  Melf   Germany
Messages: 28
Registered: August 2005
Location: Germany
Karma: 0
Junior Member
Do u so have an idea, how I can avoid the error-message and make the script i am building running again?
Re: Variable [message #27556 is a reply to message #27553] Mon, 12 September 2005 14:37 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Make sure you include GLOBALS.php from disk.

FUDforum Core Developer
Re: Variable [message #27559 is a reply to message #27386] Mon, 12 September 2005 14:54 Go to previous messageGo to next message
Melf is currently offline  Melf   Germany
Messages: 28
Registered: August 2005
Location: Germany
Karma: 0
Junior Member
look

I create a knew php file for ex. test.php

Then I put exactly the same Code in the test.php file as in index.php

<?php
	/**
*  Gibt den Status zurück, ob das System gerade zu
*  Wartungsarbeiten gesperrt ist.
*
*  @return boolean TRUE => System ist gerade für
*                          Wartungsarbeiten gesperrt.
*/
require('./GLOBALS.php');



	fud_use('err.inc');

	/* before we go on, we need to do some very basic activation checks */
	if (!($FUD_OPT_1 & 1)) {
		fud_use('errmsg.inc');
		exit($DISABLED_REASON);
	}

          

/* this is needed to determine what extension to use for alpha-transparency images */
	if (!empty($_SERVER['HTTP_USER_AGENT']) && 
		strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE') !== false && 
		strpos($_SERVER["HTTP_USER_AGENT"], 'Opera') === false) {
		define('img_ext', '.gif');
	} else {
		define('img_ext', '.png');
	}

	require($WWW_ROOT_DISK . fud_theme . $t . '.php');
?>


What now happen is that index.php runs, but test.php not:

http://movie-fact.de/fuforum27/forum/test.php

http://movie-fact.de/fuforum27/forum/index.php


Why does the Error-Message in test.php come?

Her it is:

Quote:

Warning: main(): SAFE MODE Restriction in effect. The script whose uid is 1126 is not allowed to access ./GLOBALS.php owned by uid 30 in /home/www/web199/html/fuforum27/forum/test.php on line 9

Warning: main(./GLOBALS.php): failed to open stream: Success in /home/www/web199/html/fuforum27/forum/test.php on line 9

Warning: main(): SAFE MODE Restriction in effect. The script whose uid is 1126 is not allowed to access ./GLOBALS.php owned by uid 30 in /home/www/web199/html/fuforum27/forum/test.php on line 9

Warning: main(./GLOBALS.php): failed to open stream: Success in /home/www/web199/html/fuforum27/forum/test.php on line 9

Fatal error: main(): Failed opening required './GLOBALS.php' (include_path='.:/usr/share/php') in /home/www/web199/html/fuforum27/forum/test.php on line 9


And how to avoid the error ?
Re: Variable [message #27561 is a reply to message #27559] Mon, 12 September 2005 14:57 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
You need to make your script owned by the webserver user or disable safe_mode.

FUDforum Core Developer
Re: Variable [message #27562 is a reply to message #27386] Mon, 12 September 2005 15:01 Go to previous messageGo to next message
Melf is currently offline  Melf   Germany
Messages: 28
Registered: August 2005
Location: Germany
Karma: 0
Junior Member
Quote:

You need to make your script owned by the webserver user


How can I do that ?

Quote:

disable safe_mode.


But the index.php must have an acces, why cant i create an acces for test.php?

Because safe-Mode is mor safe against hackers, isnt it?
Re: Variable [message #27563 is a reply to message #27386] Mon, 12 September 2005 15:33 Go to previous message
Melf is currently offline  Melf   Germany
Messages: 28
Registered: August 2005
Location: Germany
Karma: 0
Junior Member
I have found the problem and it works now..

thank u for your good help Smile
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: body mangling - regex
Next Topic: How to sort for popular topics
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 22:33:35 GMT 2024

Total time taken to generate the page: 0.02504 seconds