Page 1 of 1

Quick question

Posted: Sun Oct 03, 2004 5:25 pm
by Archy
What would be the ideal way to access a database and update information from an external site that does not allow PHP?

Any ideas to if this can even be done.
(ie, a hit counter, how do they do it?)

Posted: Sun Oct 03, 2004 5:29 pm
by feyd
have the external site reference a script that supplies the data, and use that script to do the hit count addition.

For instance, you want to hit count an image. So you give them a link that's an image output script. It reads the data asked for, and dumps out the proper image headers and binary data. It also updates the database that someone requested said image.

Posted: Sun Oct 03, 2004 5:30 pm
by Archy
How would I even begin to implament that?

Posted: Sun Oct 03, 2004 5:32 pm
by feyd
make a script that can output an image as a downloadable: [devnet]+force +download[/devnet] I think should find a few threads about that aspect.

Posted: Sun Oct 03, 2004 5:42 pm
by Archy
Hmmm, I had a look, but couldnt find any similar topics : (

Posted: Sun Oct 03, 2004 5:56 pm
by feyd

Posted: Sun Oct 03, 2004 6:17 pm
by Archy
All of those links I looked through previously, and couldnt see how they were relevent, they were mainly asking about how to increment download numbers.

Although this might be (and probably is) what I need, I still dont know how to implament it.

Posted: Sun Oct 03, 2004 10:27 pm
by feyd
only 1, one was about hit counting in a download script.

Posted: Mon Oct 04, 2004 3:11 am
by Archy
Yes, but 6, six were about forcing a download which I dont see how that would help a ticker in a database from incrementing :\

Posted: Mon Oct 04, 2004 3:20 am
by patrikG
...six for the Dwarf-lords in their halls of stone,
Nine for Mortal Men doomed to die,
One for the Remote Lord on his dark Server...

edit: the numbers, its the numbers that got me. ;)

Posted: Mon Oct 04, 2004 9:36 am
by feyd
the threads I linked to were to help you start the implementation, by helping you create a script where you can output an image... once you have that, you just need to add the hit counting database query, which is pie.

Posted: Mon Oct 04, 2004 10:13 am
by AngusL

Code: Select all

<?php
echo ( readfile ("URL to file here") )
header ("Content-type: Image/whatever format you want, eg jpg, gif, png")

//Database stuff here
?>
Should be a start for you

Posted: Mon Oct 04, 2004 10:16 am
by feyd
AngusL wrote:

Code: Select all

<?php
echo ( readfile ("URL to file here") )
header ("Content-type: Image/whatever format you want, eg jpg, gif, png")

//Database stuff here
?>
Should be a start for you
that'd create a headers already sent error, along with an string'd integer being added to the buffer created.

Posted: Tue Oct 05, 2004 9:46 am
by AngusL
Okay, way over my head. Sorry to hijack the thread, but quick question - would it then work if the db code was before the echo and header bit? Newbie out.

Posted: Tue Oct 05, 2004 9:57 am
by patrikG
Have a look at this: viewtopic.php?t=1157