Announcement

Collapse
No announcement yet.

[mccode v2] CashCard. Send Cash Via Credit Card + Admin Xfer Logs

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [mccode v2] CashCard. Send Cash Via Credit Card + Admin Xfer Logs

    I found Extermination™ Creditcard addition an Awesome Addon for the game...

    I havent done much to this one Except give Users the abilty to Send Cash to each other Via their CreditCards. Admin and staff can also keep a close eye on all Cash sent between players with the credicard transfer logs...

    So here Goes.. By the way this has Been tested bymyself quite a few time to make sure its bug free..

    Firstly send this SQl to your phpmyadmin..

    Code:
    CREATE TABLE IF NOT EXISTS `creditxferlogs` (
      `crID` int(11) NOT NULL auto_increment,
      `crFROM` int(11) NOT NULL default '0',
      `crTO` int(11) NOT NULL default '0',
      `crAMOUNT` int(11) NOT NULL default '0',
      `crTIME` int(11) NOT NULL default '0',
      `crFROMIP` varchar(15) NOT NULL default '127.0.0.1',
      `crTOIP` varchar(15) NOT NULL default '127.0.0.1',
      PRIMARY KEY  (`crID`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

    Now save this file as sendcredit.php

    Code:
    <?php
    include "globals.php";
    $_GET['ID'] = abs((int) $_GET['ID']);
    $_POST['money'] = abs((int) $_POST['money']);
    if(!((int)$_GET['ID']))
    {
    print "Invalid User ID";
    }
    else if($_GET['ID'] == $userid)
    {
    print "Haha, what does sending money to yourself do anyway?";
    }
    else
    {
    if((int) $_POST['money'])
    {
    if($_POST['money'] > $ir['creditcard'])
    {
    print "Die j00 abuser.";
    }
    else
    {
    $db->query("UPDATE users SET creditcard=creditcard-{$_POST['money']} WHERE userid=$userid");
    $db->query("UPDATE users SET creditcard=creditcard+{$_POST['money']} WHERE userid={$_GET['ID']}");
    print "You sent \${$_POST['creditcard']} to ID {$_GET['ID']}.";
    event_add($_GET['ID'],"You received \${$_POST['money']} from {$ir['username']}.",$c);
    $it=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid={$_GET['ID']}");
    $er=$db->fetch_row($it);
    $db->query("INSERT INTO creditxferlogs VALUES ('', $userid, {$_GET['ID']}, {$_POST['money']}, unix_timestamp(), '{$ir['lastip']}', '{$er['lastip']}')");
    }
    }
    $it=$db->query("SELECT lastip FROM users WHERE userid={$_GET['ID']}");
    $er=$db->fetch_row($it);
    if($ir['lastip'] == $er['lastip'])
    {
    print "You can't transfer to someone on the same IP.
    
    > Back";
    $h->endpage();
    exit;
    }
    else
    {
    print "<h3> Sending Money</h3>
    You are sending money to ID: {$_GET['ID']}.
    
    You have \$".number_format($ir['creditcard'])." you can send.
    <form action='sendcredit.php?ID={$_GET['ID']}' method='post'>
    Amnt: <input type='text' name='money' />
    
    <input type='submit' value='Send' /></form>";
    print "<h3>Latest 5 Transfers</h3>
    <table width=75% border=2> <tr style='background:gray'>  <th>Time</th> <th>User From</th> <th>User To</th> <th>Amount</th> </tr>";
    $q=$db->query("SELECT cr.*,u1.username as sender, u2.username as sent FROM creditxferlogs cr LEFT JOIN users u1 ON cr.crFROM=u1.userid LEFT JOIN users u2 ON cr.crTO=u2.userid WHERE cr.crFROM=$userid ORDER BY cr.crTIME DESC LIMIT 5");
    while($r=$db->fetch_row($q))
    {
    if($r['crFROMIP'] == $r['crTOIP']) { $m="<span style='color:red;font-weight:800'>MULTI</span>"; } else { $m=""; }
    print "<tr> <td>" . date("F j, Y, g:i:s a",$r['crTIME']) . "</td><td>{$r['sender']} [{$r['crFROM']}] </td><td>{$r['sent']} [{$r['crTO']}] </td> <td> \${$r['crAMOUNT']}</td> </tr>";
    }
    print "</table>";
    }
    }
    $h->endpage();
    ?>
    Place a link for that file anywhere you want usually its placed in the viewuser.php but it doesnt matter where you place it....

    Now open up your staff_logs.php

    If you havent altered anything from the staff_logs.php before, now then i can associate the line number easily..

    Online 8 or case 'cashlogs': view_cash_logs(); break;
    add this underneath it..
    Code:
    case 'credlogs': view_credit_logs(); break

    Now on line 22 or case 'clear8': clear_logs8(); break;
    add this underneath it.

    Code:
    case 'clear9': clear_logs(); break;
    Find this line 41 or Delete Staff Logs <font color=red>HERE</font>

    Add this line underneath it

    Code:
    Delete Credit Xfers <font color=red>HERE</font>
    ";
    Now on line 127 or )

    Add this underneath it..

    Code:
    $db->query("TRUNCATE TABLE creditxferlogs");
    print "Creditcard Transfers Deleted";
    }
    function clear_logs9()
    {
    global $db,$ir,$c,$h,$userid;
    if($ir['user_level'] != 2)
    {
    die("Access Denide");
    }
    }
    Now on line 365 or )
    Add this line beneath it.

    Code:
    function view_credit_logs()
    {
    global $db,$ir,$c,$h,$userid;
    print "<h3>Creditcard Xfer Logs</h3>
    <table width=100% cellspacing='1' class='table'> <tr style='background:gray'> <th>ID</th> <th>Time</th> <th>User From</th> <th>User To</th> <th>Multi?</th> <th>Amount</th> <th> </th> </tr>";
    $q=$db->query("SELECT cr.*,u1.username as sender, u2.username as sent FROM creditxferlogs cr LEFT JOIN users u1 ON cr.crFROM=u1.userid LEFT JOIN users u2 ON cr.crTO=u2.userid ORDER BY cr.crTIME DESC");
    while($r=$db->fetch_row($q))
    {
    if($r['crFROMIP'] == $r['crTOIP']) { $m="<span style='color:red;font-weight:800'>MULTI</span>"; } else { $m=""; }
    print "<tr><td>{$r['crID']}</td> <td>" . date("F j, Y, g:i:s a",$r['crTIME']) . "</td><td>{$r['sender']} [{$r['crFROM']}] (IP: {$r['crFROMIP']}) </td><td>{$r['sent']} [{$r['crTO']}] (IP: {$r['crTOIP']}) </td> <td>$m</td> <td> \${$r['crAMOUNT']}</td> <td> [Jail Sender] [Jail Receiver]</td> </tr>";
    }
    print "</table>";
    stafflog_add("Viewed the Cash Xfer Logs");
    And thats it for the Staff_log.php file

    Final Part is to open smenu.php

    Find >>> > Cash Xfer Logs


    Underneath Add

    Code:
    > Creditcard Logs
    And thats it.

    EDITED MYSQL thanks to HALO

  • #2
    Re: [MOD] CashCard. Send Cash Via Credit Card + Admin Xfer Logs

    Please NOTE you will need the Creditcard addition before the above mod will workk see this Post

    http://criminalexistence.com/ceforum...profile;u=4356

    Creditcard script created by Extermination™

    Comment


    • #3
      Re: [MOD] CashCard. Send Cash Via Credit Card + Admin Xfer Logs

      Doesn't:


      Code:
      CREATE TABLE IF NOT EXISTS `creditferlogs` (
        `crID` int(11) NOT NULL auto_increment,
        `crFROM` int(11) NOT NULL default '0',
        `crTO` int(11) NOT NULL default '0',
        `crAMOUNT` int(11) NOT NULL default '0',
        `crTIME` int(11) NOT NULL default '0',
        `crFROMIP` varchar(15) NOT NULL default '127.0.0.1',
        `crTOIP` varchar(15) NOT NULL default '127.0.0.1',
        PRIMARY KEY  (`crID`)
      ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
      Have to be:

      Code:
      CREATE TABLE IF NOT EXISTS `creditxferlogs` (
        `crID` int(11) NOT NULL auto_increment,
        `crFROM` int(11) NOT NULL default '0',
        `crTO` int(11) NOT NULL default '0',
        `crAMOUNT` int(11) NOT NULL default '0',
        `crTIME` int(11) NOT NULL default '0',
        `crFROMIP` varchar(15) NOT NULL default '127.0.0.1',
        `crTOIP` varchar(15) NOT NULL default '127.0.0.1',
        PRIMARY KEY  (`crID`)
      ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
      You spelled creditxferlogs wrong and what I can see within the mod it inserts the data into creditxferlogs.

      Comment


      • #4
        Re: [MOD] CashCard. Send Cash Via Credit Card + Admin Xfer Logs

        Thanks for that halo I had two copies of the SQl on my Editor and after all that typing i copy and pasted the wrong one..



        I'll update the above To Edit the error Sorry about that guys.

        Comment


        • #5
          Re: [MOD] CashCard. Send Cash Via Credit Card + Admin Xfer Logs

          No Problem

          Comment


          • #6
            Re: [MOD] CashCard. Send Cash Via Credit Card + Admin Xfer Logs

            Quick Update.....

            Open up your Viewuser.php look for this line

            print "[Bank Xfer]


            and overwrite it with this one

            Code:
            print "[Bank Xfer]
            
            [CreditCard Xfer]
            
            ";
            This will let your users send money via their Profile page...

            Comment


            • #7
              Re: [MOD] CashCard. Send Cash Via Credit Card + Admin Xfer Logs

              This mod is really good. But I can't get the XFER logs to work.
              [img width=332 height=60]http://i539.photobucket.com/albums/ff351/ZaneBirchall09/mafiamindspromosig3copy.png[/img]

              Comment


              • #8
                Re: [MOD] CashCard. Send Cash Via Credit Card + Admin Xfer Logs

                if you have done everything step by step it should work go back over what you have done to make sure you havent missed anything.....

                Comment

                Working...
                X