0

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')

Edited by pritaeas: Added markdown.

3
Contributors
3
Replies
20
Views
4 Years
Discussion Span
Last Post by almostbob
0

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');

Edited by pritaeas: Fixed typo BASEPATHE.

0

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

Edited by almostbob

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.