Go Back   Trackpads Community > General Discussions > Computer and Technology > Web Design

Web Design Forums and discussions on webdesign

Web Design

Reply
 
LinkBack Thread Tools
Old 02-04-2005, 08:00   #1 (permalink)
plato
Civilians

 
Default Allowing a script to run only once...

My site is predominantly php...photo gallery... and the index page displays
thumbs ( at random) from each of the 20 galleries. When people click on a
gallery they go to that gallery to look at paintings and ultimately come
back to Home which is the index page.

I want to run a javascript on the index page that will only run when they
arrive at the site, not again when they return to the index page... can
someone tell me how I accomplish this.

cheers

Plato


 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Trackpads Information
Click to Visit
Old 02-04-2005, 12:00   #2 (permalink)
Gerry for email use my name at dergal dt com
Civilians

 
Default Re: Allowing a script to run only once...

plato wrote:
> My site is predominantly php...photo gallery... and the index page displays
> thumbs ( at random) from each of the 20 galleries. When people click on a
> gallery they go to that gallery to look at paintings and ultimately come
> back to Home which is the index page.
>
> I want to run a javascript on the index page that will only run when they
> arrive at the site, not again when they return to the index page... can
> someone tell me how I accomplish this.
>
> cheers
>
> Plato
>
>

Completely honestly - you can't ...

However by checking against IP addresses, or cookies you sort of can -
i.e. create a cookie, Alternatively - could all your "homepage" links be
a different homepage?

G
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-04-2005, 12:00   #3 (permalink)
Ryan
Civilians

 
Default Re: Allowing a script to run only once...

use a php query string on the index page?...

if ($HTTP_GET_VARS['giver'])
{
echo $javascript_code;
}


or you could always an index2.html page or something... the page will be
exactly like index.html, but without the javascript. And put the link to
index2.html on all of the other pages instead of index.html so no one goes
back to it.


hope this helps.

-Ryan


"plato" <platoTAKETHISOUT@telpacific.com.au> wrote in message
news:42036279@news.rivernet.com.au...
> My site is predominantly php...photo gallery... and the index page
> displays
> thumbs ( at random) from each of the 20 galleries. When people click on a
> gallery they go to that gallery to look at paintings and ultimately come
> back to Home which is the index page.
>
> I want to run a javascript on the index page that will only run when they
> arrive at the site, not again when they return to the index page... can
> someone tell me how I accomplish this.
>
> cheers
>
> Plato
>
>



 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-04-2005, 12:00   #4 (permalink)
Mark Hewitt
Civilians

 
Default Re: Allowing a script to run only once...


"plato" <platoTAKETHISOUT@telpacific.com.au> wrote in message
news:42036279@news.rivernet.com.au...
> My site is predominantly php...photo gallery... and the index page
> displays
> thumbs ( at random) from each of the 20 galleries. When people click on a
> gallery they go to that gallery to look at paintings and ultimately come
> back to Home which is the index page.
>
> I want to run a javascript on the index page that will only run when they
> arrive at the site, not again when they return to the index page... can
> someone tell me how I accomplish this.


The easy way to do it is just have index.php as the page you want them to
see at the start, and then have all links to your home page point at
home.php, for example.

Otherwise you are going to have to either use cookies or keep a record of
their IP address and look it up every time they access the page. Myself I
prefer the easy approach to most situations ;-)


 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-04-2005, 12:00   #5 (permalink)
Matt Probert
Civilians

 
Default Re: Allowing a script to run only once...

Once upon a time, far far away, the king summoned "plato"
<platoTAKETHISOUT@telpacific.com.au> who replied:

>My site is predominantly php...photo gallery... and the index page displays
>thumbs ( at random) from each of the 20 galleries. When people click on a
>gallery they go to that gallery to look at paintings and ultimately come
>back to Home which is the index page.
>
>I want to run a javascript on the index page that will only run when they
>arrive at the site, not again when they return to the index page... can
>someone tell me how I accomplish this.
>


Require them to sign in, and use strict checking to ensure they only
create one account, perhaps by charging thousands of dollars. Then,
you can show the gallery when they register and never again to that
account!

Brilliant, aint I ?

What's that? Time for my lobotomy?

<BG>

Matt

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-04-2005, 16:00   #6 (permalink)
plato
Civilians

 
Default Re: Allowing a script to run only once...


