Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 05-12-2011, 06:02 PM   #1
Bama
Confirmed User
 
Join Date: Nov 2001
Location: Redmond, WA
Posts: 2,727
Any Bored Programmers?

So I was looking around for a script kinda' like the debt clock but on a much smaller scale and after a few hours of looking finally came across a thread that got close to what I wanted.

Variables I'd like to have:

Count up in cents and show that in the count
Set how much (in dollars) it counts up every 24 hours (thinking around 5 or 6 bucks/day)
Set starting amount (does this already)

PHP Code:
<html>
<
head>
<
script type="text/javascript">
function 
startTime()
{
   var 
today=new Date();
   var 
h=today.getHours();
   var 
m=today.getMinutes();
   var 
s=today.getSeconds();
   var 
ms=today.getTime();
   var 
moneySavedPerSecond 5.47;/*in dollars*/
   
var startDate 1301802459944;/*In milliseconds from Jan 1, 1970*/
   
var startSavings 1000;
   var 
totalSaved=Math.round(((ms-startDate)/1000)*moneySavedPerSecond+startSavings);
   
// add a zero in front of numbers<10
   
m=checkTime(m);
   
s=checkTime(s);
   
   
totalString totalSaved+''//converts number into string
   
totalString addCommas(totalString); //calls the addCommas function and returns the value with the commas
   
document.getElementById('txt').innerHTML="Our customers have saved $"+totalString+" with us.";
   
t=setTimeout('startTime()',100);//time in milliseconds for the total to be updated
}

function 
checkTime(i)
{
if (
i<10)
{
   
i="0" i;
}
return 
i;
}


function 
addCommas(nStr//function from http://www.mredkj.com/javascript/nfbasic.html
{
nStr += '';
nStr.split('.');
x1 x[0];
x2 x.length '.' x[1] : '';
var 
rgx = /(\d+)(\d{3})/;
while (
rgx.test(x1)) {
x1 x1.replace(rgx'$1' ',' '$2');
}
return 
x1 x2;
}

</script>
</head>

<body onload="startTime()">
<div id="txt">If you can read this something went wrong.</div>

</body>
</html> 
Bama is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-12-2011, 06:13 PM   #2
ThatOtherGuy - BANNED FOR LIFE
So Fucking Banned
 
Industry Role:
Join Date: Apr 2011
Posts: 1,241
Oh wow that would be pretty cool.
From what I see it already has those variables.

you could make

moneySavedPerSecond = 5.47

to something like 0.00003 such that it would show slower on the count over time.

you could also insert the variables via PHP so that it might show information that pertains to the visitors input on a previous form.

I will play with it
ThatOtherGuy - BANNED FOR LIFE is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-12-2011, 06:15 PM   #3
blackmonsters
Making PHP work
 
blackmonsters's Avatar
 
Industry Role:
Join Date: Nov 2002
Location: 🌎🌅🌈🌇
Posts: 20,231
Quote:
Originally Posted by Bama View Post
So I was looking around for a script kinda' like the debt clock but on a much smaller scale and after a few hours of looking finally came across a thread that got close to what I wanted.

Variables I'd like to have:

Count up in cents and show that in the count
Set how much (in dollars) it counts up every 24 hours (thinking around 5 or 6 bucks/day)
Set starting amount (does this already)

PHP Code:
<html>
<
head>
<
script type="text/javascript">
function 
startTime()
{
   var 
today=new Date();
   var 
h=today.getHours();
   var 
m=today.getMinutes();
   var 
s=today.getSeconds();
   var 
ms=today.getTime();
   var 
moneySavedPerSecond 5.47;/*in dollars*/
   
var startDate 1301802459944;/*In milliseconds from Jan 1, 1970*/
   
var startSavings 1000;
   var 
totalSaved=Math.round(((ms-startDate)/1000)*moneySavedPerSecond+startSavings);
   
// add a zero in front of numbers<10
   
m=checkTime(m);
   
s=checkTime(s);
   
   
totalString totalSaved+''//converts number into string
   
totalString addCommas(totalString); //calls the addCommas function and returns the value with the commas
   
document.getElementById('txt').innerHTML="Our customers have saved $"+totalString+" with us.";
   
t=setTimeout('startTime()',100);//time in milliseconds for the total to be updated
}

function 
checkTime(i)
{
if (
i<10)
{
   
i="0" i;
}
return 
i;
}


function 
addCommas(nStr//function from http://www.mredkj.com/javascript/nfbasic.html
{
nStr += '';
nStr.split('.');
x1 x[0];
x2 x.length '.' x[1] : '';
var 
rgx = /(\d+)(\d{3})/;
while (
rgx.test(x1)) {
x1 x1.replace(rgx'$1' ',' '$2');
}
return 
x1 x2;
}

</script>
</head>

<body onload="startTime()">
<div id="txt">If you can read this something went wrong.</div>

</body>
</html> 

I'm bored if you have $50.
__________________
Make Money with Porn
blackmonsters is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-12-2011, 06:25 PM   #4
woj
<&(©¿©)&>
 
woj's Avatar
 
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
If you are looking to invest a few bucks to have it fixed, hit me up, icq: 33375924
__________________
Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager
woj is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-12-2011, 06:29 PM   #5
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,266
woj is good coder, he can do it

insert pic of rob shneider
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-12-2011, 06:54 PM   #6
blackmonsters
Making PHP work
 
blackmonsters's Avatar
 
Industry Role:
Join Date: Nov 2002
Location: 🌎🌅🌈🌇
Posts: 20,231
Here bro.

I took out all that stuff in the other script that actually did nothing and
this is all you need.

It adds 1 cent every second.

PHP Code:
<html>
<
head>
<
script type="text/javascript">
var 
cents=0;
var 
dollars=0;
function 
startTime()
{

   var 
updatesecs 1000;
   var 
strcents 0;
   
cents+= 1;

   if (
cents>99) {
    
cents0;
    
dollars+=1;
   }

   if (
cents<10) {
    
strcents "0" cents;
   }else {
    
strcents cents;
   }

   
document.getElementById('txt').innerHTML="I have lost $"dollars "\." strcents " while reading this post on GFY.";
   
t=setTimeout('startTime()',updatesecs);//time in milliseconds for the total to be updated
}



</script>
</head>

<body onload="startTime()">
<div id="txt">If you can read this something went wrong.</div>

</body>
</html> 
__________________
Make Money with Porn
blackmonsters is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-12-2011, 07:21 PM   #7
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,058
http://madspiders.com/testcounter.htm

It is right now set to add .00006944 dollars every second which is about $6.00 a day. Pretty boring though because it only clicks off a cent every 2.5 minutes.

PHP Code:
<html
<
head
<
script type="text/javascript"
function 
startTime() 

   var 
today=new Date(); 
   var 
h=today.getHours(); 
   var 
m=today.getMinutes(); 
   var 
s=today.getSeconds(); 
   var 
ms=today.getTime(); 
   
//var moneySavedPerSecond = 5.47;/*in dollars*/ 
   
var moneySavedPerSecond .00006944;/*in dollars*/
   
var startDate 1301802459944;/*In milliseconds from Jan 1, 1970*/ 
   
var startSavings 1000.00
   
//var totalSaved=Math.round(((ms-startDate)/1000)*moneySavedPerSecond+startSavings); 
   
var totalSaved=((ms-startDate)/1000)*moneySavedPerSecond+startSavings
   
// add a zero in front of numbers<10 
   
m=checkTime(m); 
   
s=checkTime(s);
  
   
totalString formatNumber(totalSaved,2,',','.','$','','','');
   
//totalString = addCommas(totalString); //calls the addCommas function and returns the value with the commas 
   
document.getElementById('txt').innerHTML="Our customers have saved "+totalString+" with us."
   
t=setTimeout('startTime()',100);//time in milliseconds for the total to be updated 


// number formatting function  
// copyright Stephen Chapman 24th March 2006, 10th February 2007  
// permission to use this function is granted provided  
// that this copyright notice is retained intact  
// from http://ntt.cc/2008/04/25/6-very-basic-but-very-useful-javascript-number-format-functions-for-web-developers.html
function formatNumber(num,dec,thou,pnt,curr1,curr2,n1,n2)  
{  
  var 
Math.round(num Math.pow(10,dec));  
  if (
>= 0n1=n2='';   
  var 
= (''+Math.abs(x)).split('');  
  var 
y.length dec;   
    
  if (
z<0z--;   
  for(var 
z0i++)  
     
y.unshift('0');   
  
y.splice(z0pnt);  
  if(
y[0] == pnty.unshift('0');   
  while (
3)  
  {  
       
z-=3;  
       
y.splice(z,0,thou);  
  }   
  var 
curr1+n1+y.join('')+n2+curr2;  

  return 
r;  


function 
checkTime(i

if (
i<10

   
i="0" i

return 
i



function 
addCommas(nStr//function from http://www.mredkj.com/javascript/nfbasic.html 

nStr += ''
nStr.split('.'); 
x1 x[0]; 
x2 x.length '.' x[1] : ''
var 
rgx = /(d+)(d{3})/; 
while (
rgx.test(x1)) { 
x1 x1.replace(rgx'$1' ',' '$2'); 

return 
x1 x2


</script> 
</head> 

<body onload="startTime()"> 
<div id="txt">If you can read this something went wrong.</div> 

</body> 
</html> 
__________________
All cookies cleared!
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-12-2011, 07:49 PM   #8
blackmonsters
Making PHP work
 
blackmonsters's Avatar
 
Industry Role:
Join Date: Nov 2002
Location: 🌎🌅🌈🌇
Posts: 20,231
I forgot you needed that to be set by time of day each time.

Here is the script :

Just set "dailyamount" to the dollar amount you want total for the day.

I have it set to 500 dollars a day now in the script :



Quote:
<html>
<head>
<script type="text/javascript">
dailyamount = 500; // daily dollar amount. example 5 will equal 5 dollars per day

// edit above only
dailyamount=dailyamount*100;

var cents=0;
var dollars=0;
function startTime()
{

var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();

dec=0;
outx=new Array();
var xx = new Array();
h=h*3600;
m=m*60
tt = m+h+s;
tt = Math.floor(dailyamount/86400 * tt);
tt+="";
xx = tt.split("");
xx = xx.reverse();
for (i=0;i<xx.length;i++) {
if ((i>1) && (dec==0) ){dec=1; outx.push(".");}
outx.push(xx[i]);
}
outx=outx.reverse();
money = outx.join("");
if (xx.length == 1) {money = "0.0" + money}
if (xx.length == 2) {money = "0." + money}

var updatesecs = 1000;
var strcents = 0;

document.getElementById('txt').innerHTML= "We have made "+ money + " today!";
t=setTimeout('startTime()',updatesecs);//time in milliseconds for the total to be updated
}



</script>
</head>

<body onload="startTime()">
<div id="txt">If you can read this something went wrong.</div>

</body>
</html>
__________________
Make Money with Porn

Last edited by blackmonsters; 05-12-2011 at 07:51 PM..
blackmonsters is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-12-2011, 07:55 PM   #9
blackmonsters
Making PHP work
 
blackmonsters's Avatar
 
Industry Role:
Join Date: Nov 2002
Location: 🌎🌅🌈🌇
Posts: 20,231
Wait!

Do you want the total to rollover to the next day?

I didn't do that.

Sorry.

But that's enough for free.
__________________
Make Money with Porn
blackmonsters is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-13-2011, 12:01 AM   #10
helterskelter808
So Fucking Banned
 
Industry Role:
Join Date: Sep 2010
Posts: 3,405
Rather than mess around with what you posted I wrote something that does what I think you're asking for. You can choose the amount per day and/or the start figure, and it increments in cents. And it's short (shorter than this post).

In the code below it's 1000 (or thereabouts) and 500 for the daily increase just to see it working, because $5/6 a day increases at a boring 1 cent every ~3 minutes.

BTW the higher the daily figure the higher the start figure, because it's client side script. Everyone's computer clock is different and it needs a fixed base time to compare to, long enough ago to be in the past for the whole world, and the number will be different for everyone in the world. This isn't an issue with $5 a day, but with 500, as below, you might be wondering why it's so much over 1000.

I must have misread your post because I thought you required commas. Rather than bloat it with another function I added a couple of lines for one comma, which is all you need for any number up to 999,999. If you start at $1000 and increase at $5 a day it will take about 550 years before that becomes an issue. I'll be happy to fix it if I'm around then.

As for people asking for money for a few lines of jabbascript... are you shitting me?

Hope it helps.

Code:
<html>
<head>
<script type="text/javascript">
function saved(){
  var start = 1000; // start figure (appr)
  var perday = 500; // amount per day increase
  var spd = 86400000/perday;
  var update = spd/100;
  var now = +new Date();
  var basetime = 1305100000000;
  var dif = now - basetime;
  var money = dif/spd + start;
  var save = (Math.round(money*100)/100).toFixed(2);
  var len = save.length;
  var save = save.substring(0, len-6) + "," + save.substring(len-6);

  document.getElementById('txt').innerHTML="Our customers have saved $"+save+" with us. ";
  t=setTimeout('saved()',update);
}
  </script>
</head>
<body onload="saved()">
<div id="txt">If you can read this something went wrong.</div>

</body>
</html>
helterskelter808 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-13-2011, 12:24 AM   #11
sabin
Registered User
 
sabin's Avatar
 
Industry Role:
Join Date: May 2011
Location: USA
Posts: 60
I'll take a look in the morning, bump this tomorrow to remind me.
__________________
Add to my Site: Add your URL | Add a Pornstar |
sabin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.