Jump to content

how to detect which page im on


divinedesigns1
 Share

Recommended Posts

hey so i had this topic up here before but cant find it.

does anyone know how i can go about detecting the webpage im on using php?

Link to comment
Share on other sites

  • 2 weeks later...

you can try this 

<html>
	<head></head>
		
		
		<title>File System Basics</title>
		
		

		<h1>File System Basic</h1></div>	


<?php
	
	/*this will echo out the fullpath and file name if it exsist*/
	echo "<i><b>This Is The File Name And Locations 'AKA' fullpath.</b></i><br/>";
    echo __FILE__."<br/><hr/>";
	
	/*this echos out the directory  name if it exsist*/
	echo "<i><b>These Are The Directory Names Where The File Lives</b></i><br/>";   
	echo __DIR__."<br/><hr/>";  	
	
	/*this will echo out the directory name and file name if it exsist*/
	echo"<i><b>Does File Exsit?.</b></i><br/>";
	echo file_exists(__FILE__)? 'yes':'no';
	echo"<br/><hr/>";
	
	echo"<i><b>does the directory include the file basic.html?.</b></i><br/>";
	echo file_exists(dirname(__FILE__)."/basic.html")?'yes' : 'no';
	echo"<br/><hr/>";	
	
	echo"<i><b>Does the file  Exsist?.</b></i><br/>";
	echo is_file(dirname(__FILE__)."/basic.html")? 'yes' : 'no';
	echo"<br/><hr/>";
	
	echo"<i><b>Is File A Directory Name  ?.</b></i><br/>";
	echo is_file(dirname(__FILE__))? 'yes' : 'no';
	echo"<br/><hr/>";
	
	echo"<i><b>is Directory A File Name  ?.</b></i><br/><br/>";
	echo is_dir(dirname(__FILE__). "/basic.html")? 'yes' : 'no';
	echo"<br/><hr/>";
	echo "<i><b>Is .. A directory</b></i><br/>";
	echo is_dir('..')? 'yes' : 'no';
	echo"<br/><hr/>";
	
	/*this will echo out the number of lines being used*/
	echo"<i><b>How Many Line Are In File Basic.php Right Now.</b></i><br/>";
	echo __LINE__."<br/><hr/>";	
	?>

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...