Solved

fileperms decoct gives wrong value

Posted on 2007-11-26
4
200 Views
Last Modified: 2013-12-13
hi

am stuck when tring to find the chmod value of a file its giving me a strange number

this is the code am using

echo decoct(fileperms($baseDir . '/' . myfile.php') ) ;     //this is set to 644  octal is 1204
which gives me 100644

then when i try to take away the 10000 to leave 644 it gives me this 55224

heres the code i use

echo decoct(fileperms($baseDir . '/' . myfile.php')- 10000 ) ;  

any ideas why its not showing 644 when i take the 10000 away?

regards pete









0
Comment
Question by:peter2001
  • 3
4 Comments
 
LVL 9

Expert Comment

by:alex_code
ID: 20358414
try to read this manual maybe will help you.


http://php.oregonstate.edu/manual/en/function.fileperms.php
0
 
LVL 9

Expert Comment

by:alex_code
ID: 20358444
or try to trim the string and cut the first 3 chars.

substr(decoct(fileperms($yourfile)),-3);
0
 
LVL 9

Accepted Solution

by:
alex_code earned 50 total points
ID: 20358468
0
 
LVL 1

Author Closing Comment

by:peter2001
ID: 31441381
thanks
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now