hi All,
does anyone knows what does mean

define('INCLUDE_CHECK',true);

below is full script

define('INCLUDE_CHECK',true);

require 'connect.php';
require 'functions.php';

// Those two files can be included only if INCLUDE_CHECK is defined

session_name('tzLogin');
// Starting the session

session_set_cookie_params(2*7*24*60*60);
// Making the cookie live for 2 weeks

session_start();

if($_SESSION['id'] && !isset($_COOKIE['tzRemember']) && !$_SESSION['rememberMe'])
{
	// If you are logged in, but you don't have the tzRemember cookie (browser restart)
	// and you have not checked the rememberMe checkbox:

	$_SESSION = array();
	session_destroy();

	// Destroy the session
}

if(isset($_GET['logoff']))
{
	$_SESSION = array();
	session_destroy();
	header("Location: demo.php");
	exit;
}

if($_POST['submit']=='Login')
{
	// Checking whether the Login form has been submitted

	$err = array();
	// Will hold our errors

	if(!$_POST['username'] || !$_POST['password'])
		$err[] = 'All the fields must be filled in!';

	if(!count($err))
	{
		$_POST['username'] = mysql_real_escape_string($_POST['username']);
		$_POST['password'] = mysql_real_escape_string($_POST['password']);
		$_POST['rememberMe'] = (int)$_POST['rememberMe'];

		// Escaping all input data

		$row = mysql_fetch_assoc(mysql_query("SELECT id,usr FROM tz_members WHERE usr='{$_POST['username']}' AND pass='".md5($_POST['password'])."'"));

		if($row['usr'])
		{
			// If everything is OK login

			$_SESSION['usr']=$row['usr'];
			$_SESSION['id'] = $row['id'];
			$_SESSION['rememberMe'] = $_POST['rememberMe'];

			// Store some data in the session

			setcookie('tzRemember',$_POST['rememberMe']);
			// We create the tzRemember cookie
		}
		else $err[]='Wrong username and/or password!';
	}

	if($err)
		$_SESSION['msg']['login-err'] = implode('<br />',$err);
		// Save the error messages in the session

	header("Location: demo.php");
	exit;
}

thanks in advance for attention

Well the comment in the file says it all I guess:

require 'connect.php';
require 'functions.php';

// Those two files can be included only if INCLUDE_CHECK is defined

You can think of INCLUDE_CHECK as a "variable". The define('INCLUDE_CHECK',true); assigns the value "true" to the variable INCLUDE_CHECK. There's probably somesort of check in the two included files to see if INCLUDE_CHECK has been set.

but i didnt understand correctly. but here what does it mean. this is connect.php file

<?php

if(!defined('INCLUDE_CHECK')) die('You are not allowed to execute this file directly');


/* Database config */

$db_host		= '';
$db_user		= '';
$db_pass		= '';
$db_database	= ''; 

/* End config */



$link = mysql_connect($db_host,$db_user,$db_pass) or die('Unable to establish a DB connection');

mysql_select_db($db_database,$link);
mysql_query("SET names UTF8");

?>

thank you for attention

This line :

if(!defined('INCLUDE_CHECK')) die('You are not allowed to execute this file directly');

means that if you didn't define "INCLUDE_CHECK", the script should die(). So if you were to remove the line define('INCLUDE_CHECK',true); from your first file, you would get the message 'You are not allowed to execute this file directly'.
It's a sort of protection for php-script files in this case.

define('INCLUDE_CHECK',true);

This is called constant in php. this means INCLUDE_CHECK=true
INCLUDE_CHECK value is true throughout the scope of this page.

define('INCLUDE_CHECK',true);

This is called constant in php. this means INCLUDE_CHECK=true
INCLUDE_CHECK value is true throughout the scope of this page.

what does it mean true throughout the scope of this page? Can you explain it to me if possible. what does mean out of the scope of the page? Thanks all for attention and help

what does it mean true throughout the scope of this page? Can you explain it to me if possible. what does mean out of the scope of the page? Thanks all for attention and help

If you define a constant in one page like

define('PI',3.14);

then you can use that variable PI anywhere of that page. Its value can't be changed.

but is there possibility to get changed include_check=true to include_check=false?

Yes. Just leave the line out (as mentioned before) or define('INCLUDE_CHECK',false);

This is the syntax of define()
bool define ( string $name , mixed $value [, bool $case_insensitive = false ] )
It is somewhat similar to #define in c,c++
it is used to define the value to a variable and is used throughout the scope....
For more details....
To get reference about define click here....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.