|
-
Hello,
first of all, I know very little about IIS servers and the server admin is also having problems.
The php scripts I am using will load the variables out of
my txt files but I cant seem to write data to them.
This all works in a *nix environment.
I believe this is a user/permissions problem, but I have no idea what to do to get these these scripts to work.
Sample "write to file" script I am using is at bottom of page.
Please, any help would be appreciated.
what do I need to do in order to get this to work?
Is the script I created look ok?
Anything you think I should change?
Thanks in advance for you help.
Pathfinder
Code:
<?php
$department = "$department";
$save_task = "$save_task";
$date = date("l dS of F Y h:i:s A");
if ($REMOTE_ADDR == "") $ip = "no ip";
else $ip = getHostByAddr($REMOTE_ADDR);
function myurlencode($text)
{ $text = str_replace("%", "%25", $text);
$text = str_replace("&", "%26", $text);
return $text;
}
if ($save_task == "UOIP Save Changes")
{
$data = "../../info/upperlevel.txt";
}
elseif ($save_task == "IEPS Save Current Changes")
{
$data = "../../info/ieps.txt";
}
elseif ($save_task == "ISS Save Current Changes")
{
$data = "iss.txt";
}
elseif ($save_task == "SAS Save Current Changes")
{
$data = "../../info/sas.txt";
}
elseif ($save_task == "FAPA Save Current Changes")
{
$data = "../../info/fapa.txt";
}
elseif ($save_task == "IPAL-IIEPR Save Current Changes")
{
$data = "../../info/ipal-iiepr.txt";
}
else
{
echo "&Status=Error!";
}
$fp = fopen($data, "w");
fwrite($fp, "&Title1=" . myurlencode(stripslashes($Title1)));
fwrite($fp, "&Name1=" . myurlencode(stripslashes($Name1)));
fwrite($fp, "&Mail1=" . myurlencode(stripslashes($Mail1)));
fwrite($fp, "&Title2=" . myurlencode(stripslashes($Title2)));
fwrite($fp, "&Name2=" . myurlencode(stripslashes($Name2)));
fwrite($fp, "&Mail2=" . myurlencode(stripslashes($Mail2)));
fwrite($fp, "&Title3=" . myurlencode(stripslashes($Title3)));
fwrite($fp, "&Name3=" . myurlencode(stripslashes($Name3)));
fwrite($fp, "&Mail3=" . myurlencode(stripslashes($Mail3)));
fwrite($fp, "&Title4=" . myurlencode(stripslashes($Title4)));
fwrite($fp, "&Name4=" . myurlencode(stripslashes($Name4)));
fwrite($fp, "&Mail4=" . myurlencode(stripslashes($Mail4)));
fwrite($fp, "&Title5=" . myurlencode(stripslashes($Title5)));
fwrite($fp, "&Name5=" . myurlencode(stripslashes($Name5)));
fwrite($fp, "&Mail5=" . myurlencode(stripslashes($Mail5)));
fwrite($fp, "&Title6=" . myurlencode(stripslashes($Title6)));
fwrite($fp, "&Name6=" . myurlencode(stripslashes($Name6)));
fwrite($fp, "&Mail6=" . myurlencode(stripslashes($Mail6)));
fwrite($fp, "&Title7=" . myurlencode(stripslashes($Title7)));
fwrite($fp, "&Name7=" . myurlencode(stripslashes($Name7)));
fwrite($fp, "&Mail7=" . myurlencode(stripslashes($Mail7)));
fwrite($fp, "&Title8=" . myurlencode(stripslashes($Title8)));
fwrite($fp, "&Name8=" . myurlencode(stripslashes($Name8)));
fwrite($fp, "&Mail8=" . myurlencode(stripslashes($Mail8)));
fwrite($fp, "&Title9=" . myurlencode(stripslashes($Title9)));
fwrite($fp, "&Name9=" . myurlencode(stripslashes($Name9)));
fwrite($fp, "&Mail9=" . myurlencode(stripslashes($Mail9)));
fwrite($fp, "&Title10=" . myurlencode(stripslashes($Title10)));
fwrite($fp, "&Name10=" . myurlencode(stripslashes($Name10)));
fwrite($fp, "&Mail10=" . myurlencode(stripslashes($Mail10)));
fwrite($fp, "&Title11=" . myurlencode(stripslashes($Title11)));
fwrite($fp, "&Name11=" . myurlencode(stripslashes($Name11)));
fwrite($fp, "&Mail11=" . myurlencode(stripslashes($Mail11)));
fwrite($fp, "&Title12=" . myurlencode(stripslashes($Title12)));
fwrite($fp, "&Name12=" . myurlencode(stripslashes($Name12)));
fwrite($fp, "&Mail12=" . myurlencode(stripslashes($Mail12)));
fwrite($fp, "&Title13=" . myurlencode(stripslashes($Title13)));
fwrite($fp, "&Name13=" . myurlencode(stripslashes($Name13)));
fwrite($fp, "&Mail13=" . myurlencode(stripslashes($Mail13)));
fwrite($fp, "&Title14=" . myurlencode(stripslashes($Title14)));
fwrite($fp, "&Name14=" . myurlencode(stripslashes($Name14)));
fwrite($fp, "&Mail14=" . myurlencode(stripslashes($Mail14)));
fwrite($fp, "&Title15=" . myurlencode(stripslashes($Title15)));
fwrite($fp, "&Name15=" . myurlencode(stripslashes($Name15)));
fwrite($fp, "&Mail15=" . myurlencode(stripslashes($Mail15)));
fwrite($fp, "&Title16=" . myurlencode(stripslashes($Title16)));
fwrite($fp, "&Name16=" . myurlencode(stripslashes($Name16)));
fwrite($fp, "&Mail16=" . myurlencode(stripslashes($Mail16)));
fwrite($fp, "&Title17=" . myurlencode(stripslashes($Title17)));
fwrite($fp, "&Name17=" . myurlencode(stripslashes($Name17)));
fwrite($fp, "&Mail17=" . myurlencode(stripslashes($Mail17)));
fwrite($fp, "&Title18=" . myurlencode(stripslashes($Title18)));
fwrite($fp, "&Name18=" . myurlencode(stripslashes($Name18)));
fwrite($fp, "&Mail18=" . myurlencode(stripslashes($Mail18)));
fwrite($fp, "&Title19=" . myurlencode(stripslashes($Title19)));
fwrite($fp, "&Name19=" . myurlencode(stripslashes($Name19)));
fwrite($fp, "&Mail19=" . myurlencode(stripslashes($Mail19)));
fwrite($fp, "&Title20=" . myurlencode(stripslashes($Title20)));
fwrite($fp, "&Name20=" . myurlencode(stripslashes($Name20)));
fwrite($fp, "&Mail20=" . myurlencode(stripslashes($Mail20)));
fwrite($fp, "&Title21=" . myurlencode(stripslashes($Title21)));
fwrite($fp, "&Name21=" . myurlencode(stripslashes($Name21)));
fwrite($fp, "&Mail21=" . myurlencode(stripslashes($Mail21)));
fwrite($fp, "&Title22=" . myurlencode(stripslashes($Title22)));
fwrite($fp, "&Name22=" . myurlencode(stripslashes($Name22)));
fwrite($fp, "&Mail22=" . myurlencode(stripslashes($Mail22)));
fwrite($fp, "&Title23=" . myurlencode(stripslashes($Title23)));
fwrite($fp, "&Name23=" . myurlencode(stripslashes($Name23)));
fwrite($fp, "&Mail23=" . myurlencode(stripslashes($Mail23)));
fwrite($fp, "&Title24=" . myurlencode(stripslashes($Title24)));
fwrite($fp, "&Name24=" . myurlencode(stripslashes($Name24)));
fwrite($fp, "&Mail24=" . myurlencode(stripslashes($Mail24)));
fwrite($fp, "&Title25=" . myurlencode(stripslashes($Title25)));
fwrite($fp, "&Name25=" . myurlencode(stripslashes($Name25)));
fwrite($fp, "&Mail25=" . myurlencode(stripslashes($Mail25)));
fwrite($fp, "©right=" . myurlencode(stripslashes($copyright)));
fwrite($fp, "&modified=" . myurlencode(stripslashes($date)));
fwrite($fp, "&archivemodified=" . myurlencode(stripslashes($archivemodified)));
fclose($fp);
$data = "../log/log.txt";
$fp = fopen($data, "a");
fwrite($fp, "-----------------------------------------------------------\n");
fwrite($fp, ":" . myurlencode(stripslashes($date)));
fwrite($fp, "\n-----------------------------------------------------------");
fwrite($fp, "\nDepartment: " . myurlencode(stripslashes($department)));
fwrite($fp, "\nTask Performed: " . myurlencode(stripslashes($save_task)));
fwrite($fp, "\nRemote Address: " . myurlencode(stripslashes($ip)));
fwrite($fp, "\nip Address: " . myurlencode(stripslashes($REMOTE_ADDR)));
fwrite($fp, "\n\n");
fclose($fp);
echo "&Status=Save Process Completed";
return;
exit;
?>
-
Hi,
if the scripts work on a unix server, and your directory structure is the same, it should work here as well...
Computers have gone a long way from coding at the byte level to web scripting - just to allow the same code to be reused on a different machine ...
Sorry for those comments, I have got a little advice as well
$fp = @fopen($data, "w");
if(!$fp) die ("&Status=Error in fopen");
Musicman
-
Hi there musicman.
I can read between the lines(I think), you sound like you dislike micro$oft as much as do. M$ is one thing Ive added to my list of things not to talk about at partys, the others are politics and religion..LOL
My problem is that the server is already in place for this company and although Im trying to get them to host with us on a *nix server, it may not happen soon enough, if at all.
I have been trying to look up information about php functions and file permissions on the IIS server, but to no avail.
My question to anyone is this:
How to you allow files to execute on an IIS/NT/win2000 server?
My fopen read will work, but I cannot fopen write to a file, it says permission denied.
Please if you can help, do.
Im down to my last few days of time and if I dont come up with the solution, I will lose all moneys coming to me for this project.. (
Thanks in advance for any help you can supply.
-
Hi,
I believe on win system the admin has to make files writable (on unix system normally the user decides on a per-file basis) [please dont comment about right clicking file properties anybody; I am talking about files in the webspace]
I also believe that most systems have all web files writable so the admin does not have to take care of setting permissions
There is something called php safe mode which can severely restrict the capabilities of a php script - it is basically adding restrictions to those that the operating system already has placed. If you have cgi as well, you could try to write a file with a cgi script to determine whether it is php or file system protections.
In any case you seem to be at the mercy of the server nimda (oops: admin)
Musicman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|