I have a php site I have an include line called "include 'Cookie.php';"
In this Cookie.php file I have these codes.
<?php
$conn = mysql_connect(" $db", "$user", "$pass");
mysql_select_db ("$db");
//--------------------------------------------------------------------------
-------------
//COOKIE
//--------------------------------------------------------------------------
-------------
$cookiename = 'TourCounter';
if( isset( $_COOKIE[$cookiename] ) ){$user_id = $_COOKIE[$cookiename];}
else {
mysql_query ("INSERT INTO CountUser (Dato) VALUES (now())");
$user_id = mysql_insert_id ();
setcookie( $cookiename, $user_id, time()+31536000 0);
;}?>
This will set a cookie on the computer when people enters the site for the
first time, and update my database.
Now I can see how many new computers that see my site each day, and it works
fine.
BUT, now I have another site where all the pages are .shtml sites, and I
have not been using any php scripting at all, though it is uploadet on a
server where I can use php.
But now I can't include the file, cause if I write <!--#include
file="Cookie.ph p"--> it includes some php codes, but since the site is
called .shtml it offcause can't execute the php script.
But isn't there a way to do this anyway.
Maybe by some javascript that executes the Cookie.php fil or something. ??
The site has a lot a pages, and I would rather not rename them all to .php
and the shtml include to php include on all the pages.
I have a menu that is included on all the pages, so if it could be executed
in the menu file, I will count all hits, nomatter what site people enters
first.
Hope someone have a good idea.
best
Michael 10 3158
EnjoyNews said: I have a php site I have an include line called "include 'Cookie.php';"
In this Cookie.php file I have these codes.
You seem to be asking a PHP question in a Javascript newsgroup.
Asking in a more appropriate place will produce better answers.
"Lee" <RE************ **@cox.net> skrev i en meddelelse
news:dj******** *@drn.newsguy.c om... EnjoyNews said: I have a php site I have an include line called "include 'Cookie.php';"
In this Cookie.php file I have these codes.
You seem to be asking a PHP question in a Javascript newsgroup. Asking in a more appropriate place will produce better answers.
No I not asking a php question.
The php script is working fine on my other site, which is coded in php.
But now I need the php script to be executed from a .shtml site.
So now I can't include the Cookie.php script, since it only works if the
site is called .php
So therefore I'm asking here if I somehow can execute a .php fil with
jacvascript.
On 27/10/2005 15:47, EnjoyNews wrote:
[snip] But now I need the php script to be executed from a .shtml site.
That still isn't a question for this group. That's a server
configuration issue.
What's a .shtml site, anyway?
So now I can't include the Cookie.php script, since it only works if the site is called .php
The extension used is really rather irrelevant. A server could send
files that have the extension .cheese to PHP.
If you want the server to pass a file through PHP, then either name that
file in a way that will make the server do that (usually using an .php
extension), or change the server configuration.
[snip]
Mike
--
Michael Winter
Prefix subject with [News] before replying by e-mail.
EnjoyNews wrote: I have a php site I have an include line called "include 'Cookie.php';"
In this Cookie.php file I have these codes.
<?php $conn = mysql_connect(" $db", "$user", "$pass"); mysql_select_db ("$db");
//-------------------------------------------------------------------------- ------------- //COOKIE //-------------------------------------------------------------------------- ------------- $cookiename = 'TourCounter'; if( isset( $_COOKIE[$cookiename] ) ){$user_id = $_COOKIE[$cookiename];} else { mysql_query ("INSERT INTO CountUser (Dato) VALUES (now())"); $user_id = mysql_insert_id (); setcookie( $cookiename, $user_id, time()+31536000 0); ;}?>
This will set a cookie on the computer when people enters the site for the first time, and update my database. Now I can see how many new computers that see my site each day, and it works fine.
BUT, now I have another site where all the pages are .shtml sites, and I have not been using any php scripting at all, though it is uploadet on a server where I can use php.
But now I can't include the file, cause if I write <!--#include file="Cookie.ph p"--> it includes some php codes, but since the site is called .shtml it offcause can't execute the php script.
But isn't there a way to do this anyway. Maybe by some javascript that executes the Cookie.php fil or something. ?? The site has a lot a pages, and I would rather not rename them all to .php and the shtml include to php include on all the pages.
I have a menu that is included on all the pages, so if it could be executed in the menu file, I will count all hits, nomatter what site people enters first.
Hope someone have a good idea.
best Michael
One option to explore may be to use some kind of remote scripting
solution, such as HTTPRequest. There is a lot of information to be
found on the HTTPRequest object.
I.e. when your menu file is loaded and run, you make an HTTPRequest to
"Cookie.php ".
E.g. something like:-
var oHTTP=new ActiveXObject(" Microsoft.XMLHt tp");
oHTTP.open("GET ","Cookie.p hp", false);
oHTTP.send(null );
This is very rough. Have a look at the SARISSA library for
cross-browser versions. It will only work on later browsers, so even if
it works, it may not a complete solution for you.
Julian
EnjoyNews said the following on 10/27/2005 10:47 AM: "Lee" <RE************ **@cox.net> skrev i en meddelelse news:dj******** *@drn.newsguy.c om...
EnjoyNews said:
I have a php site I have an include line called "include 'Cookie.php';"
In this Cookie.php file I have these codes.
You seem to be asking a PHP question in a Javascript newsgroup. Asking in a more appropriate place will produce better answers.
No I not asking a php question. The php script is working fine on my other site, which is coded in php.
But now I need the php script to be executed from a .shtml site. So now I can't include the Cookie.php script, since it only works if the site is called .php
So therefore I'm asking here if I somehow can execute a .php fil with jacvascript.
How about with plain HTML?
<img src="phpFileToE xecute.php" width="0" height="0" style="visibili ty:
hidden">
Or, you could configure your server to parse .shtml files through PHP.
Either way, it has nothing to do with javascript.
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
"Randy Webb" <Hi************ @aol.com> skrev i en meddelelse
news:U7******** ************@co mcast.com... EnjoyNews said the following on 10/27/2005 10:47 AM:
"Lee" <RE************ **@cox.net> skrev i en meddelelse news:dj******** *@drn.newsguy.c om...
EnjoyNews said:
I have a php site I have an include line called "include 'Cookie.php';"
In this Cookie.php file I have these codes.
You seem to be asking a PHP question in a Javascript newsgroup. Asking in a more appropriate place will produce better answers.
How about with plain HTML?
Yes it's simple html. I just told that the site was called shtml, cause
maybe that has something to do with how the javascript should look like.
But yes it is a standard html site. <img src="phpFileToE xecute.php" width="0" height="0" style="visibili ty: hidden">
Is this really possible.... ???
I thought the <img src command could only be used to view images. ???
But if this is possible, it was exactly what I was looking for. A way to
open a file (in this case a .php file) without opening another browser
window or something like that... Or, you could configure your server to parse .shtml files through PHP.
Is this something I do myself, or do I have to ask my webhost about this ?? Either way, it has nothing to do with javascript.
I know this has nothing to do with javascripting, but I didn't know how to
do it in html, so I thought maybe it could be done with javascripting, and
that's why I asked here..
"Michael Winter" <m.******@bluey onder.co.uk> skrev i en meddelelse
news:n_******** ***********@tex t.news.blueyond er.co.uk... On 27/10/2005 15:47, EnjoyNews wrote:
[snip]
But now I need the php script to be executed from a .shtml site. That still isn't a question for this group. That's a server configuration issue.
I thought maybe some javascript in my .html file could execute another file,
in this case a .php file.
That's why I asked here. What's a .shtml site, anyway?
it's a .html file that uses serverside commands like "include file"
It's not important in this case if it's a html or shtml file, that info was
just to inform which file the javascripting should be placed in, if it was
possible. So now I can't include the Cookie.php script, since it only works if the site is called .php
The extension used is really rather irrelevant. A server could send files that have the extension .cheese to PHP.
If you want the server to pass a file through PHP, then either name that file in a way that will make the server do that (usually using an .php extension), or change the server configuration.
It's rather complicated to rename the files from .shtml to .php, since all
the serverside commands used in the files, does not work in an .php file.
That's why I'm not changing the extension.
But how do I get the server to pass .shtml file through PHP. ??
EnjoyNews said the following on 10/27/2005 6:32 PM: "Randy Webb" <Hi************ @aol.com> skrev i en meddelelse news:U7******** ************@co mcast.com...
EnjoyNews said the following on 10/27/2005 10:47 AM:
"Lee" <RE************ **@cox.net> skrev i en meddelelse news:dj***** ****@drn.newsgu y.com...
EnjoyNews said:
>I have a php site I have an include line called "include 'Cookie.php';" > >In this Cookie.php file I have these codes.
You seem to be asking a PHP question in a Javascript newsgroup. Asking in a more appropriate place will produce better answers.
How about with plain HTML?
Yes it's simple html. I just told that the site was called shtml, cause maybe that has something to do with how the javascript should look like. But yes it is a standard html site. <img src="phpFileToE xecute.php" width="0" height="0" style="visibili ty: hidden">
Is this really possible.... ???
Yes, it is really possible. It is the basis of most page hit counters.
I thought the <img src command could only be used to view images. ???
Test it and see :)
But if this is possible, it was exactly what I was looking for. A way to open a file (in this case a .php file) without opening another browser window or something like that...
Yes, very possible.
Or, you could configure your server to parse .shtml files through PHP.
Is this something I do myself, or do I have to ask my webhost about this ??
Your webhost would have to do it.
Either way, it has nothing to do with javascript.
I know this has nothing to do with javascripting, but I didn't know how to do it in html, so I thought maybe it could be done with javascripting, and that's why I asked here..
It can be done with plain HTML.
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
"Randy Webb" <Hi************ @aol.com> skrev i en meddelelse
news:M8******** ************@co mcast.com... EnjoyNews said the following on 10/27/2005 6:32 PM: "Randy Webb" <Hi************ @aol.com> skrev i en meddelelse news:U7******** ************@co mcast.com...
EnjoyNews said the following on 10/27/2005 10:47 AM:
"Lee" <RE************ **@cox.net> skrev i en meddelelse news:dj***** ****@drn.newsgu y.com...
>EnjoyNews said: > > >>I have a php site I have an include line called "include
'Cookie.php';">> >>In this Cookie.php file I have these codes. > >You seem to be asking a PHP question in a Javascript newsgroup. >Asking in a more appropriate place will produce better answers. >
How about with plain HTML?
Yes it's simple html. I just told that the site was called shtml, cause maybe that has something to do with how the javascript should look like. But yes it is a standard html site. <img src="phpFileToE xecute.php" width="0" height="0" style="visibili ty: hidden">
Is this really possible.... ???
Yes, it is really possible. It is the basis of most page hit counters.
I thought the <img src command could only be used to view images. ???
Test it and see :)
I have done what you said, and it works perfect.
So now I can upload my folder called Counter, where the Cookie.php file is
in, and a php site to view the result from my MySQL database.
Then all I have to do is put the line
<img src="Counter/Cookie.php" width="0" height="0">
on a site that is view all the time, like the menu.
And then I can see how many new computer that have entered the site. The
cookie is on each computer for 10 years, so if people doens't reinstall, it
will only count one hits from each computer one time in 10 years.
Thanks a lot for you help :o))
Michael This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: aa |
last post by:
Is it OK to include an ANSI file into a UTF-8 file?
|
by: Spartanicus |
last post by:
For a non essential enhancement of one of my pages I'd like to include a
remote html file via javascript (server side is not available to me).
The "include" method that I'm familiar with:
<script src="include.js" type="text/javascript"></script>
with include.js containing:
document.write("<table>")
|
by: $kr1p7_k177y |
last post by:
-Without using frames.
--
..............................................................................
Chase after truth like hell and you'll free yourself, even though you never
touch its coat-tails.
-Clarence Darrow
|
by: Henri |
last post by:
Hi,
Is there a way to include a .js file inside a .js file in JavaScript 1.5?
Thanx
Henri
|
by: Christopher Benson-Manica |
last post by:
We have a fairly large (1500 line) .js file that contains script that
most of our pages use. My personal opinion is that this is not
easy to maintain, but others are concerned that with the script placed
in separate smaller files the web server will have to process several
other requests for script files, which will impact the performance of
the server. Is that concern well placed? If so, is there some other
way to break up a large...
| |
by: Bill |
last post by:
How can I include a .cgi file in an .ASP file?
I've tried #include, Server.Transfer, and Server.Execute (yes, I know the last two are
only for ASP, but I tried it anyway).
If I have to, I guess I'll use ASPHTTP to do an http call to the file but first I wanted
to see if there was a more elegant way to do it...!
Is there an efficient way to include the output of a .cgi file in an ASP file?
|
by: Jer425 |
last post by:
Hello,
I'm coding in VB and trying to include a jscript file. This will not
work because you can only use one language in asp.net. Is there a way
that I can use the jscript without having to convert it to VB? I heard
something about using a component..is this true? Options?
Thanks all!
|
by: green_tea |
last post by:
Hi there,
I'd like to know how to include a js file globally in asp.net so all my
pages can access js functions in this file. (Only include it once and
not include
this file one by one to all my pages.)
Thanks for your help.
|
by: Academia |
last post by:
I want to include a button that opens a .chm help file on a usercontrol.
I haven't yet looked at how the button is to open the help but before I go
there I need to know how to include the .chm file with the usercontrol so
that it will be available where ever the control is used.
Does anyone know how to include the file?
Thanks
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |