0

TrafficMad

Dear Sir,
I am trying to help a friend develop a “ prize page” for an existing site.
While researching this I came across a script that I think this script could be adapted for my idea without too much trouble. Below my signature is the old “Lets Make a Deal “ TV program :
I do not have the original script you would be adding to. I do have the hosting and cpanel info.
[snipped site and login]
What I am trying to do is replace or add a prize page that comes up every XX pages surfed. The new page would consist of three muscle cars that the user would click on their choice (hood is down). Choice would appear with hood up, showing engine which would have a changeable by admin prize in a space on the air cleaner of the engine (would be a point prize).

If you are interested in this please reply to this email as I am unable to speak on telephone. I will furnish graphics.
Best Regards,
Curt Bridges

Java Code Here:

doc = document;
function init()
{
// set up objects
stob = doc.forms["teaser"].stayer;
rob = doc.forms["teaser"].randomer;
swob = doc.forms["teaser"].switcher;
}
function proveIt()
{
// create/clear out array
doors = new Array(false,false,false);
// reset tallies
stwin = 0;
stloss = 0;
rwin = 0;
rloss = 0;
swwin = 0;
swloss = 0;
// clear out textareas
stob.value = "";
rob.value = "";
swob.value = "";
// loop through 100 times
for (l=100;l>0;l--)
{
// decide which door holds the prize
d = rand(3);
doors[d] = true;
// randomly pick a door
p = rand(3);
// randomly remove one of the loser doors
removed = false;
while (!removed)
{
r = rand(3);
if (r != d && r != p)
{
removedvalue = r;
removed = true;
}
}
// for randomer, randomly switch/stay
ss = rand(2);
if (ss==0)
{
// switch
switchstay = false;
while (!switchstay)
{
s1 = rand(3);
if (s1 != p && s1 != removedvalue)
{
switchstayvalue = s1;
switchstay = true;
}
}
}
else
{
// stay
switchstayvalue = p;
}
// for switcher, switch
for (s2=0;s2<3;s2++)
{
if (s2 != p && s2 != removedvalue)
{
switchervalue = s2;
switcher = true;
break;
}
}
// determine outcomes
// stayer
if (d==p)
{
stwin++;
stob.value = stwin + " Winner\n" + stob.value;
}
else
{
stloss++;
stob.value = stloss + " Loser\n" + stob.value;
}
// randomer
if (d==switchstayvalue)
{
rwin++;
rob.value = rwin + " Winner\n" + rob.value;
}
else
{
rloss++;
rob.value = rloss + " Loser\n" + rob.value;
}
// switcher
if (d==switchervalue)
{
swwin++;
swob.value = swwin + " Winner\n" + swob.value;
}
else
{
swloss++;
swob.value = swloss + " Loser\n" + swob.value;
}
}
// write final tallies
stob.value = stwin + " winners\n" + stloss + " losses" + "\n-----\n" + stob.value;
rob.value = rwin + " winners\n" + rloss + " losses" + "\n-----\n" + rob.value;
swob.value = swwin + " winners\n" + swloss + " losses" + "\n-----\n" + swob.value;
}
// The Central Randomizer 1.3 (C) 1997 by Paul Houle (houle@msc.cornell.edu)
// See: http://www.msc.cornell.edu/~houle/Ja...andomizer.html
// Usage: rand(n) returns random integer between 0 and n-1
rnd.today = new Date();
rnd.seed = rnd.today.getTime();
function rnd()
{
rnd.seed = (rnd.seed*9301+49297) % 233280;
return rnd.seed/(233280.0);
}
function rand(number)
{
return Math.ceil(rnd()*number)-1;
}
</script> 

Edited by Ezzaral: Snipped url and access info. Not necessary for the question.

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by wheels031799
0

You realize you posted the username and password and that anyone can change your profile. What is stopping me from changing your password right now?

0

Also, using javascript to do all the work (generate a random value and use it as the final result) is very bad. Why? I could override your function or just manipulate certain values and I will always win prizes. ;)

0

Thanks, my mind, just doesn't work that way. Can you please help with this project?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.