473,480 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Small piece of php needed

Hi chaps,

I just need a widget of php if anyone has somethign similar to hand.

I need to create a .php file that will take an input (&type=xxx or
yyy), run a piece of javascript in the browser (its the google
analytics javascript which i have here) and then send the user to
download either Install1.exe or Install2.exe depending on the value of
'type'.

At the mo, i have two links that link straight to one of two .exe
files. However, to make analysis easier, i want to have those links go
to a php page, which will run the javascript in the browser, thereby
getting google to log the download of the file, and then 'redirect'
the browser to download the correct file, so it appears seemlessly.

Can anyone help ?

Olly
--
Managed online backup services
G2 Support
www.g2support.com/backups

Get a free trial today
www.g2support.com/downloads

Feb 25 '07 #1
3 1317
Oliver Marshall wrote:
Hi chaps,

I just need a widget of php if anyone has somethign similar to hand.

I need to create a .php file that will take an input (&type=xxx or
yyy), run a piece of javascript in the browser (its the google
analytics javascript which i have here) and then send the user to
download either Install1.exe or Install2.exe depending on the value of
'type'.
You can't use PHP to "run a piece of javascript on the browser". PHP is
server side and cannot cause anything to run on the client machine. The
best you can do is use PHP to generate Javascript code when must then be
run on the browser as any javascript would be.

And you won't be able to send them to the download page in addition to
running the javascript. You can either send them the javascript code or
you can send them to the download page - not both.
At the mo, i have two links that link straight to one of two .exe
files. However, to make analysis easier, i want to have those links go
to a php page, which will run the javascript in the browser, thereby
getting google to log the download of the file, and then 'redirect'
the browser to download the correct file, so it appears seemlessly.

Can anyone help ?
Maybe you can generate some additional JS code to do the redirect, but
it still won't be transparent.

Or you can implement your own logging mechanism in PHP and completely
forget about getting Google to do it for you.
Olly
--
Managed online backup services
G2 Support
www.g2support.com/backups

Get a free trial today
www.g2support.com/downloads

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Feb 25 '07 #2
Surely you can use php to render a page containg the javascript code,
and then include a javascript redirect to the .exe download required
by the specified variable ?
On Feb 25, 2:24 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Oliver Marshall wrote:
Hi chaps,
I just need a widget of php if anyone has somethign similar to hand.
I need to create a .php file that will take an input (&type=xxx or
yyy), run a piece of javascript in the browser (its the google
analytics javascript which i have here) and then send the user to
download either Install1.exe or Install2.exe depending on the value of
'type'.

You can't use PHP to "run a piece of javascript on the browser". PHP is
server side and cannot cause anything to run on the client machine. The
best you can do is use PHP to generate Javascript code when must then be
run on the browser as any javascript would be.

And you won't be able to send them to the download page in addition to
running the javascript. You can either send them the javascript code or
you can send them to the download page - not both.
At the mo, i have two links that link straight to one of two .exe
files. However, to make analysis easier, i want to have those links go
to a php page, which will run the javascript in the browser, thereby
getting google to log the download of the file, and then 'redirect'
the browser to download the correct file, so it appears seemlessly.
Can anyone help ?

Maybe you can generate some additional JS code to do the redirect, but
it still won't be transparent.

Or you can implement your own logging mechanism in PHP and completely
forget about getting Google to do it for you.
Olly
--
Managed online backup services
G2 Support
www.g2support.com/backups
Get a free trial today
www.g2support.com/downloads

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

Feb 25 '07 #3
Oliver Marshall wrote:
On Feb 25, 2:24 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>Oliver Marshall wrote:
>>Hi chaps,
I just need a widget of php if anyone has somethign similar to hand.
I need to create a .php file that will take an input (&type=xxx or
yyy), run a piece of javascript in the browser (its the google
analytics javascript which i have here) and then send the user to
download either Install1.exe or Install2.exe depending on the value of
'type'.
You can't use PHP to "run a piece of javascript on the browser". PHP is
server side and cannot cause anything to run on the client machine. The
best you can do is use PHP to generate Javascript code when must then be
run on the browser as any javascript would be.

And you won't be able to send them to the download page in addition to
running the javascript. You can either send them the javascript code or
you can send them to the download page - not both.
>>At the mo, i have two links that link straight to one of two .exe
files. However, to make analysis easier, i want to have those links go
to a php page, which will run the javascript in the browser, thereby
getting google to log the download of the file, and then 'redirect'
the browser to download the correct file, so it appears seemlessly.
Can anyone help ?
Maybe you can generate some additional JS code to do the redirect, but
it still won't be transparent.

Or you can implement your own logging mechanism in PHP and completely
forget about getting Google to do it for you.
>>Olly
--
Managed online backup services
G2 Support
www.g2support.com/backups
Get a free trial today
www.g2support.com/downloads
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================


Surely you can use php to render a page containg the javascript code,
and then include a javascript redirect to the .exe download required
by the specified variable ?

(Top posting fixed)

You could do that. But the only PHP you would need for that would be to
insert a file name into the javascript, and perhaps insert the name of
the download page in the javascript redirect.

One or two echo statements - nothing more.

P.S. Please don't top post. Thanks.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Feb 25 '07 #4

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

Similar topics

18
1543
by: B Love | last post by:
I just need a small mod to my code (I think) to get the result I want. Earlier this week I had received help from FredG on concatenating a field in a form. I went on to create a field in the form...
7
10586
by: Russell Mangel | last post by:
I have been doing some C++ Interop using the new VS2005 (June Beta). I am exposing these methods to .NET clients. I ran into some WinAPI methods which use LPVOID types, and I don't understand...
18
2237
by: __PPS__ | last post by:
Hello, I'm a university student and I'm preparing for my final today. I'm reading course notes, I found completely strange piece of code. It makes me laugh, I think the teacher needs to prepare...
6
1617
by: kalyan.listsubs | last post by:
Hi, I have the below program which will simply write struct employee to a file (binary mode). The problem here is empid is writen to the file but the name (char name) is not written. I am using...
169
8943
by: JohnQ | last post by:
(The "C++ Grammer" thread in comp.lang.c++.moderated prompted this post). It would be more than a little bit nice if C++ was much "cleaner" (less complex) so that it wasn't a major world wide...
12
2072
by: pwiegers | last post by:
Yes, I know, this is sort of commercial.. but how else to get people to, what I think, is a handy online applicaton? I created this app because I hate do document :) (Don't we all?) Sometimes I...
3
1628
by: SM | last post by:
I'm using simpleXML in PHP and i Can't get this small piece of code to work? Need help I have an XML that looks like this: <?xml version="1.0" encoding="utf-8"?> <VIDEO> <item>...
16
3320
by: scholz.lothar | last post by:
I want to add some extension features to my program and this would require that i bundle a small c compiler with my program. On Unix it seems that tiny-c can do this, but i don't know about windows.
0
7046
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
6908
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
7048
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6741
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6956
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...
1
4783
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4485
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
183
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.