Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

[php] Path Question


  • Please log in to reply
3 replies to this topic

#1 Nikas

Nikas

  • Members
  • 650 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Singapore
  • Local time:11:53 AM

Posted 26 April 2007 - 11:19 PM

Hi,

I have problem with this statement.

(dirname($tmp_thispath) == '/')?'./logon':'../logon';

$tmp_thispath refers to /starcom/index.php

does dirname means that get the directory of /starcom/index.php ? which is /starcom

Now, what does this mean > (dirname($tmp_thispath) == '/'). The bold part i not sure what is it referring to.

And what is the differences between ./logon and ../logon?

Anyone can clarify my doubt?




/Nikas

BC AdBot (Login to Remove)

 


#2 Nikas

Nikas
  • Topic Starter

  • Members
  • 650 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Singapore
  • Local time:11:53 AM

Posted 27 April 2007 - 08:40 AM

Ah... I got it myself.

#3 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:09:53 PM

Posted 27 April 2007 - 08:42 AM

I don't suppose you would care to share your findings for the next person that comes along?

#4 Nikas

Nikas
  • Topic Starter

  • Members
  • 650 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Singapore
  • Local time:11:53 AM

Posted 27 April 2007 - 12:36 PM

Oops!

I'm not sure whether i can explain it correctly. I will try my best.

As $tmp_thispath refers to /starcom/index.php, when i use the function dirname it refers to /starcom folder.

Basically, (dirname($tmp_thispath) == '/') just refers to my URL being http://www.example.com/starcom

For, (dirname($tmp_thispath) == '/')?'./logon':'../logon';

It means, If directory of $tmp_thispath is equal to http://www.example.com/starcom.

The page will be directed to the current directory as shown ./logon and the URL will be http://www.example.com/starcom/logon

else

The page will be directed to the previous directory path as shown ../logon. For example, my URL is currently http://www.example.com/starcom/anything/. It will direct it to http://www.example.com/starcom/logon.

The differences between ./ and ../ is just referring to current or previous directory path.

I hope that i have explained it clearly and understandable.

I'm sorry that i did not state down how i manage to get it at that time, as i was too busy with changing my codes and stuff.

Cheers, :thumbsup:


/Nikas

Edited by Nikas, 27 April 2007 - 12:37 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users