Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Lfe
    Lfe is offline
    New Coder
    Join Date
    Dec 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    well i need help

    i have made a Money Code

    But also i dont know how to do this


    Code:
    document.write("<div id='iholder' style='display:none'></div>");
    var ownurl = 'http://'+this.location.host+this.location.pathname;
    
    function locate(location){
    return (location.test(this.location.href))? true:false;
    }
    
    var ndonn = 0;
    
    function get(val,parent,check){
    if(check){
     var theclasses = [];
     for(var x=0;tag=parent.getElementsByTagName('*')[x];x++){
      if(tag.className == val)
       theclasses.push(tag);
     }
     return theclasses;
    }else{
     return (parent.getElementsByTagName(val)[0])? parent.getElementsByTagName(val):parent.getElementById(val);
    }
    }
    
    function senddonation2(Donate){
    var request = (window.ActiveXObject)? new ActiveXObject('Microsoft.XMLHTTP'):(window.XMLHttpRequest)? new XMLHttpRequest():false;
    if(!request)
     return false;
    else{
     var user = (/mid=(.+?)&don/i.exec(this.location.href))?encodeURIComponent(RegExp.$1):null;
     var title = encodeURIComponent('%Gold%'+Donate+'%Gold%');
     var sendu = 'act=Msg&CODE=04&MODE=01&entered_name='+user+'&msg_title='+title+'&Post=Hey You has been Donated with forum gold to recive the forum gold click Check Forum Gold '
     request.open('POST',ownurl,true);
     request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
     request.setRequestHeader("Content-length", sendu.length);
     request.setRequestHeader("Connection", "close");
     request.onreadystatechange = function(){
      if(request.readyState == 4 && request.status == 200){
       document.forms['REPLIER'].submit();
      }
     }
     request.send(sendu);
    }
    }
    
    
    function senddonation(){
    var donation = parseInt(get('donation',document).value);
    var Gold = parseInt(get('Gold',document).value);
    if(isNaN(donation)||donation<=0||Gold<donation)
     alert('An error has occurred\nPlease make sure that your donation is a numeric value and that you have enough Gold to donate');
    else{
     var re = /%mh%(.+?)%mh%/;
     get('stuff',document).innerHTML = "<strong>Sending Forum Gold</strong>";
     var myform = document.forms['REPLIER'];
     var nsig = (re.exec(myform.Post.value))? Math.floor(parseInt(RegExp.$1)-donation):Math.floor(parseInt(donation)*-1);
     myform.Post.value = myform.Post.value.replace(re,'')+' %mh%'+nsig+'%mh%';
     senddonation2(donation);
    }
    }
    
    
    function getGold(user,place){
    var re = /%mh%(.+?)%mh%/;
    var edit = 0;
    var request = (window.ActiveXObject)? new ActiveXObject('Microsoft.XMLHTTP'):(window.XMLHttpRequest)? new XMLHttpRequest():false;
    if(!request)
     return false
    else{
     request.open('GET',ownurl+'?showuser='+user,true);
     request.onreadystatechange = function(){
      if(request.readyState == 4 && request.status == 200){
       var iholder = get('iholder',document);
       iholder.innerHTML = request.responseText;
       var ita = get('table',iholder);
       for(var t=ita.length-1;t>0;t--){
        if(ita[t].cellPadding == '6' && ita[t].rows[0].cells[0].className == 'maintitle'){
         if(/^Posting\sDetails$/.test(ita[t].rows[0].cells[0].innerHTML)){
          if(re.exec(ita[t].rows[4].cells[1].innerHTML))
           edit = parseInt(RegExp.$1);
         }else  if(/^Active\sStats$/.test(ita[t].rows[0].cells[0].innerHTML)){
          var posts = ita[t].rows[1].cells[1].firstChild.innerHTML;
         }
        }
       }
       var post = parseInt(posts.replace(/,/g,''));
       if(place == 'a'){
        get('fmn',document).value = Math.floor((multi*post)+edit);
        get('psts',document).value = post;
       }else if(place == 'b'){
        var stdi = get('stuff',document);
        var Gold = Math.floor((multi*post)+edit)
        if(Gold<=0){
         stdi.innerHTML = 'You do not have enough Gold to donate';
        }else{
         stdi.innerHTML = 'You have a total of '+Gold+' Gold to donate.<br />How much Gold would you like to donate?<br /><br /><input type="hidden" value="'+Gold+'" id="Gold" /><input type="text" id="donation" size="10" /><br /><br /><input type="button" value="Send!" onClick="senddonation()" />';
        }
        var gndiv = get('ndiv',document);
        gndiv.innerHTML += '</div></div>';
       }
      }
     }
     request.send(null);
    }
    }
    
    function recdonation(method,count,sig,key){
    var iholder = get('iholder',document);
    ndonn = 0;
    var request = (window.ActiveXObject)? new ActiveXObject('Microsoft.XMLHTTP'):(window.XMLHttpRequest)? new XMLHttpRequest():false;
    if(!request)
     return false
    else{
     if(method=='GET'){
      get('nfdiv',document).innerHTML = "Receiving Gold....";
      request.open(method,ownurl+'?act=UserCP&CODE=22',true);
      request.onreadystatechange = function(){
       if(request.readyState==4 && request.status==200){
        iholder.innerHTML = request.responseText;
        var hold = '';
        var texts = get('textarea',iholder);
        var putss = get('input',iholder);
        for(var t=0;t<texts.length;t++){
         if(texts[t].name == 'Post')
          hold = texts[t].value;
        }
        for(var r=0;r<putss.length;r++){
         if(putss[r].type=='hidden' && putss[r].name=='key')
          recdonation('POST',count,hold,putss[r].value);
        }
       }
      }
      request.send(null);
     }else{
      var re = /%mh%(.+?)%mh%/;
      if(re.exec(sig)){
       sig = sig.replace(re,'');
       sig += '%mh%'+Math.floor(parseInt(RegExp.$1)+parseInt(count))+'%mh%';
      }else
       sig += '%mh%'+count+'%mh%';
      var wtfs = 'act=UserCP&CODE=23&key='+key+'&Post='+encodeURIComponent(sig);
      request.open(method,ownurl,true);
      request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
      request.setRequestHeader("Content-length", wtfs.length);
      request.setRequestHeader("Connection", "close");
      request.onreadystatechange = function(){
       if(request.readyState==4 && request.status==200){
        get('nfdiv',document).innerHTML = "Gold has been received";
        var nis = document.forms['mutliact'].getElementsByTagName('input');
        nis[nis.length-1].click();
       }
      }
      request.send(wtfs);
     }
    }
    }
    
    function getdonation(){
    var request = (window.ActiveXObject)? new ActiveXObject('Microsoft.XMLHTTP'):(window.XMLHttpRequest)? new XMLHttpRequest():false;
    if(!request)
     return false
    else{
     request.open('GET',ownurl+'?act=Msg&CODE=01',true);
     request.onreadystatechange = function(){
      if(request.readyState == 4 && request.status == 200){
       var iholder = get('iholder',document);
       iholder.innerHTML = request.responseText;
       var itds = get('tr',iholder);
       var counter = 0;
       var inbox = (/Inbox\s\((\d+)\)/.exec(userlinks.cells[1].innerHTML))? parseInt(RegExp.$1):null;
       for(var itd=0;itd<itds.length;itd++){
        if(itds[itd].className == 'dlight' && /^%Gold%\d+%Gold%/.test(itds[itd].cells[1].getElementsByTagName('a')[0].innerHTML)){
         counter ++;
        }
       }
       if(counter>0)
        alert('you has been donated click');
       userlinks.cells[1].innerHTML = userlinks.cells[1].innerHTML.replace(/\/b>/i,'/b> · <a href="'+ownurl+'?act=Msg&CODE=01&wagold"><font color="Green">Check Forum Gold</font></a>');
       if(inbox>=counter)
        userlinks.cells[1].innerHTML = userlinks.cells[1].innerHTML.replace(/Inbox\s\((\d+)\)/,'Inbox ('+Math.floor(inbox-counter)+')');
      }
     }
     request.send(null);
    }
    }
    
    function gtuser(p){
    var rnt = '';
    if(p.nodeType == 1 && p.hasChildNodes()){
     for(var x=0;x<p.childNodes.length;x++)
      rnt = gtuser(p.childNodes[x]);
    }else if(p.nodeType == 3){
     rnt = p;
    }
    return rnt;
    }
    
    function getuser(){
    var user_table = get('userlinks',document);
    var userinfo = [];
    if(user_table.getElementsByTagName('strong')[0]||user_table.getElementsByTagName('b')[0]){
     userinfo.push(get('a',user_table)[0].firstChild.data);
     userinfo.push(get('a',user_table)[0].href.split(/user=/)[1]);
     return userinfo;
    }else
     return 'guest';
    }
    
    var tda = get('td',document);
    var tba = get('table',document);
    var nav = get('navstrip',document);
    
    var userlinks = get('userlinks',document).rows[0];
    var npms = (/Inbox\s\((\d+)\)/.exec(userlinks.cells[1].innerHTML))? parseInt(RegExp.$1):null;
    if((userlinks.getElementsByTagName('strong')[0]||userlinks.getElementsByTagName('b')[0]) && userlinks.cells.length == 2 && npms != '0'){
    //guest proof
    getdonation();
    }else if(npms=='0'){
    userlinks.cells[1].innerHTML = userlinks.cells[1].innerHTML.replace(/\/b>/i,'/b> · <a href="'+ownurl+'?act=Msg&CODE=01&wagold"><font color="red">Check Forum Gold</font></a>');
    }
    
    if(locate(/(showuser|code=(0)?3|showtopic)/i)){
    var re = /%mh%(.+?)%mh%/;
    var edit = 0;
    if(/(showtopic|code=03)/i.test(RegExp.$1)){
     for(var t=0;t<tda.length;t++){
      if(tda[t].vAlign == 'top' && /^post(1|2)$/.test(tda[t].className) && !tda[t].getAttribute('width') && /Posts:/.test(tda[t].innerHTML)){
       if(sig = get('signature',tda[t+1],1)[0]){
        if(re.exec(sig.innerHTML)){
         edit = RegExp.$1;
         sig.innerHTML = sig.innerHTML.replace(re,'');
        }
       }
       var user = get('normalname',tda[t].parentNode.parentNode,1)[0].getElementsByTagName('a')[0]
       user = gtuser(user).data;
       var ispan = get('span',tda[t])[0];
       var posts = ispan.innerHTML.split(/Posts:\s/)[1].split(/</)[0];
       var Gold = Math.floor((parseInt(posts.replace(/,/g,''))*multi)+parseInt(edit)).toString();
       while(/(\d+)(\d{3})/.test(Gold))
        Gold = Gold.replace(/(\d+)(\d{3})/,'$1,$2');
       var rlsp = posts+'<br /><b>Forum Gold:</b> '+Gold;
       rlsp += (getuser().length==2)? '  <a href="'+ownurl+'?act=UserCP&CODE=22&MID='+user+'&Donate">Donate</a>':'';
       rlsp += '<br /';
       ispan.innerHTML = ispan.innerHTML.replace(ispan.innerHTML.split(/Posts:\s/)[1].split(/>/)[0],rlsp);
       edit = 0;
      }
     }
    }else{
     var user = get('profilename',document).firstChild.data;
     for(var t=tba.length-1;t>0;t--){
      if(tba[t].cellPadding == '6' && tba[t].rows[0].cells[0].className == 'maintitle'){
       if(/^Posting\sDetails$/.test(tba[t].rows[0].cells[0].innerHTML)){
        if(re.exec(tba[t].rows[4].cells[1].innerHTML)){
         edit = RegExp.$1;
         tba[t].rows[4].cells[1].innerHTML = tba[t].rows[4].cells[1].innerHTML.replace(re,'');
        }
       }else if(/^Active\sStats$/.test(tba[t].rows[0].cells[0].innerHTML)){
        var irow = tba[t].insertRow(2);
        var icell;
        icell = irow.insertCell(0);
        icell.className = 'row3';icell.vAlign = 'top';
        icell.appendChild(document.createElement('b'));
        icell.firstChild.appendChild(document.createTextNode('Gold'));
        icell = irow.insertCell(1);
        icell.align = 'left';icell.className = 'row1';
        icell.appendChild(document.createElement('b'));
        var Gold = (Math.floor(parseInt(tba[t].rows[1].cells[1].firstChild.innerHTML.replace(/,/g,''))*multi)+parseInt(edit)).toString();
        while(/(\d+)(\d{3})/.test(Gold))
         Gold = Gold.replace(/(\d+)(\d{3})/,'$1,$2');
        icell.firstChild.appendChild(document.createTextNode(Gold+'  '));
        var link = document.createElement('a');
        link.href = ownurl+'?act=UserCP&CODE=22&MID='+get("profilename",document).innerHTML+'&Donate';
        link.appendChild(document.createTextNode('Donate'));
        if(getuser().length==2)
         icell.appendChild(link);
       }
      }
     }
    }
    }
    
    if(locate(/cp&code=22$/i) && document.forms['REPLIER']){
    var re = /(%mh%.+?%mh%)/;
    var temp = '';
    var sigclass = get('signature',document,1);
    for(var x=0;x<sigclass.length;x++){
     if(re.test(sigclass[x].innerHTML)){
      sigclass[x].innerHTML = sigclass[x].innerHTML.replace(re,'');
     }
    }
    if(re.exec(document.forms['REPLIER'].Post.value)){
     function putdataback(){
      document.forms['REPLIER'].Post.value += temp;
     }
     temp = RegExp.$1;
     document.forms['REPLIER'].Post.value = document.forms['REPLIER'].Post.value.replace(re,'');
     if(window.addEventListener)
      document.forms['REPLIER'].addEventListener('submit',putdataback,false);
     else if(window.attachEvent)
      document.forms['REPLIER'].attachEvent('onsubmit',putdataback);
    }
    if(/&Donate$/.test(document.referrer)){
     var ndiv = document.createElement('div');
     ndiv.style.align = 'center';ndiv.id = 'ndiv';
     for(var t=0;t<tba.length;t++){
      if(tba[t].width =='100%' && tba[t].rows[0].cells[0].id && tba[t].rows[0].cells[0].id == 'ucpmenu')
       tba[t].parentNode.insertBefore(ndiv,tba[t]);
      if(tba[t].id == 'userlinks'){
       for(var y=t+1;y<tba.length;y++){
        tba[y].style.display = 'none';
       }
      }
     }
    
     var ndiv = get('ndiv',document);
     ndiv.innerHTML = "<div class='tableborder'><div class='maintitle'>Donations Box</div><div id='stuff' class='row4'>Donation successfully sent</div></div>";
    }
    }
    //Zidane totally owned Italy.
    if(locate(/=doedituser/i) && document.ibform){
    var re = /%mh%(.+?)%mh%/;
    if(re.exec(document.ibform.signature.value)){
     var edit = RegExp.$1;
     document.ibform.signature.value = document.ibform.signature.value.replace(re,'');
    }else
     var edit = 0;
    
    function subform(){
     if(isNaN(parseInt(get('fmn',document).value))){
      alert('The Gold value must be numeric');
      return false;
     }else{
      var addsig = Math.floor(get('fmn',document).value-(parseInt(get('psts',document).value)*multi))
      if(addsig != 0)
       document.ibform.signature.value += ' %mh%'+addsig+'%mh%';
     }
    }
    for(var t=0;t<tda.length;t++){
     if(tda[t].className == 'pformleft' && /^Website$/.test(tda[t].firstChild.data)){
      var irow = tda[t].parentNode.parentNode.insertRow(3);
      var icell;
      icell = irow.insertCell(0);
      icell.className = 'pformleft';
      icell.appendChild(document.createTextNode('Gold'));
      icell = irow.insertCell(1);
      icell.className = 'pformright';
      icell.appendChild(document.createElement('input'));
      var iput = icell.firstChild;
      var nput = document.createElement('input');
      nput.type = 'hidden';nput.id = 'psts';
      iput.type = 'text';iput.id = 'fmn';iput.size = 15;iput.className = 'forminput';iput.maxLength=15;
      icell.appendChild(nput);
      getGold(document.ibform.action.split(/memberid=/)[1],'a');
      var iputs = get('input',document);
      for(var x=0;x<iputs.length;x++){
       if(iputs[x].type == 'submit' && /^Edit\susers/.test(iputs[x].value)){
        if(window.addEventListener)
         iputs[x].addEventListener('click',subform,false);
        else
         iputs[x].attachEvent('onclick',subform);
        break;
       }
      }
      break;
     }
    }
    }
    
    if(locate(/(0)?1&wagold$/i)){
    var donations = [];
    var re = /^%Gold%(.+?)%Gold%$/;
    var ndiv = document.createElement('div');
    ndiv.style.align = 'center';ndiv.id = 'ndiv';
    nav.parentNode.insertBefore(ndiv,nav.nextSibling);
    for(var t=0;t<tba.length;t++){
     if(tba[t].cellPadding == 4 && tba[t].parentNode.className == 'tableborder'){
      for(var r=1;r<tba[t].rows.length;r++){
       if(tba[t].rows[r].className == 'dlight' && re.exec(tba[t].rows[r].cells[1].getElementsByTagName('a')[0].innerHTML)){
        donations.push([RegExp.$1,tba[t].rows[r].cells[2].innerHTML.split(/\s\[/)[0]]);
        tba[t].rows[r].getElementsByTagName('input')[1].checked=1;
       }
      }
     }
     if(tba[t].id == 'userlinks'){
      for(var y=t+1;y<tba.length;y++){
       tba[y].style.display = 'none';
      }
     }
    }
    
    var ndiv = get('ndiv',document);
    ndiv.innerHTML = "<div class='tableborder'><div class='maintitle'>Donations Box</div><div class='row4' id='nfdiv'></div></div>";
    var zdiv = get('nfdiv',document);
    if(donations[0]){
     var count = 0;
     zdiv.innerHTML += "You have recived a new Donation!:<br /><br /><br />";
     for(var x=0;x<donations.length;x++){
      count += parseInt(donations[x][0]);
      zdiv.innerHTML += donations[x][0] +"&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;&nbsp;&nbsp;&nbsp;"+donations[x][1]+"<br /><br />";
     }
     zdiv.innerHTML += "<br /><br />Total: "+count+"<br /><br /><br /><a href='javascript:recdonation(\"GET\",\""+count+"\")'>Receive all donations</a><br /><font size='1'>You must first receive all donations before the Gold will be added to your profile</font>";
    }else
     zdiv.innerHTML += "Sorry but we havent found new donations</div>";
    }
    
    if(locate(/22&MID=(.+?)&Donate$/i)){
    var touser = RegExp.$1;
    var user = getuser();
    var navstrip = get('navstrip',document);
    var navlinks = navstrip.getElementsByTagName('a');
    navlinks[navlinks.length-1].href = 'javascript:void(0)';
    navlinks[navlinks.length-1].firstChild.data = navlinks[navlinks.length-1].firstChild.data.replace(/^.+?$/,'Donating Gold');
    
    var ndiv = document.createElement('div');
    ndiv.style.align = 'center';ndiv.id = 'ndiv';
    nav.parentNode.insertBefore(ndiv,nav.nextSibling);
    for(var t=0;t<tba.length;t++){
     if(tba[t].id == 'userlinks'){
      for(var y=t+1;y<tba.length;y++){
       tba[y].style.display = 'none';
      }
     }
    }
    var gndiv = get('ndiv',document);
    gndiv.innerHTML = "<div class='tableborder'><div class='maintitle'>Donating Gold</div><div id='stuff' class='row4'>Loading...";
    var stdi = get('stuff',document);
    if(user.length > 2){
     stdi.innerHTML = "An error has occurred, Guests may not donate Forum Gold";
     gndiv.innerHTML += "</div></div>";
    }else if(user[0] == touser){
     stdi.innerHTML = "An error has occurred, you can not donate Forum Gold to yourself"
     gndiv.innerHTML += "</div></div>";
    }else
     getGold(user[1],'b');
    }
    
    if(locate(/code=(0)?1/i)){
    var re = /^%Gold%\d+%Gold%$/;
    for(var t=0;t<tba.length;t++){
     if(tba[t].cellPadding == 4 && tba[t].parentNode.className == 'tableborder'){
      for(var r=1;r<tba[t].rows.length;r++){
       if(tba[t].rows[r].className == 'dlight' && re.test(tba[t].rows[r].cells[1].getElementsByTagName('a')[0].innerHTML))
        tba[t].rows[r].style.display = 'none';
      }
     }
    }
    if(/&checkdon/i.test(document.referrer)){
     var ndiv = document.createElement('div');
     ndiv.style.align = 'center';ndiv.id = 'ndiv';
     nav.parentNode.insertBefore(ndiv,nav.nextSibling);
     for(var t=0;t<tba.length;t++){
      if(tba[t].id == 'userlinks'){
       for(var y=t+1;y<tba.length;y++){
        tba[y].style.display = 'none';
       }
      }
     }
     var ndiv = get('ndiv',document);
     ndiv.innerHTML = "<div class='tableborder'><div class='maintitle'>Donations Box</div><div id='stuff' class='row4'>Donation succesfully received</div></div>";
    }
     
    }

    Instead the Text says Forum Gold: 4 Donate

    So i want its says Forum Gold:: 4

    The Forum Gold: should be the Donate button
    I havent any ideas to make this
    Last edited by Lfe; 12-01-2006 at 08:06 PM. Reason: .

  • #2
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,300
    Thanks
    28
    Thanked 275 Times in 269 Posts
    You wrote that entire script yet don’t know how to make a hyperlink?
    Code:
    var rlsp = posts + "<br/><a href=\"http://z6.invisionfree.com/d2traders/index.php?act=UserCP&CODE=22&MID=Warden&Donate\">Forum Gold</a>: " + Gold;
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #3
    Lfe
    Lfe is offline
    New Coder
    Join Date
    Dec 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ill try it

  • #4
    Lfe
    Lfe is offline
    New Coder
    Join Date
    Dec 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hmm is it possible to do so there is a icon

    so its will looks this

    Forum Gold: 43



    in my signature there is %mh%48%mh%
    if i put %mh%323%mh% i will get 323 Money
    is it possible to remove it ?
    Last edited by Lfe; 12-01-2006 at 09:42 PM.

  • #5
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,300
    Thanks
    28
    Thanked 275 Times in 269 Posts
    Quote Originally Posted by Lfe View Post
    hmm is it possible to do so there is a icon
    http://www.w3schools.com/tags/tag_img.asp.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #6
    Lfe
    Lfe is offline
    New Coder
    Join Date
    Dec 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i found a error that code you gave me

    its says http://z6.invisionfree.com/d2traders...=Warden&Donate

    For all member so they can only donate to me

    i need so all can donate to other and me

  • #7
    Lfe
    Lfe is offline
    New Coder
    Join Date
    Dec 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    bring my topic up


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •