473,398 Members | 2,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Remote Counter,

Hello Group,

I have been playing with this idea for a month or so, but never really got
anywhere....

I want to make a remote counter image, the same as is found on
mycounter.com, where people have have an IMG SRC on there page which will
increment a SQL counter on my database.

so each time there page is loaded, it get the image from my site, but also
increments a hit counter on SQL..

I have really no idea how to do this, however I need to try and do this is
ASP, not CGI or anything like that, as I will never understand it :-)

what I have tryed so far is streaming the image which I can do, but I dont
know how to pass the varable from the IMG SRC to the server..

I know this is not the answer but I want to try and do something like this

how can I pass the for example ?ID=123 value to be grabbed in the page on my
site
<img border="0"
="http://www.mysite.com/counters/index.asp?id=123"> ----------- on remote
site
<============ WITH THIS CODE ON MY SITE======(index.asp)=======>
response.contenttype="image/gif"
response.binarywrite getBinaryFile(server.mappath("../images/car.jpg"))

' ////////// how can I grab the value of the ID on the remote IMG SRC
response.write querystring("id")
' /////////////////////////////////////////////////////////////////////////

function getBinaryFile(fileSpec)

Dim adTypeBinary
adTypeBinary = 1
Dim oStream
set oStream = server.createobject("ADODB.Stream")
oStream.Open
oStream.Type = adTypeBinary
oStream.LoadFromFile fileSpec
getBinaryFile= oStream.read
set oStream=nothing
end function

If I have gone on totally the wrong track, any other ideas would be very
very welcome, as I need to get something running asap..
Kind Regards

Graham Mattingley
Jul 19 '05 #1
5 2128
Do it all server side first, then find out the value in your DB and place
that into a variable and use that to display the image.

This may help:-

intCount = 123 'Value from db after it has been incremented
For i = 1 to (6 - (Len(intCount)))
Response.Write ("<img src=""/images/ado/dg0.gif"">")
Next
For i = 1 to Len(intCount)
Response.Write ("<img src=""/images/ado/dg")
Response.Write Mid(intCount, i, 1)
Response.Write (".gif"">")
NEXT

Hope this helps

Stu

"Graham Mattingley" <gr****@technocom.com> wrote in message
news:bv*******************@news.demon.co.uk...
Hello Group,

I have been playing with this idea for a month or so, but never really got
anywhere....

I want to make a remote counter image, the same as is found on
mycounter.com, where people have have an IMG SRC on there page which will
increment a SQL counter on my database.

so each time there page is loaded, it get the image from my site, but also
increments a hit counter on SQL..

I have really no idea how to do this, however I need to try and do this is
ASP, not CGI or anything like that, as I will never understand it :-)

what I have tryed so far is streaming the image which I can do, but I dont
know how to pass the varable from the IMG SRC to the server..

I know this is not the answer but I want to try and do something like this

how can I pass the for example ?ID=123 value to be grabbed in the page on my site
<img border="0"
="http://www.mysite.com/counters/index.asp?id=123"> ----------- on remote site
<============ WITH THIS CODE ON MY SITE======(index.asp)=======>
response.contenttype="image/gif"
response.binarywrite getBinaryFile(server.mappath("../images/car.jpg"))

' ////////// how can I grab the value of the ID on the remote IMG SRC
response.write querystring("id")
' /////////////////////////////////////////////////////////////////////////
function getBinaryFile(fileSpec)

Dim adTypeBinary
adTypeBinary = 1
Dim oStream
set oStream = server.createobject("ADODB.Stream")
oStream.Open
oStream.Type = adTypeBinary
oStream.LoadFromFile fileSpec
getBinaryFile= oStream.read
set oStream=nothing
end function

If I have gone on totally the wrong track, any other ideas would be very
very welcome, as I need to get something running asap..
Kind Regards

Graham Mattingley

Jul 19 '05 #2
Graham Mattingley wrote on 31 jan 2004 in
microsoft.public.inetserver.asp.general:
<img border="0"
="http://www.mysite.com/counters/index.asp?id=123"> ----------- on
remote site
src =

Not on a remote site, but just clientside code in an asp or html file on
your site
<============ WITH THIS CODE ON MY SITE======(index.asp)=======>
<%
if request.querystring("id")="123" then
'increment your counter in a database or txt-file
n = getTheNumber("file123")
n = n+1
storeTheNumber("file123",n)
end if
%>
response.contenttype="image/gif"
why, if it is jpeg, specify gif ?
response.binarywrite
getBinaryFile(server.mappath("../images/car.jpg"))


There is a bit more to it, you have to fetch the file, addheader etc.
<>

or you could just do [not tested]:

response.contenttype="image/jpeg"
server.transfer "../images/car.jpg"

or [perhaps]

response.contenttype="image/jpeg" %>
<!--#include virtual="../images/car.jpg" -->

as long as this image has no "<%" in its binary stream,
in wich seldom case you will find that the image is not rendered as
expected. Your response.binarywrite solution is a safer but more coding
intensive solution.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #3
If you manage to find a way to do this, I'd love to see it (been trying to
figure it out myself for a couple months and not been able to find anything
useful)

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Graham Mattingley <gr****@technocom.com> wrote in message
news:bv*******************@news.demon.co.uk...
Hello Group,

I have been playing with this idea for a month or so, but never really got
anywhere....

I want to make a remote counter image, the same as is found on
mycounter.com, where people have have an IMG SRC on there page which will
increment a SQL counter on my database.

so each time there page is loaded, it get the image from my site, but also
increments a hit counter on SQL..

I have really no idea how to do this, however I need to try and do this is
ASP, not CGI or anything like that, as I will never understand it :-)

what I have tryed so far is streaming the image which I can do, but I dont
know how to pass the varable from the IMG SRC to the server..

I know this is not the answer but I want to try and do something like this

how can I pass the for example ?ID=123 value to be grabbed in the page on my site
<img border="0"
="http://www.mysite.com/counters/index.asp?id=123"> ----------- on remote site
<============ WITH THIS CODE ON MY SITE======(index.asp)=======>
response.contenttype="image/gif"
response.binarywrite getBinaryFile(server.mappath("../images/car.jpg"))

' ////////// how can I grab the value of the ID on the remote IMG SRC
response.write querystring("id")
' /////////////////////////////////////////////////////////////////////////
function getBinaryFile(fileSpec)

Dim adTypeBinary
adTypeBinary = 1
Dim oStream
set oStream = server.createobject("ADODB.Stream")
oStream.Open
oStream.Type = adTypeBinary
oStream.LoadFromFile fileSpec
getBinaryFile= oStream.read
set oStream=nothing
end function

If I have gone on totally the wrong track, any other ideas would be very
very welcome, as I need to get something running asap..
Kind Regards

Graham Mattingley

Jul 19 '05 #4
Steven Burn wrote on 31 jan 2004 in
microsoft.public.inetserver.asp.general:
If you manage to find a way to do this, I'd love to see it (been
trying to figure it out myself for a couple months and not been able
to find anything useful)


<http://www.4guysfromrolla.com/webtech/code/hitcounter.asp.html>

<http://www.4guysfromrolla.com/webtech/041801-1.shtml>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #5
I already know how to write a local one, just not one that supports multiple
remote clients.

I'll give the a looksee though and see if they help..... cheers ;o)

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Evertjan. <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
Steven Burn wrote on 31 jan 2004 in
microsoft.public.inetserver.asp.general:
If you manage to find a way to do this, I'd love to see it (been
trying to figure it out myself for a couple months and not been able
to find anything useful)


<http://www.4guysfromrolla.com/webtech/code/hitcounter.asp.html>

<http://www.4guysfromrolla.com/webtech/041801-1.shtml>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Jay | last post by:
I need to write a program to find mac address of a remote computer, is this possible? How?
0
by: Christopher Attard | last post by:
Hi, I'm using the PerformanceCounter .NET class to obtain the "% Processor Time" for processes that are running on a remote host. These processes are obtained using the...
0
by: Frank Rosario | last post by:
Hello all; in need of some assistance. I am currently writing some software for our companies intranet, and I need for it to specifically access other machines on the network's Performance...
0
by: gmcelhanon | last post by:
I have some code that attempts to read a performance counter on a remote machine. Under .NET 1.1 the code works just fine, but under ..NET 2.0 I get a SecurityException with a description of...
3
by: Geoff McElhanon | last post by:
I have been struggling with a security issue that occurs under .NET 2.0, but does not occur under .NET 1.1. Essentially I am trying to open up a performance counter on a remote server and monitor...
4
by: Abhi | last post by:
Hi All, I have a web service method which works fine when called from my local machine i.e. from localhost but when I publish the web services to a remote machine it throws an invalid cast soap...
15
by: =?Utf-8?B?TVNU?= | last post by:
To demonstrate my problem, I have a very simple VB Windows application. It has a text box that is used to display a counter, a button to reset the counter, and a timer that increments the counter...
1
by: grif | last post by:
Hey Everyone! Ok time for another newbie question from me...I've written a little program that reads URL's from a text file line by line and then does a POST action etc The problem is that the...
11
by: =?Utf-8?B?U2FsYW1FbGlhcw==?= | last post by:
Has anybody worked with performancecounter object to access counters on remote machine? I managed to write code that retrieves counters categories froma remote machine, when I try another remote...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.