"Mark Hewitt" <mail@markhewittDotCoDotUk.spammers.will.die> wrote in message
news:ctvvki$obr$1@ucsnew1.ncl.ac.uk...
>
> "plato" <platoTAKETHISOUT@telpacific.com.au> wrote in message
> news:42036279@news.rivernet.com.au...
> > My site is predominantly php...photo gallery... and the index page
> > displays
> > thumbs ( at random) from each of the 20 galleries. When people click on

a
> > gallery they go to that gallery to look at paintings and ultimately come
> > back to Home which is the index page.
> >
> > I want to run a javascript on the index page that will only run when

they
> > arrive at the site, not again when they return to the index page... can
> > someone tell me how I accomplish this.

>
> The easy way to do it is just have index.php as the page you want them to
> see at the start, and then have all links to your home page point at
> home.php, for example.
>
> Otherwise you are going to have to either use cookies or keep a record of
> their IP address and look it up every time they access the page. Myself I
> prefer the easy approach to most situations ;-)
>
>

Thanks Mark, it seems the concensus is to make all the links except the
arrival page different (ie duplicate the index page and then refer all other
links back to it)...many thanks. Yes I like easy approaches also...
cheers
plato


 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-04-2005, 16:00   #7 (permalink)
plato
Civilians

 
Default Re: Allowing a script to run only once...


"Dave Patton" <spam@trap.invalid> wrote in message
news:Xns95F35B8488D56mrzaphoddirectcaold@24.71.223 .159...
> "plato" <platoTAKETHISOUT@telpacific.com.au> wrote in
> news:42036279@news.rivernet.com.au:
>
> > My site is predominantly php...photo gallery... and the index page
> > displays thumbs ( at random) from each of the 20 galleries. When
> > people click on a gallery they go to that gallery to look at paintings
> > and ultimately come back to Home which is the index page.
> >
> > I want to run a javascript on the index page that will only run when
> > they arrive at the site, not again when they return to the index
> > page... can someone tell me how I accomplish this.

>
> PHP questions would best be asked in a PHP newsgroup ;-)
>
> When http://www.example.com/index.php is requested,
> it checks for the existance of a session variable
> (e.g. "been_here_already"). If it exists, the PHP
> script generates the page, without the javascript.
> If the "been_here_already" session variable does
> not exist, then create it, and generate the page,
> including the javascript. You'll have to pay
> attention to caching issues.
>
> Of course that is predicated on sessions, so it depends
> on what you mean by "arrive at the site".
>
> And, as you should never be reliant on javascript anyway,
> why not just have the PHP script do whatever it is you
> want to do with the javascript.
>
> --
> Dave Patton


Thanks Dave, often hard to know whether the answer lies in a php script or a
simple html solution. I'm sure lots of guys here know both anyway as i
regard this group as a 'mob of all rounders'...

Again seems the problems of a php solution can be overcome by duplicating
the index page and changing all links on site back to the mirror page and
run the script only on the index page. PHP can't do what the javascript can
in this instance (running msagent character)

cheers
plato


 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
simple setup for allowing visitors to choose their country Nicole Web Design 8 10-25-2005 22:03
DoD Allowing More Wounded Troops to Remain on Duty cato2 DOD News Services 1 10-15-2004 19:59
DoD Allowing More Wounded Troops to Remain on Duty Press Service DOD News Services 0 10-14-2004 22:00
F2 (Refresh) stops allowing me to overwrite after the second character dep397 Microsoft Applications 4 06-16-2004 00:04
Allowing text to overlap other cells Scot Microsoft Applications 2 06-15-2004 16:30


Community Information
Options
Quick Options
Trackpads Non-Commercial Ad
Copyright Information Click to Visit
Time
Server Time
All times are GMT -4. The time now is 11:11.
Copyright
Copyright Information
The header is based off of work by Vipixel.com and modified by this site. Trackpads and the Trackpads Logo are both Registered Trademarks of Jason Edwards and cannot be used without prior written permission.  The only exception is as a link back to this site. Trackpads is a private website run by a small legion of volunteers, 3 dogs, 12.5 cats and an army of small, super smart, bio-engineered mice with pointy hats and tutu's. Search Engine Friendly URLs by vBSEO 3.2.0 RC7
Archive Links
Archive Links
Page generated in 1.00483 seconds with 19 queries