i wana little bit help about url encryption(md5) or any other ecryption i have two files 1: index.php 2: premium.php i want to access premium.php with url encryption like md5 or any other encryption with in index.php via iframe or any other method. if user directly access the premium.php file the message will show to user "Access Denied!". user can access premium.php via index.php directly without username and password . mean index.php show the data of premium.php in encryption format and url of premium.php in the index.php file also encrypted user cannot copy my link hope you understand and help me thank you so much
I would advise the following method. In your index.php file use the following code: $salt = "38149"; $hash = md5( $salt ); include "premium.php"; PHP: In your premium.php use this code: if( $hash != md5( $salt ) ) { echo "Access Denied"; } else { echo "put your premium content here."; } PHP: That way if anyone goes to url.com/premium.php it will deny access. If they go to index.php they will be allowed to view premium.php. Hope it helps.
Thank you so much for reply may you live long.... well dear respected sir is there possible my premium content also in encryption format if user check the page source there is show only encrypted format content. in actual i have a flash player with my ads i want user cannot access my video file without ads or cannot get actual video file link to post in their website and paste his own ad on it. i want user cannot access the original video link. user only iframe the video link and my ads on flash also going with that link. sorry my english is too bad hope you understand my logic
In your premium.php, the code I posted, if you put your content in the bit that says: echo "put your premium content here."; Example: if( $hash != md5( $salt ) ) { echo "Access Denied"; } else { // Here you can put your premium content. } PHP: Then if anyone tries and accesses your page without index.php they will get an access deined message.
Here's an example of how to make the url to work only once. index.php: <?php session_start(); $secret = md5(rand(0,9999999)); $_SESSION['secret'] = $secret; $premiumUrl = 'premium.php?s=' .$secret; echo '<iframe src="' .$premiumUrl. '"></iframe>'; ?> PHP: premium.php: <?php session_start(); $secret = $_GET['s']; if($_SESSION['secret']!=$secret) die("access denied"); session_destroy(); ?> premium content here PHP:
Thank you so much respected Geforce & Arttu. Dear Arttu when i run index.php url show in iframe like this "http://localhost/premium/premium.php?" this link work only one time that's good thank you but there is a big problem when i use only link "http://localhost/premium/premium.php" without session id it shows the premium content directly. how can i fix it??
Sorry about that, this should work: <?php session_start(); $secret = $_GET['s']; if($_SESSION['secret']!=$secret||empty($_SESSION['secret'])) die("access denied"); session_destroy(); ?> premium content Code (markup):