Marc vChat Developer
I <3 Rossy
Posts: 3,388 Status: Offline Gender: Male Location: Ontario, Canada Age: 32 Joined:
Additional Groups: Coding Team
pmwww | Lottery System v1 (24th Jan 08 at 1:41am UTC) | | This code is admin editable. It adds a link to your admin area. Click on the link, and it takes you to a page with instructions. Click on one of the links, and you will have your Lottery system up and running.
Every member sees the exact same numbers, and they do not change after every new page load. Only those with access to the admin area can enable/disable the lottery system.
The Code - Edit the footer.
Part 1: Main Header
Code: - <script type="text/javascript">
- <!--
- /*
- Lottery System v1 by Cr0w
- Copyright 2008
- Do not repost
- MAIN HEADER
- */
-
- xxOn="yes"
- xx="26"
- xx1="10"
- xx2="66"
- xx3="53"
- LotteryNumbers = "";
-
- if(xxOn=="yes"){
- LotteryNumbers += '<table width="250px" cellpadding="4" cellspacing="1" align="center" class="border" id="LottoTable">';
- LotteryNumbers += '<tr>';
- LotteryNumbers += '<td class="title1" width="100%" colspan="2" align="center">';
- LotteryNumbers += '<font size=2><b>Winning Lotto Numbers</B></font>';
- LotteryNumbers += '</td>';
- LotteryNumbers += '</tr>';
- LotteryNumbers += '<tr>';
- LotteryNumbers += '<td width="100%" class="window2" align="center" id="LotteryTable" style="height: 30px">';
- LotteryNumbers += '</td>';
- LotteryNumbers += '</tr>';
- LotteryNumbers += '</table>';
- }
- document.write(LotteryNumbers);
- //-->
- </script>
Part 2: Main Footer
Code: - <script type="text/javascript">
- <!--
- /*
- Lottery System by Cr0w
- Copyright 2008
- Do not repost
- MAIN FOOTER
- */
-
- var HighNum="99" //Edit this to the highest number the lottery can go up to
-
- if(location.href.match(/system\/lottery/)){
- document.title = document.title.replace('Modify Headers and Footers','Lottery Settings');
- Table = document.getElementsByTagName('Table');
- for(t=4;t<Table.length;t++){
- Table.item(t).style.display = 'none'
- }
- var x=Math.round(Math.random()*HighNum)
- var x1=Math.round(Math.random()*HighNum)
- var x2=Math.round(Math.random()*HighNum)
- var x3=Math.round(Math.random()*HighNum)
- LottoBody = '<div style="display: none">';
- LottoBody += '<input type="text" value="'+x+'" id="Lottonum">';
- LottoBody += '<input type="text" value="'+x1+'" id="Lottonum1">';
- LottoBody += '<input type="text" value="'+x2+'" id="Lottonum2">';
- LottoBody += '<input type="text" value="'+x3+'" id="Lottonum3">';
- LottoBody += '</div>';
- LottoBody += '<table border="0" cellpadding="4" cellspacing="1" class="border" width="92%" align="center">';
- LottoBody += '<tr>';
- LottoBody += '<td class="title1"><b>Lottery Settings</b></td></tr>';
- LottoBody += '<tr><td class="window1">Click the "Activate Lottery" button to enable the lottery system. Once you click the button, the lottery table will be displayed, along with 4 randomly selected numbers. These numbers will remain the same to everyone on your forum.<br /><br /> Once you click the "De-activate Lottery" button, the table will disappear, and will once again be displayed when you click on "Activate Lottery" again.';
- LottoBody += '</td></tr><tr>';
- LottoBody += '<td class="window1">';
- LottoBody += '<center><input type="button" value="Activate Lottery" onclick="LottoSave()"> <input type="button" value="De-activate Lottery" onclick="LottoOff()"></center>';
- LottoBody += '</td></tr></table>';
- document.write(LottoBody);
- function LottoSave(){
- var xxxOn= document.getElementById('LottoOn');
- var xxx= document.getElementById('Lottonum');
- var xxx1= document.getElementById('Lottonum1');
- var xxx2= document.getElementById('Lottonum2');
- var xxx3= document.getElementById('Lottonum3');
-
- header = document.getElementsByName('header').item(0);
- header.value = header.value.replace(new RegExp('xxOn="'+xxOn+'"',"i"),'xxOn="yes"');
- header.value = header.value.replace(new RegExp('xx="'+xx+'"',"i"),'xx="'+xxx.value+'"');
- header.value = header.value.replace(new RegExp('xx1="'+xx1+'"',"i"),'xx1="'+xxx1.value+'"');
- header.value = header.value.replace(new RegExp('xx2="'+xx2+'"',"i"),'xx2="'+xxx2.value+'"');
- header.value = header.value.replace(new RegExp('xx3="'+xx3+'"',"i"),'xx3="'+xxx3.value+'"');
- document.forms.item(0).submit(true);
- }
- function LottoOff(){
- header = document.getElementsByName('header').item(0);
- header.value = header.value.replace(new RegExp('xxOn="'+xxOn+'"',"i"),'xxOn="no"');
- document.forms.item(0).submit(true);
- }
- }
- document.getElementById("LotteryTable").innerHTML = +xx+', '+xx1+', '+xx2+', '+xx3;
-
- var div = document.getElementsByTagName('ul');
- for(q=0;q<div.length;q++){
- if(div[q].innerHTML.match(/Recycle\sBin/i)){
- div[q].innerHTML+='<li><a href="/action/admin/page/headers_footers/header_footer_id/-/system/lottery">Lottery System</a></li>';
- }}
- //-->
- </script>
| |
rroll.to— Shorten a link, rickroll your friends. |
|
Vanquish Junior Member
Posts: 64 Status: Offline Gender: Male Location: Northern Ireland Age: 35 Joined:
pmvForum | Re: Lottery System v1 (24th Jan 08 at 1:50am UTC) | | I cant find the link in the admin panel =/
Maybe im just blind and tired... but I dont think its there. Got a good idea on how this code can be used too | |
|
|
Marc vChat Developer
I <3 Rossy
Posts: 3,388 Status: Offline Gender: Male Location: Ontario, Canada Age: 32 Joined:
Additional Groups: Coding Team
pmwww | Re: Lottery System v1 (24th Jan 08 at 1:51am UTC) | | At the bottom of "General Settings" | |
rroll.to— Shorten a link, rickroll your friends. |
|
Vanquish Junior Member
Posts: 64 Status: Offline Gender: Male Location: Northern Ireland Age: 35 Joined:
pmvForum | Re: Lottery System v1 (24th Jan 08 at 1:52am UTC) | | Ah that would be why...
Was going to try to add it to one board only. | |
|
|
Marc vChat Developer
I <3 Rossy
Posts: 3,388 Status: Offline Gender: Male Location: Ontario, Canada Age: 32 Joined:
Additional Groups: Coding Team
pmwww | Re: Lottery System v1 (24th Jan 08 at 1:53am UTC) | | Ah that would be why...
Was going to try to add it to one board only.
Ahh, I'll keep that in mind for v2. [I made this code back in 2006; I think it's time for an update. ] | |
rroll.to— Shorten a link, rickroll your friends. |
|
dog199200 Guest | Re: Lottery System v1 (24th Jan 08 at 5:13am UTC) | | so umm i suggested this like back when it was made..umm again..can you please make it so members can be inserted again if so this would be an awesome code for deciding the member of the month. | |
|
Marc vChat Developer
I <3 Rossy
Posts: 3,388 Status: Offline Gender: Male Location: Ontario, Canada Age: 32 Joined:
Additional Groups: Coding Team
pmwww | Re: Lottery System v1 (24th Jan 08 at 5:41pm UTC) | | Yep, that's also in the works for v2.
Just post here if you have any other suggestions for it. | |
rroll.to— Shorten a link, rickroll your friends. |
|
MiNiCliP™ New Member
And Im Back..... Posts: 9 Status: Offline Gender: Male Joined:
pm | Re: Lottery System v1 (20th Apr 08 at 4:58am UTC) | | Oh Never Mind I Misplaced The code on The Global H/F's
So It's Resolved | |
|
|
Marc vChat Developer
I <3 Rossy
Posts: 3,388 Status: Offline Gender: Male Location: Ontario, Canada Age: 32 Joined:
Additional Groups: Coding Team
pmwww | Re: Lottery System v1 (20th Apr 08 at 4:59am UTC) | | Alright, glad you got it working. | |
rroll.to— Shorten a link, rickroll your friends. |
|
dog199200 Guest | Re: Lottery System v1 (17th Oct 08 at 8:20am UTC) | | Still planning on making an update for it Marc? | |
|
Marc vChat Developer
I <3 Rossy
Posts: 3,388 Status: Offline Gender: Male Location: Ontario, Canada Age: 32 Joined:
Additional Groups: Coding Team
pmwww | Re: Lottery System v1 (20th Oct 08 at 9:47pm UTC) | | v2's sitting on one of my test boards about half complete; I might toss together some loose ends and release a v1.5 sometime soon if I've got time. | |
rroll.to— Shorten a link, rickroll your friends. |
|
dog199200 Guest | Re: Lottery System v1 (20th Oct 08 at 10:05pm UTC) | | ah ok I see, well i hope it comes together nicely | |
|
Aiken Full Member
Posts: 333 Status: Offline Gender: Male Location: In a very lonely place, the domain of despair Age: 35 Joined:
pmskypemsnyahooxfire | |
dog199200 Guest | Re: Lottery System v1 (24th May 10 at 3:45am UTC) | | Nope, but we are talking about Marc here, the one who openly admits to procrastination | |
|
Marc vChat Developer
I <3 Rossy
Posts: 3,388 Status: Offline Gender: Male Location: Ontario, Canada Age: 32 Joined:
Additional Groups: Coding Team
pmwww | Re: Lottery System v1 (24th May 10 at 8:54pm UTC) | | Nope, but we are talking about Marc here, the one who openly admits to procrastination
Don't forget laziness; procrastination and laziness...one dangerous combination.
But yeah, in a few weeks (when my Co-op is done and my summer officially starts) I plan to go through all of my old codes and revamp them, as well as hopefully get a few more up. | |
rroll.to— Shorten a link, rickroll your friends. |
|