robo-techie
June 21st, 2003, 01:55 AM
hi..
im trying to run a php script on the onLoad of my page.. basically i wanna decrement a number that is stored in a text file.. i tried doing this, but it wouldn't work :(
<script language="JavaScript">
<!--
subt = function() {
document.write("<?php")
document.write("$handle = fopen(\"curon.txt\", \"r\");")
document.write("$contents = fgets($handle, 4096);")
document.write("$temp = sprintf(\"%d\", $contents);")
document.write("$temp--;")
document.write("fclose($handle);")
document.write("$handle = fopen(\"curon.txt\", \"w\");")
document.write("fputs($handle, \"$temp\");")
document.write("fclose($handle);")
document.write("?>")
}
// -->
</script>
..
..
..
<body onUnload="subt()">
any help would be appreciated :)
im trying to run a php script on the onLoad of my page.. basically i wanna decrement a number that is stored in a text file.. i tried doing this, but it wouldn't work :(
<script language="JavaScript">
<!--
subt = function() {
document.write("<?php")
document.write("$handle = fopen(\"curon.txt\", \"r\");")
document.write("$contents = fgets($handle, 4096);")
document.write("$temp = sprintf(\"%d\", $contents);")
document.write("$temp--;")
document.write("fclose($handle);")
document.write("$handle = fopen(\"curon.txt\", \"w\");")
document.write("fputs($handle, \"$temp\");")
document.write("fclose($handle);")
document.write("?>")
}
// -->
</script>
..
..
..
<body onUnload="subt()">
any help would be appreciated :)