473,386 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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=mysql_connect($host,$username,$password );
if($connectid){$log1="Connecting to server [$host]....Done";}
else{$log1="Connecting to server [$host]....Failed (".mysql_error().")";}

$connectdbid=mysql_select_db($database);
if($connectdbid){$log2="Switching to database [$database]....Done";}
else{$log1="Switching to database [$database]....Failed (".mysql_error().")";}

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

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

//done

?>
[/PHP]
This thing is working but whenever I include it with the PHP's
Expand|Select|Wrap|Line Numbers
  1. include()
function in other parts of the script , I get this error:
Expand|Select|Wrap|Line Numbers
  1. Warning: fopen(./conlog.txt) [function.fopen]: failed to open stream: Permission denied in /home/veg1/public_html/modules/connectdb/connectsqldb.php on line 27
  2.  
  3. Warning: fputs(): supplied argument is not a valid stream resource in /home/veg1/public_html/modules/connectdb/connectsqldb.php on line 28
  4.  
  5. Warning: fclose(): supplied argument is not a valid stream resource in /home/veg1/public_html/modules/connectdb/connectsqldb.php on line 29
  6.  
Please help me asap.
Thanks so much.
Mar 19 '08 #1
1 1077
satas
82
Anyway, read following:
http://php.net/manual/en/function.fopen.php

Edited: thought it was IIS.
Mar 19 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: teddysnips | last post by:
Currently studying for 70-229. I'm trying to understand how security for users is managed in SQL Server. I've been using SQL Server for a few years now, but without investigating the bits that...
3
by: Spartan815 | last post by:
I am writing a program that does a command line search for a specified file, or to match a pattern (i.e. search for *.h). Once it finds the file(s) it has to output absolute pathname, size, owner...
3
by: nick | last post by:
The program runs well on Local harddisk. But it always popup the exception if I run it on Netware mapping disk. After debugger say there is no source code on the exception. Also the following error...
10
by: Jayme Pechan | last post by:
I wrote a very simply web application and I'm having all sorts of problems with the security getting in the way. All the web application does is load an out-of-process COM server that is running...
1
by: MSDN Account | last post by:
We have web site that used the IIS ResKit tool MSWC.PermissionChecker to check file permissions. The web site has been upgraded and that upgrade included changing the default server side language...
13
by: MLH | last post by:
Invalid qualifier error displays at compile time on this A97 example from Permissions Property HELP. What's wrong with the strContainerName assignment line? (6th line) Sub...
2
banning
by: banning | last post by:
while($row = mysql_fetch_array($getID)){ $id=$row; $dir='../picture_library/floorplans/'.$id; mkdir($dir,0777); chmod($dir,0777); } ok this is really starting to kill me... i've...
9
by: DotNetNewbie | last post by:
I want to store the maximum amount of permissions in a bit mask. From what I know, I should use the C# long data type and use the bigint in sqlserver. How would I initialize a variable of type...
1
by: beary | last post by:
Hello everyone, I'm not sure if this is the correct forum for this, and apologies for the length of this question, but I'm desperate for some good advice... I'm in way over my head with file...
2
by: beary | last post by:
Hello everyone, I posted this in unix/linux but it received no replies, so I assume it was the wrong forum. I'm trying here. I'm in way over my head with file permissions. The directory and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.