ober
-
Posts
5,327 -
Joined
-
Last visited
Posts posted by ober
-
-
Pardon my ignorance... but how do I do that?
-
It's Windows Server 2003. And I'll say it again, this worked when I initially wrote it and the location of the file hasn't changed and the server hasn't changed.
And it's not read-only (the file). And the user (as far as the webserver) hasn't changed either.
-
The file isn't read only... so what else could it be??
-
Well the path returned by pathinfo uses backslashes, so I have to use backslashes for the rest unless I replace them all with forward slashes, which I don't think I've tried. And my editor doesn't like it when I don't escape them, so I assumed I had to (PHP Designer 7).
This is the error:
Warning: fopen(C:\\Program Files\\FDS\\DTManage\\Web\\DTM\\php\\DTBill\\sources\\snapshot\\snapshot.txt): failed to open stream: Permission denied in C:\Program Files\FDS\DTManage\Web\DTM\php\DTBill\sources\snapshot\createExport.php on line 5 Cannot open file (C:\\Program Files\\FDS\\DTManage\\Web\\DTM\\php\\DTBill\\sources\\snapshot\\snapshot.txt) Warning: fclose(): supplied argument is not a valid stream resource in C:\Program Files\FDS\DTManage\Web\DTM\php\DTBill\sources\snapshot\createExport.php on line 32 -
Anyone? I'm really lost on this one.
-
Put the IPs in an array and loop through them using a foreach() and basically say, if $_SERVER['REMOTE_ADDR'] == $value, do whatever.
-
When I click that link, I get this:
An HTTP error occurred while getting:
http://i37.tinypic.com/2mhvh2r.png
Details: "connect timed out".
-
Check the variable $_SERVER['REMOTE_ADDR']
-
Am I the only one not seeing images?
-
Not without knowing the rest of the code. I'm guessing there is a lot more going on than what you showed us there. Your best bet is to modify the code to query the DB for multiple groups and levels instead of just levels.
-
You should be able to read that error and know your result then.
-
That depends on what is in $levels. And you can't really get both of those without breaking the query for the rest of them.
-
You would have to know the contents of the entire page before you knew if it contained a div with a certain class. Are you generating the rest of the page? I'm assuming that the div would have already been added by the time you're running the above code? If so, set a variable when that div is created and then read the variable when you get to this part of the page.
The only other option would be to write the contents of the page to a variable and check the variable for the string containing the div.
-
A quick google search turned up this: http://stackoverflow.com/questions/244506/how-do-i-check-for-valid-not-dead-links-programatically-using-php
-
Your question doesn't make ANY sense. Try again.
-
I'm not sure that's the best way to check for valid links. You're probably hitting the script processing limit because file_get_contents can take a while depending on server load and where you are grabbing the file from. I'm not sure what the answer is, but I don't think looking for an input element on the page is the most efficient way to go about it.
-
You'll probably have to do this with Javascript. The onclick action in the button will pass a parameter to a JS function that then redirects to your page with a variable in the query string.
-
By the way, it's a Windows server running IIS. I know... the horror.
-
I'm trying to create a simple data dump to a text file. It was all working fine and now fopen doesn't like my relative paths. So I'm using an absolute path to the file:
C:\\Program Files\\FDS\\DTManage\\Web\\DTM\\php\\DTBill\\sources\\snapshot\\snapshot.txt
But fopen keeps saying it can't open the file. It's acting like it isn't there.
$path_parts = pathinfo(__FILE__); $filename = str_replace('\\', '\\\\', $path_parts['dirname'])."\\\\snapshot.txt"; if (!$handle = fopen($filename, 'w')) { echo "Cannot open file ($filename)"; }
Can someone tell me why this isn't working?
-
Umm... ok, but I already solved it so I'm not sure why you're replying.
-
Ok... got it figured out. I was using PHP's number_format() function to format the "billtotalx" value and it was throwing a comma into the value, which was causing it not to be evaluated as a number. DAMN.
-
WTF...
for(i=1;i<totalboxes;i++) { if(document.getElementById('bill'+i).value != null && document.getElementById('bill'+i).value != '') { total += Number(document.getElementById('bill'+i).value); } } alert(billtotal); total = total*1 + billtotal*1; alert(total);
The first alert gives me the number. The loop is working fine, but when I try to add the two together, I get "NaN". This is insane!
-
Anyone else have any ideas? parseFloat triggers a result of NaN. Using eval doesn't change anything.
Here is the entire function:
function calculate_ger(_box) { // ger calculation including totals for GER and Billable units var gerbox = document.getElementById('ger'+_box); var billbox = document.getElementById('bill'+_box); var ratebox = document.getElementById('price_rate'); var retval = billbox.value * ratebox.value; gerbox.disabled = "false"; gerbox.value = retval.toFixed(2); gerbox.disabled = "true"; // billable units total calculation var billtotal = 0; var totalboxes = document.getElementById('boxcount').value; var billtotal = parseFloat(document.getElementById('billtotalx').value); var billtotalbox = document.getElementById('billtotal'); var i=0; for(i=1;i<totalboxes;i++) { if(document.getElementById('bill'+i).value != null) { billtotal += parseFloat(document.getElementById('bill'+i).value); //alert(billtotal); } } billtotalbox.disabled = "false"; billtotalbox.value = billtotal; billtotalbox.disabled = "true"; }
The first part works great. I don't understand why the second part isn't.
-
I guess you didn't bother to look at their documentation? It's the 3rd example: http://tinymce.moxiecode.com/examples/example_03.php
fopen with space in windows path
in PHP Coding Help
Posted
OK, so that worked... but the file isn't open. I even rebooted the server and it hasn't changed. I guess I'll try writing to another location.