darkorical
July 23rd, 2008, 12:51 PM
Alright I'm back with another round of troubles.
Im building a system to attach notes to orders and have this lovely chunk of code
<?php
error_reporting(0);
$note=$_POST['note'];
$q=$_POST['q']; //cust num
$w=$_POST['w']; //po
$r=$_POST['r']; //rep
$s=$_GET['s']; //cust num
$t=$_GET['t']; //po
$u=$_GET['u']; //rep
echo'
<html>
<head>
<title>Add Note</title>
</head>
<body bgcolor="#C1C2D5">
<form action="note.php" method="post">
<table border="1" width="90%" align="center">
<tr>
<td width="24%"align="center">Rep Name:<br><input type="text" name="r" id="r" value="'.$r.$u.'"></td>
<td width="25%" align="center">Customer Number:<br><input type="text" name="q" id="q" value="'.$q.$s.'"></td>
<td width="25%" align="center">PO#:<br><input type="text" name="w" id="w" value="'.$w.$t.'"></td>
<td width="25%" align="center"><input type="button" value="Reload page" onclick="reloadPage()" /></td>
</tr><tr>
<td colspan="3" align="center"><textarea name="note" cols="65" rows="30"></textarea></td>
<td rowspan="2"><iframe name="dnot" frameborder="0" id="dnot" src="./orders/'.$q.$s.'/'.$w.$t.'/notes.html" width="400" height="525">Something has gone terribly wrong call for help</iframe></td>
</tr><tr>
<td colspan="3" align="center"><input name="Save" type="submit" value="Save" /></td>
</tr>
</table>';
$format="%m/%d/%Y %H:%M:%S";
$strf=strftime($format);
$form = '********************************************<br>'.$r .' -- '. $strf.'<br><br>'.$note.'<br>';
mkdir('./orders/'.$q, 0777);
sleep(1);
mkdir('./orders/'.$q.'/'.$w, 0777);
sleep(1);
$myFile ='./orders/'.$q.'/'.$w.'/notes.html';
$fh = fopen($myFile, 'a') or die("can't open file");
fwrite($fh, $form);
fclose($fh);
?>
long story short it takes entered data and saves it in a specific place and then appends to the end of that file any time another note is made
this works just fine on a local test machine running WAMP but when it goes on my LAMP it can create the file but not write to it again later as upon creation it is chmoded to 644 and the owner is set to root
where do I go to set it so the file is chmoded to 777 upon creation or what do I need to put in my code to do this
I already tried chown($myfile, "www-data") and chmod($myfile,0777) both failed to work through the script but making the changes by hand made the script work just fine but as I expect no less than 100 notes a day I really dont want to have to chmod them by hand. any help would be appreciated.
also tried fopen($myFile, 'a+')
Im building a system to attach notes to orders and have this lovely chunk of code
<?php
error_reporting(0);
$note=$_POST['note'];
$q=$_POST['q']; //cust num
$w=$_POST['w']; //po
$r=$_POST['r']; //rep
$s=$_GET['s']; //cust num
$t=$_GET['t']; //po
$u=$_GET['u']; //rep
echo'
<html>
<head>
<title>Add Note</title>
</head>
<body bgcolor="#C1C2D5">
<form action="note.php" method="post">
<table border="1" width="90%" align="center">
<tr>
<td width="24%"align="center">Rep Name:<br><input type="text" name="r" id="r" value="'.$r.$u.'"></td>
<td width="25%" align="center">Customer Number:<br><input type="text" name="q" id="q" value="'.$q.$s.'"></td>
<td width="25%" align="center">PO#:<br><input type="text" name="w" id="w" value="'.$w.$t.'"></td>
<td width="25%" align="center"><input type="button" value="Reload page" onclick="reloadPage()" /></td>
</tr><tr>
<td colspan="3" align="center"><textarea name="note" cols="65" rows="30"></textarea></td>
<td rowspan="2"><iframe name="dnot" frameborder="0" id="dnot" src="./orders/'.$q.$s.'/'.$w.$t.'/notes.html" width="400" height="525">Something has gone terribly wrong call for help</iframe></td>
</tr><tr>
<td colspan="3" align="center"><input name="Save" type="submit" value="Save" /></td>
</tr>
</table>';
$format="%m/%d/%Y %H:%M:%S";
$strf=strftime($format);
$form = '********************************************<br>'.$r .' -- '. $strf.'<br><br>'.$note.'<br>';
mkdir('./orders/'.$q, 0777);
sleep(1);
mkdir('./orders/'.$q.'/'.$w, 0777);
sleep(1);
$myFile ='./orders/'.$q.'/'.$w.'/notes.html';
$fh = fopen($myFile, 'a') or die("can't open file");
fwrite($fh, $form);
fclose($fh);
?>
long story short it takes entered data and saves it in a specific place and then appends to the end of that file any time another note is made
this works just fine on a local test machine running WAMP but when it goes on my LAMP it can create the file but not write to it again later as upon creation it is chmoded to 644 and the owner is set to root
where do I go to set it so the file is chmoded to 777 upon creation or what do I need to put in my code to do this
I already tried chown($myfile, "www-data") and chmod($myfile,0777) both failed to work through the script but making the changes by hand made the script work just fine but as I expect no less than 100 notes a day I really dont want to have to chmod them by hand. any help would be appreciated.
also tried fopen($myFile, 'a+')