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 HeaderCode:
- <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 FooterCode:
- <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>
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
At the bottom of "General Settings"
Ah that would be why...
Was going to try to add it to one board only.
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. ]
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.
Yep, that's also in the works for v2.
Just post here if you have any other suggestions for it.
Oh Never Mind I Misplaced The code on The Global H/F's
So It's Resolved
Alright, glad you got it working.
Still planning on making an update for it Marc?
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.
ah ok I see, well i hope it comes together nicely
Over a year and still no v2?
Nope, but we are talking about Marc here, the one who openly admits to procrastination
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.
Well that is nice to hear. I don't use a lot of codes here at all, all the codes I used all got replaced by the template system but it would be nice to see some new codes around since you, ross, and michael are the only people here that do any codes for the community.
I just added this code to one of my forums, I'm a code-aholic