Re: [PHP] triggering php scripts...

2004-05-31 Thread hitek
At 10:19 PM 5/30/2004, you wrote:
Chris Wagner wrote:
i am wondering if there is a good way to trigger a php script from a web
page *without* sending the user to a new page or opening a new browser
windows.
for instance, suppose you wanted to make a button/link on a web page
that, when clicked, would cause a database entry to be decremented. 
however, you do not want to refresh the page or open a popup window or
any stinky little tricks like that.
Use a virtual include to call the php script.
I like to use dummy image files for this purpose and a little bit of 
javascript to change the image src. On page load, a simple spacer.gif is 
loaded. If a particular link or button is clicked, I'll replace the image 
src with, for example,
dosomething.php?action=changeitvalue=newvalue.

dosomething.php performs the required functions and simply returns a blank 
gif image as output.

The result is that your script is executed and the page doesn't have to reload.
This method can also be used with real images. I use it with a file cart 
on my site as well, only this time, the first image loaded is 
cart_add.gif and when they click it, it calls the script to add the file 
to their cart and that script returns cart_remove.gif

I wouldn't suggest using this in mission critical settings, unless you plan 
on making sure the user has javascript turned on, but on a hobby site it 
works well.


or, if this is not possible, does anyone know how to trigger a php
script when someone accesses a particular file from an apache server? or 
if a file from a particular directory is downloaded...
I don't think you can do that unless the php script is used to access the 
file or perform the download you speak of.
I also use this method to count downloads. php script fetches the actual 
file and serves it up, at the same time incrementing the download count.
This is also handy, as you can prevent people from getting to the actual 
files by placing them in a directory outside the webroot.


cheers,
Travis
--
Travis Low
mailto:[EMAIL PROTECTED]
http://www.dawnstar.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] triggering php scripts...

2004-05-30 Thread Chris Wagner
hello,

i am wondering if there is a good way to trigger a php script from a web
page *without* sending the user to a new page or opening a new browser
windows.

for instance, suppose you wanted to make a button/link on a web page
that, when clicked, would cause a database entry to be decremented. 
however, you do not want to refresh the page or open a popup window or
any stinky little tricks like that.

or, if this is not possible, does anyone know how to trigger a php
script when someone accesses a particular file from an apache server? 
or if a file from a particular directory is downloaded...


thanks a lot!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] triggering php scripts...

2004-05-30 Thread Travis Low
Chris Wagner wrote:
i am wondering if there is a good way to trigger a php script from a web
page *without* sending the user to a new page or opening a new browser
windows.
for instance, suppose you wanted to make a button/link on a web page
that, when clicked, would cause a database entry to be decremented. 
however, you do not want to refresh the page or open a popup window or
any stinky little tricks like that.
Use a virtual include to call the php script.
or, if this is not possible, does anyone know how to trigger a php
script when someone accesses a particular file from an apache server? 
or if a file from a particular directory is downloaded...
I don't think you can do that unless the php script is used to access the file 
or perform the download you speak of.

cheers,
Travis
--
Travis Low
mailto:[EMAIL PROTECTED]
http://www.dawnstar.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php