Help with DIR Permissions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gamernaveen
    New Member
    • Oct 2007
    • 28

    Help with DIR Permissions

    I wrote a script to log MySQL connections into a log file ...
    So that whenever and wherever in the different part of the scripts , I need to connect , I could use this code to connect as well as track the connections to a log.

    This is the code.
    [PHP]
    <?
    $username="xxxx ";
    $password="xxxx ";
    $port="xx";
    $ip = getenv("REMOTE_ ADDR") ; // User IP address
    $host="xxxx";
    $database="xxxx ";
    $logfile="./conlog.txt";
    $time=date("d/m/Y - H:i:s A");

    $connectid=mysq l_connect($host ,$username,$pas sword);
    if($connectid){ $log1="Connecti ng to server [$host]....Done";}
    else{$log1="Con necting to server [$host]....Failed (".mysql_error( ).")";}

    $connectdbid=my sql_select_db($ database);
    if($connectdbid ){$log2="Switch ing to database [$database]....Done";}
    else{$log1="Swi tching to database [$database]....Failed (".mysql_error( ).")";}

    // Log Processes (./log.)
    $usr="\nRequest from user [$ip] on [$time]";
    $log=$usr."\n$l og1\n$log2";

    $fp=fopen($logf ile,"a");
    $add1=fputs($fp ,$log);
    $close1=fclose( $fp);

    //done

    ?>
    [/PHP]
    This thing is working but whenever I include it with the PHP's
    Code:
    include()
    function in other parts of the script , I get this error:
    Code:
    Warning: fopen(./conlog.txt) [function.fopen]: failed to open stream: Permission denied in /home/veg1/public_html/modules/connectdb/connectsqldb.php on line 27
    
    Warning: fputs(): supplied argument is not a valid stream resource in /home/veg1/public_html/modules/connectdb/connectsqldb.php on line 28
    
    Warning: fclose(): supplied argument is not a valid stream resource in /home/veg1/public_html/modules/connectdb/connectsqldb.php on line 29
    Please help me asap.
    Thanks so much.
  • satas
    New Member
    • Nov 2007
    • 82

    #2
    Anyway, read following:


    Edited: thought it was IIS.
    Last edited by satas; Mar 19 '08, 12:32 PM. Reason: thought it was IIS.

    Comment

    Working...