Okay, so what I basically want is when $counter = 1000, it will pop a new window leading to 1000hit.html
How could this be done?
<?php $counterfile = './cnt.txt'; $fcontents = file($counterfile); $counter = $fcontents[0]; if ($counter == "1000") { print "POPUP"; } ?>
foxsuit123.txt is the counter number... Thanks 🙂
You'll have to use javascript:
<?php $counterfile = './cnt.txt'; $fcontents = file($counterfile); $counter = $fcontents[0]; if ($counter == "1000") { echo "\n<script language=\"JavaScript\" type=\"text/javascript\">"; echo "\nwindow.open('1000hit.html');"; echo "\n</script>"; } ?>
Exactly what I was looking for 🙂 Thank you 🙂
Also, Another question, I would like this for EVERY 10,000th. (10k, 20k, etc). Is there a way to do this easily? (I want them to go to diff pages, etc 20.html, 30.htm).
Thanks a lot 🙂
Yeah, just add on to the orginal test: elseif($counter == "2000") { //then add the same sort of thing, but pointing at a different file }
so I could do something like
<?php $counterfile = './cnt.txt'; $fcontents = file($counterfile); $counter = $fcontents[0]; if ($counter == "1000") { echo "\n<script language=\"JavaScript\" type=\"text/javascript\">"; echo "\nwindow.open('1000hit.html');"; echo "\n</script>"; } elseif($counter == "2000" { echo "\n<script language=\"JavaScript\" type=\"text/javascript\">"; echo "\nwindow.open('2000hit.html');"; echo "\n</script>"; } elseif($counter == "3000" { echo "\n<script language=\"JavaScript\" type=\"text/javascript\">"; echo "\nwindow.open('0000hit.html');"; echo "\n</script>"; } ?>
Close, you'll still need closing parentheses on your elseif, ie
elseif($blah == blah) {
try this,
<?php $counterfile = './cnt.txt'; $fcontents = file($counterfile); $counter = $fcontents[0]; if ($counter%1000 == 0) { $page = $counter."hit.html"; echo "\n<script language=\"JavaScript\" type=\"text/javascript\">"; echo "\nwindow.open($page);"; echo "\n</script>"; } ?>
reg kevin
heh, wouldn't have thought of using modulus, good idea 🙂