Current time: 05-24-2012, 05:20 AM Hello There, Guest! (LoginRegister)


 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] Avatar wrong CHMod
08-09-2008, 04:38 PM
Post: #11
RE: [F] Avatar wrong CHMod
Wow, that's really really stupid. They actually make you quote it?

wow...
Visit this user's website Find all posts by this user
08-09-2008, 08:22 PM
Post: #12
RE: [F] Avatar wrong CHMod
(08-09-2008 06:09 AM)Tikitiki Wrote:  
PHP Code:
if(substr((string)$mode01) != '0' || strlen((string)$mode) !== 4

Thanks, now it works Smile
Visit this user's website Find all posts by this user
08-09-2008, 10:49 PM
Post: #13
RE: [F] Avatar wrong CHMod
Michael, any reason why it works for Dyers Eve and not you?
Visit this user's website Find all posts by this user
08-10-2008, 08:13 AM (This post was last modified: 08-10-2008 09:25 AM by Dyers Eve.)
Post: #14
RE: [F] Avatar wrong CHMod
I'm sorry, i checked these files today again and I found out, why I thought that this fix works.

I changed in functions_upload.php
PHP Code:
@my_chmod($path."/".$filename0644'0644'); 

and in functions.php
PHP Code:
function my_chmod($file,$mode,$mymode)
{
    if(
substr($mymode01) != '0' || strlen($mymode) !== 4)
    {
        return 
false;
    }
    
$old_umask umask(0);
    
$result chmod($file$mode);
    
umask($old_umask);
    return 
$result;


These modification works. After that, I read the post from Ryan and changed only function_upload.php and in functions.php the function-head and forgot to change the variable name in the if clause

PHP Code:
function my_chmod($file,$mode)
{
    if(
substr((string)$mymode01) != '0' || strlen((string)$mymode) !== 4)
    {
        return 
false;
    }
    
$old_umask umask(0);
    
$result chmod($file$mode);
    
umask($old_umask);
    return 
$result;


...but as everybody can see, this is silly.

But I don't know why
PHP Code:
(string)$mode != '0644' 

Greetings, Dyers Eve
OK, now i know what happened

0644 is octal and php change this.

echo string($mode) returns 420
echo decoct($mode) returns 644
This would be my solution for that problem:

function_upload.php
PHP Code:
@my_chmod($path."/".$filename'0644'); 

functions.php

PHP Code:
function my_chmod($file,$mode)
{
    if(
substr($mode01) != '0' || strlen($mode) !== 4)
    {
        return 
false;
    }
    
$old_umask umask(0);
    
$result chmod($fileoctdec($mode));
    
umask($old_umask);
    return 
$result;


Greetings, Dyers Eve
Visit this user's website Find all posts by this user
08-10-2008, 04:37 PM
Post: #15
RE: [F] Avatar wrong CHMod
Dyers Eve, Does this fix simply work?

PHP Code:
function my_chmod($file$mode)
{
    if(
substr("{$mode}"01) != '0' || strlen("{$mode}") !== 4)
    {
        return 
false;
    }
    
$old_umask umask(0);
    
$result chmod($file$mode);
    
umask($old_umask);
    return 
$result;

Visit this user's website Find all posts by this user
08-10-2008, 05:35 PM (This post was last modified: 08-10-2008 05:36 PM by Dyers Eve.)
Post: #16
RE: [F] Avatar wrong CHMod
No, chmod is still 600

PHP Code:
echo "{$mode}"
-> 420
Visit this user's website Find all posts by this user
08-10-2008, 06:06 PM
Post: #17
RE: [F] Avatar wrong CHMod
Hmm okay, so I see how your fix works. And it should work properly too.
Visit this user's website Find all posts by this user
08-11-2008, 01:14 PM
Post: #18
RE: [F] Avatar wrong CHMod
When I change the test script to your latest version it still outputs "Failure!".
PHP Code:
<?php
function my_chmod($mode)
{
    
//$mode = (string) $mode;
    
if(substr("{$mode}"01) != '0' || strlen("{$mode}") !== 4)
    {
        echo 
"Failure!";
    }
    else
    {
        echo 
"Success";
    }
}

my_chmod(0644);
?>

Greets,
Michael
-------------
[Image: donation_drive_sig.png]
Visit this user's website Find all posts by this user


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | MyBB | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication