i have this code so to hinder from access when the url is directly type
i understand BASEPATH is a constant but can anyone give me idea on how to cofigure the basepath? do i need to create a constant folder and constant php file?

if (! defined('BASEPATH')) exit('No direct script access allowed')

is this what you mean?
main.php

define ('BASEPATH', 'calling from main');
include ('include.php');

include.php

if (! defined('BASEPATH')) exit('No direct script access allowed');

another approach to the same idea

<?php
if(!strpos(strtolower($_SERVER['HTTP_REFERER']),'mydomainname')){
echo <<<EOT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="refresh" content="10;URL=/"> </head>
<body style="text-align:center;"><a title=" someone is stealing our stuff " href="http://www.mydomain/">
<img src="http://pics.mydomain/nohotlink.jpg" width="80%" alt="no"><br>
We appreciate your interest in our programs, you should get them from the source.</a></body></html>
EOT;
exit('Die');
} ?>

no hot link, could be any of these google search images

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.