예제 #1
0
function donate_gold_send()
{
    //Execute the donation of gold
    global $userdata, $locale, $settings, $golddata, $newdonate, $newribbon;
    if (isset($_POST['amount']) && !intval($_POST['amount'])) {
        redirect("index.php");
    }
    if (!isset($_POST['give_name'])) {
        redirect("index.php");
        exit;
    }
    $amount = $_POST['amount'];
    $_POST['give_name'] = stripinput($_POST['give_name']);
    table_top(sprintf($locale['urg_donate_104'], UGLD_GOLDTEXT));
    echo "<div>\n";
    if ($golddata['cash'] < $amount) {
        //trying to give more than they have
        echo sprintf($locale['urg_donate_131'], $amount);
    } elseif ($amount < 0) {
        echo $locale['urg_donate_113'];
    } elseif ($amount == 0) {
        echo $locale['urg_donate_114'];
    } elseif ($_POST['give_name'] == $golddata['owner_name']) {
        echo $locale['urg_donate_115'];
    } else {
        $result = dbquery("SELECT g.owner_id, u.user_name as owner_name\n\t\t\tFROM " . DB_UG3 . " g\n\t\t\tLEFT JOIN " . DB_USERS . " u ON g.owner_id = u.user_id\n\t\t\tWHERE u.user_name = '" . $_POST['give_name'] . "'\n\t\t\tLIMIT 1");
        $row = dbarray($result);
        if ($row['owner_name'] !== $_POST['give_name']) {
            $result = dbquery("SELECT user_id, user_name FROM " . DB_USERS . " WHERE user_name = '" . $_POST['give_name'] . "' LIMIT 1");
            $row = dbarray($result);
            $exist = dbrows($result);
            if ($exist != 0) {
                $karma = floor($amount / 1000 / 2);
                payuser($golddata['owner_id'], $karma, 'karma');
                payuser($golddata['owner_id'], $amount, 'donated');
                //payuser($golddata['owner_id'],$newribbon,'ribbon' ); <= Unexpected Error == Missing $newribbon
                takegold2($golddata['owner_id'], $amount, 'cash');
                if ($golddata['donated'] + $amount >= UGLD_DONATE_RIBBON) {
                    donate_to_ribbon($golddata['owner_id']);
                }
                payuser($row['user_id'], $amount, 'cash');
                echo sprintf($locale['urg_donate_116'], formatMoney($amount), $row['user_name']);
                $subject = sprintf($locale['urg_donate_117'], formatMoney($amount), $golddata['owner_name']);
                $message = sprintf($locale['urg_donate_118'], $golddata['owner_name'], formatMoney($amount), $_POST['message'], $settings['siteusername']);
                sendpm($row['user_id'], $subject, $message, $golddata['owner_id'], $golddata['owner_name']);
            } else {
                echo $locale['urg_donate_132'];
            }
        } else {
            $result = dbquery("SELECT user_id, user_name FROM " . DB_USERS . " WHERE user_id = '" . $row['owner_id'] . "' LIMIT 1");
            $exist = dbrows($result);
            if ($exist != 0) {
                $karma = floor($amount / 1000 / 2);
                payuser($golddata['owner_id'], $karma, 'karma');
                payuser($golddata['owner_id'], $amount, 'donated');
                takegold2($golddata['owner_id'], $amount, 'cash');
                if ($golddata['donated'] + $amount >= UGLD_DONATE_RIBBON) {
                    //donate_to_ribbon($golddata['owner_id']);
                }
                payuser($row['owner_id'], $amount, 'cash');
                $subject = sprintf($locale['urg_donate_117'], formatMoney($amount), $golddata['owner_name']);
                $message = sprintf($locale['urg_donate_118'], $golddata['owner_name'], formatMoney($amount), $_POST['message'], $settings['siteusername']);
                sendpm($row['owner_id'], $subject, $message, $golddata['owner_id'], $golddata['owner_name']);
                echo sprintf($locale['urg_donate_116'], formatMoney($amount), $row['owner_name']);
            } else {
                echo $locale['urg_donate_132'];
            }
        }
    }
    echo "</div>\n";
    pagerefresh('meta', 3, FUSION_SELF . '?op=donate_gold_start');
    closetable();
}
예제 #2
0
function shop_signup()
{
    // Buy a new signup date
    global $userdata, $locale, $golddata;
    table_top($locale['urg_shop_106']);
    $join_time = strftime('%d/%m/%Y %H:%M', $userdata['user_joined']);
    if (isset($_POST['agree']) == '1') {
        if ($golddata['cash'] > GLD_JOINED) {
            //retrieve the join date and alter it
            //must be sure not to exceed current date
            $sec = date('s', time());
            $min = date('m', time());
            $hrs = date('h', time());
            $hrs = rand(1, $hrs);
            $year = date('Y');
            $newyear = rand(2004, $year);
            $day = date('d');
            $newday = rand(1, $day);
            $month = date('m');
            $newmonth = rand(1, $month);
            $allow_time = mktime($hrs, $min, $sec, $newmonth, $newday, $newyear, 0);
            $format_time = strftime('%d/%m/%Y %H:%M', $allow_time);
            //change the date
            $result = dbquery("UPDATE " . DB_USERS . " SET user_joined = '" . $allow_time . "' WHERE user_id = '" . $userdata['user_id'] . "' LIMIT 1");
            //take the money
            takegold2($userdata['user_id'], GLD_JOINED, 'cash');
            echo sprintf($locale['urg_shop_142'], $format_time, $join_time, GLD_JOINED);
        } else {
            echo $locale['urg_shop_136'];
        }
    } else {
        echo "<table width='100%' cellpadding='3' cellspacing='3' class='tbl-border'>\n<tr>\n";
        echo "<td>" . $locale['urg_shop_143'] . $join_time . $locale['urg_shop_144'] . $locale['urg_shop_109'] . " <strong>" . formatMoney(GLD_JOINED) . "</strong></td>\n";
        echo "</tr>\n</table>\n";
        echo "<div style='margin:5px'></div>\n";
        echo "<table width='100%' cellpadding='0' cellspacing='0' class='tbl-border'>\n<tr>\n";
        echo "<td class='tbl2'>\n<form action='index.php' method='post'>\n";
        echo "<input type='hidden' name='op' value='shop_signup' />\n";
        echo "<strong>" . $locale['urg_shop_145'] . "</strong>&nbsp;&nbsp;<input type='checkbox' name='agree' value='1' />&nbsp;\n";
        echo "&nbsp;<input class='button' type='submit' value='" . $locale['urg_shop_146'] . "' />\n";
        echo "</form>\n</td>\n";
        echo "</tr>\n</table>\n";
    }
    closetable();
}
예제 #3
0
function member_steal()
{
    //Steal Money
    global $HTTP_POST_VARS, $userdata, $locale, $settings, $golddata;
    //set an amount in case its missed later
    $success = '20';
    table_top($locale['urg_member_103']);
    /*
    First things first.. Can Only steal from users cash amounts never from bank.
    Lots of things can happen here. If steal is good stuff could happen to stealee
    if steal is bad stuff could happen to stealer.
    Maybe we need a jail now to go with this?
    Fail to steal go to jail and jail means loss of all owned stuff?
    */
    //lets trim the useage of this damn thing
    if ($golddata['steal'] < date('Ymd')) {
        global $stealfrom_id, $stealfrom_name, $steal_amount;
        if (isset($_POST['stealfrom']) != '') {
            //there must be something in the steal from box
            $stealfrom = stripinput($_POST['stealfrom']);
            //its not an numewral so select useing the name
            //sort out the name to id situation
            $id_query = dbquery("SELECT g.*, u.user_name as owner_name\n\t\t\t\tFROM " . DB_UG3 . " g\n\t\t\t\tLEFT JOIN " . DB_USERS . " u ON g.owner_id = u.user_id\n\t\t\t\tWHERE user_name = '" . $stealfrom . "'\n\t\t\t\tLIMIT 1");
            //$id_query = dbquery("SELECT * FROM ".DB_UG3." WHERE owner_name='".$stealfrom."' LIMIT 1");
            //$id_result = dbfetch_array($id_query);
            $id_result = dbarray($id_query);
            $stealfrom_id = $id_result['owner_id'];
            $stealfrom_name = $id_result['owner_name'];
            //timer for daily steal only
            $result = dbquery("UPDATE " . DB_UG3 . " SET steal = '" . date('Ymd') . "' WHERE owner_id = '" . $golddata['owner_id'] . "' LIMIT 1");
            $result = dbquery("SELECT g.*, u.user_name as owner_name\n\t\t\t\tFROM " . DB_UG3 . " g\n\t\t\t\tLEFT JOIN " . DB_USERS . " u ON g.owner_id = u.user_id\n\t\t\t\tWHERE owner_id = '" . $stealfrom_id . "'\n\t\t\t\tLIMIT 1");
            //$result = dbquery("SELECT * FROM ".DB_UG3." WHERE owner_id='".$stealfrom_id."' LIMIT 1");
            //ok its all so unfair aint it?
            //so lets play a little
            //if the theif has more money than the selected target
            $target_query = dbquery("SELECT g.*, u.user_name as owner_name\n\t\t\t\tFROM " . DB_UG3 . " g\n\t\t\t\tLEFT JOIN " . DB_USERS . " u ON g.owner_id = u.user_id\n\t\t\t\tWHERE owner_id = '" . $stealfrom_id . "'\n\t\t\t\tLIMIT 1");
            //$target_query = dbquery("SELECT * FROM ".DB_UG3." WHERE owner_id='".$stealfrom_id."' LIMIT 1");
            //$target_result = dbfetch_array($target_query);
            $target_result = dbarray($target_query);
            $targets_total = $target_result['cash'] + $target_result['bank'];
            if ($targets_total < '100' || $targets_total < '') {
                opentable($locale['urg_member_117']);
                echo $locale['urg_member_118'];
                closetable();
                include "footer.php";
                exit;
            }
            $my_total = $golddata['cash'] + $golddata['bank'];
            if ($targets_total < $my_total) {
                //less than theif
                //set the success percentage low
                $success = '10';
            } elseif ($targets_total > $my_total * 2) {
                //more than double of theif
                //set the success percentage low
                $success = '70';
            } elseif ($targets_total > $my_total / 2) {
                //more than half of theif
                //set the success percentage low
                $success = '45';
            } else {
                $success = '35';
            }
            //get a random number between 0 and 100
            $try = rand(0, 100);
            //percentage probability will work on
            //if successfull
            if ($try < $success) {
                // ??% chance of success
                $stealee = getusergold($stealfrom_id, 'cash');
                $steal_amount = rand(0, $stealee);
                //take this money away from stealee...
                takegold2($stealfrom_id, $steal_amount, 'cash');
                payuser($userdata['user_id'], $steal_amount, 'cash');
                if ($steal_amount < 50) {
                    echo $locale['urg_member_119'] . " " . $steal_amount . "!";
                } else {
                    echo $locale['urg_member_120'] . " " . $steal_amount . " " . $locale['urg_member_121'] . " " . $stealfrom_name . "" . $locale['urg_member_122'] . " " . $stealfrom_name . " " . $locale['urg_member_123'];
                }
            } else {
                if ($golddata['cash'] + $golddata['cash'] <= $steal_amount) {
                    $opt = '2';
                } else {
                    $opt = '4';
                }
                //ok its punishment time..
                $punishment_id = rand(0, $opt);
                //grab a random punishment
                if ($punishment_id == 0) {
                    echo $locale['urg_member_124'];
                } elseif ($punishment_id == 1) {
                    //take karma (must be forced to go negative)
                    takegold2($userdata['user_id'], '10', 'karma', 1);
                    echo $locale['urg_member_125'];
                } elseif ($punishment_id == 2) {
                    //take gold (force it)
                    //$fine = $golddata[cash]/2;
                    $fine_amount = rand(0, $golddata['cash'] + $golddata['bank']);
                    takegold2($userdata['user_id'], $fine_amount, 'cash', 1);
                    echo $locale['urg_member_126'] . formatMoney($fine_amount) . "!<br />";
                } elseif ($punishment_id == 3) {
                    //the stealee robs you
                    //$returnsteal = $golddata['cash']/2;
                    //$returnsteal = $golddata['cash'];
                    $returnsteal = $golddata['cash'] + $golddata['bank'];
                    payuser($stealfrom_id, $returnsteal, 'cash');
                    takegold2($userdata['user_id'], $returnsteal, 'cash', '1');
                    echo $stealfrom_name . $locale['urg_member_128'] . formatMoney($returnsteal) . $locale['urg_member_129'];
                } elseif ($punishment_id == 4) {
                    //the stealee robs you
                    //$returnsteal = $golddata['cash']/2;
                    $returnsteal = $golddata['cash'];
                    payuser($stealfrom_id, $returnsteal, 'cash');
                    takegold2($userdata['user_id'], $returnsteal, 'cash', '1');
                    echo $locale['urg_member_127'] . $stealfrom_name . $locale['urg_member_128'] . formatMoney($returnsteal) . $locale['urg_member_129'];
                } else {
                    echo $locale['urg_member_124'];
                }
            }
        } else {
            echo "<form action='index.php' method='post'>\n";
            echo "<table width='100%' cellpadding='3' cellspacing='3' class='tbl-border'>\n<tr valign='top'>\n";
            echo "<td width='100%' colspan='2'><br />" . $locale['urg_member_130'] . "</td>\n";
            echo "</tr>\n<tr valign='top'>\n";
            echo "<td width='100%' colspan='2'><br />" . $locale['urg_member_131'] . "</td>\n";
            echo "</tr>\n<tr valign='top'>\n";
            echo "<td width='100%' colspan='2'><br />" . $locale['urg_member_132'] . "</td>\n";
            echo "</tr>\n<tr class='tbl2'>\n";
            echo "<td><input type='hidden' name='op' value='member_steal' /></td>\n";
            echo "<td>" . $locale['urg_member_133'] . "<input type='text' class='textbox' name='stealfrom' size='50' />\n";
            echo "<a style='cursor:help;' href='javascript:void(window.open(\"findmember.php?title=findmember\",\"\",\"width=350,height=400\"));'>\n";
            echo "<img src='images/find.png' title='" . $locale['urg_member_107'] . "' alt='" . $locale['urg_member_107'] . "' style='border: 0;' />\n";
            echo "</a></td>\n";
            echo "</tr>\n<tr>\n";
            echo "<td colspan='2' align='center'><input class='button' type='submit' value='" . $locale['urg_member_108'] . "' /></td>\n";
            echo "</tr>\n</table>\n";
            echo "</form>";
        }
    } else {
        echo $locale['urg_member_134'];
    }
    closetable();
}
예제 #4
0
function trade_buy()
{
    //Buy An Item available from another user
    global $locale, $golddata;
    table_top($locale['urg_trade_113']);
    if (isset($_POST['id']) && !isNum($_POST['id'])) {
        redirect("index.php");
    }
    //Get information on the item in  question
    $result = dbquery("SELECT it.*, inv.*, u.user_name as owner_name\n\t\tFROM " . DB_UG3_INVENTORY . " inv\n\t\tLEFT JOIN " . DB_UG3_USAGE . " it ON inv.itemid = it.id\n\t\tLEFT JOIN " . DB_USERS . " u ON inv.ownerid = u.user_id\n\t\tWHERE inv.id = '" . $_GET['id'] . "'\n\t\tLIMIT 1");
    if (dbrows($result)) {
        $item = dbarray($result);
        if ($item['trading'] != 1) {
            echo $locale['urg_trade_114'];
            print_r($item);
        } elseif ($golddata['cash'] < $item['tradecost']) {
            echo sprintf($locale['urg_trade_115'], $cost - $golddata['cash']);
        } else {
            //change item info
            $result = dbquery("UPDATE " . DB_UG3_INVENTORY . " SET ownerid = '" . $golddata['owner_id'] . "', amtpaid = '" . $item['tradecost'] . "', trading = '0' WHERE id = '" . $_GET['id'] . "' LIMIT 1");
            //decrease user's money
            takegold2($golddata['owner_id'], $item['tradecost'], 'cash');
            //give money to old owner
            payuser($item['owner_id'], $item['tradecost'], 'cash');
            //prepare message
            $subject = sprintf($locale['urg_trade_116'], $item['name']);
            $message = sprintf($locale['urg_trade_117'], $golddata['owner_id'], $golddata['owner_name'], $item['name'], formatMoney($item['tradecost']));
            //send
            sendpm($item['ownerid'], $subject, $message, $golddata['owner_id'], $golddata['owner_name']);
            echo sprintf($locale['urg_trade_118'], $item['name'], $item['owner_name']);
        }
    } else {
        echo $locale['urg_trade_128'];
    }
    pagerefresh('meta', '2', FUSION_SELF . '?op=trade_start');
    closetable();
}
예제 #5
0
if ($_SESSION['won'] == 1) {
    global $locale;
    payuser($userdata['user_id'], 50, 'cash');
    echo "<div align='center'><table cellpadding='0' cellspacing='2' border='0' width='500' height='60'>\n";
    echo "<tr><td align='center' width='300'>\n";
    echo "" . $locale['mdmr_204'] . "<br /><br />\n";
    echo "&nbsp;&nbsp;&nbsp;&nbsp;\n";
    echo "<img src=images/" . $_SESSION['gamerand'][0] . " alt='" . $_SESSION['gamerand'][0] . "' /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \n" . "<img src=images/" . $_SESSION['gamerand'][1] . " alt='" . $_SESSION['gamerand'][1] . "' /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \n" . "<img src=images/" . $_SESSION['gamerand'][2] . " alt='" . $_SESSION['gamerand'][2] . "' /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \n" . "<img src=images/" . $_SESSION['gamerand'][3] . " alt='" . $_SESSION['gamerand'][3] . "' /> \n";
    echo "</td>\n";
    $lost = 1;
    echo "<td align='center' valign='middle'> \n";
    echo "<form action='" . $_SERVER['PHP_SELF'] . "' method='post'>\n";
    echo "<input type='submit' class='button' value='" . $locale['mdmr_206'] . "' name='playagain' />\n";
    echo "</form> \n";
} elseif (count($_SESSION['guesstable']) == 12) {
    takegold2($userdata['user_id'], 20, 'cash', '0');
    echo "<div align='center'><table border='0' width='500' height='60'>\n";
    echo "<tr><td align='center' width='300'>\n";
    echo $locale['mdmr_205'] . "<br /><br />\n";
    echo "&nbsp;&nbsp;&nbsp;&nbsp;\n";
    echo "<img src=images/" . $_SESSION['gamerand'][0] . " alt='" . $_SESSION['gamerand'][0] . "' /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \n" . "<img src=images/" . $_SESSION['gamerand'][1] . " alt='" . $_SESSION['gamerand'][1] . "' /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \n" . "<img src=images/" . $_SESSION['gamerand'][2] . " alt='" . $_SESSION['gamerand'][2] . "' /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \n" . "<img src=images/" . $_SESSION['gamerand'][3] . " alt='" . $_SESSION['gamerand'][3] . "' /> \n";
    echo "</td>\n";
    $lost = 1;
    echo "<td align='center' valign='middle'>\n";
    echo "<form action='" . $_SERVER['PHP_SELF'] . "' method='post'>\n";
    echo "<input type='submit' class='button' value='" . $locale['mdmr_206'] . "' name='playagain' />\n";
    echo "</form>\n";
} else {
    echo "<table align='center' cellpadding='0' cellspacing='2' border='0' width='500' height='60'>\n<tr>\n";
    echo "<td align='center' valign='middle' class='tbl'>\n";
    echo $locale['mdmr_202'];
예제 #6
0
            pagerefresh('meta', '3', 'coingame.php');
            closetable();
            include "footer.php";
            exit;
        }
        if ($golddata['cash'] < $bet) {
            echo "<div align='center'>" . $locale['cnge_211'] . "</div>\n";
            pagerefresh('meta', '3', 'coingame.php');
            closetable();
            include "footer.php";
            exit;
        }
    }
    if ($answer > 50) {
        echo "<div align='center'>" . $locale['cnge_203'] . " " . $bet . "!</div>\n";
        takegold2($userdata['user_id'], $bet, 'cash', '0');
        pagerefresh('meta', '3', 'coingame.php');
    } else {
        if ($answer < 50) {
            $won = $bet * 1.5;
            echo "<div align='center'>" . $locale['cnge_204'] . " " . $won . "!</div>\n";
            payuser($userdata['user_id'], $won, 'cash');
            pagerefresh('meta', '3', 'coingame.php');
        }
    }
} else {
    echo "<form name='form1' method='post' action='coingame.php'>\n";
    echo "<div align='center'>\n";
    echo $locale['cnge_205'];
    echo " <input name='bet' type='text' class='textbox' id='bet' size='20' maxlength='10' />\n";
    echo "<br />\n";
예제 #7
0
//Insert the gift when it is submitted
if (!empty($_POST['give_gift']) && !empty($_POST['gift_user_name']) && !empty($_POST['gift_id'])) {
    $gift_id = stripinput($_POST['gift_id']);
    $gift_price = stripinput($_POST['gift_price']);
    $gift_user_name = stripinput($_POST['gift_user_name']);
    $gift_message = stripinput($_POST['gift_message']);
    $gift_privacy_type = stripinput($_POST['gift_privacy_type']);
    $mygold = getusergold($userdata['user_id'], "cash");
    if ($mygold >= $gift_price) {
        //Open the users table and find the users to give gift to
        $result = dbquery("SELECT * FROM " . DB_USERS . " WHERE user_name='{$gift_user_name}' LIMIT 1");
        //We check if the user exist before we send the gift
        if (dbrows($result)) {
            $user = dbarray($result);
            if ($userdata['user_id'] != $user['user_id']) {
                takegold2($userdata['user_id'], $gift_price);
                $result = dbquery("UPDATE " . DB_GIFT . " SET gift_bought=gift_bought+1 WHERE gift_id='" . $gift_id . "'");
                $result = dbquery("INSERT INTO " . DB_GIFT_GIVEN . " (\n\t\t\t\t\tgift_given_gift_id, \n\t\t\t\t\tgift_given_from, \n\t\t\t\t\tgift_given_to, \n\t\t\t\t\tgift_given_visibillity, \n\t\t\t\t\tgift_given_message\n\t\t\t\t) VALUES(\n\t\t\t\t\t'{$gift_id}', \n\t\t\t\t\t'" . $userdata['user_id'] . "', \n\t\t\t\t\t'" . $user['user_id'] . "', \n\t\t\t\t\t'{$gift_privacy_type}', \n\t\t\t\t\t'{$gift_message}')\n\t\t\t\t");
                $sendt_gift_id = mysql_insert_id();
                $result = dbquery("INSERT INTO " . DB_MESSGES . " (\n\t\t\t\t\tmessage_to,\n\t\t\t\t\tmessage_from,\n\t\t\t\t\tmessage_subject,\n\t\t\t\t\tmessage_message,\n\t\t\t\t\tmessage_smileys,\n\t\t\t\t\tmessage_read,\n\t\t\t\t\tmessage_datestamp,\n\t\t\t\t\tmessage_folder\n\t\t\t\t) VALUES(\n\t\t\t\t\t'" . $user['user_id'] . "',\n\t\t\t\t\t'" . $userdata['user_id'] . "',\n\t\t\t\t\t'" . $locale['sfgift950'] . "',\n\t\t\t\t\t'" . $locale['sfgift951'] . " <a href=\\'" . GIFT_SYSTEM . "show_gift.php?lookup=" . $user['user_id'] . "&gift_id=" . $sendt_gift_id . "\\' target=\\'_self\\'>" . $locale['sfgift952'] . "</a>.<br />" . $locale['sfgift953'] . " " . $userdata['user_name'] . ".<br /><br /><br />[u][b]" . $locale['sfgift954'] . " " . $userdata['user_name'] . ":[/b][/u]<br />" . $gift_message . "',\n\t\t\t\t\t'y',\n\t\t\t\t\t'0',\n\t\t\t\t\t'" . time() . "',\n\t\t\t\t\t'0'\n\t\t\t\t)");
                redirect(FUSION_SELF . "?status=ok&user_id=" . $user['user_id'] . "&gift=" . $gift_id . "");
            } else {
                redirect(FUSION_SELF . "?gift_id=" . $gift_id . "&error=3");
            }
            //If the user dos not exist we send you back to the give gift page with an error
        } else {
            redirect(FUSION_SELF . "?gift_id=" . $gift_id . "&error=2");
        }
    } else {
        redirect(FUSION_SELF . "?gift_id=" . $gift_id . "&error=4");
    }
예제 #8
0
    echo "<img src='images/banners/English_ug_lottery.jpg' title='" . $locale['ugly_100'] . "' alt='" . $locale['ugly_100'] . "' />\n";
}
echo "</div><br /><br />\n";
echo "<div align='center' class='tbl2'><strong>\n";
echo "<a href='index.php'>" . $locale['ugly_200'] . "</a> | \n";
echo "<a href='prev_drawings.php'>" . $locale['ugly_201'] . "</a>\n";
if (iADMIN) {
    echo " | <a href='admin/index.php" . $aidlink . "'>" . $locale['ugly_202'] . "</a>\n";
}
echo "</strong></div><br />\n";
if (isset($_POST['buylot_final']) && $_POST['buylot_final'] == '0') {
    $draw_id = stripinput($_POST['draw_id']);
    $lotquery = dbquery("INSERT INTO " . DB_UG_LOTTERY_LOTS . "\t(lot_id, lot_draw, lot_owner, lot_owner_name) VALUES ('', '" . $draw_id . "', '" . $userdata['user_id'] . "', '" . $userdata['user_name'] . "')");
    $drawresult = dbquery("SELECT * FROM " . DB_UG_LOTTERY_DRAWINGS . " ORDER BY draw_id DESC LIMIT 0,1");
    $drawrow = dbarray($drawresult);
    takegold2($userdata['user_id'], $drawrow['lot_price'], 'cash', 0);
    $drawquery = dbquery("UPDATE " . DB_UG_LOTTERY_DRAWINGS . " SET lots=lots-1 WHERE draw_id='" . $drawrow['draw_id'] . "'");
    echo "<div align='center'><strong>" . $locale['ugly_213'] . "!</strong></div>\n<br />\n";
    echo "<div align='center'><strong>" . $locale['ugly_223'] . "!</strong></div>\n";
    unset($_REQUEST['draw_id']);
    //pagerefresh('meta','2',FUSION_SELF.'?op=start');
    pagerefresh('meta', '2', FUSION_SELF);
} else {
    $drawresult = dbquery("SELECT * FROM " . DB_UG_LOTTERY_DRAWINGS . " ORDER BY draw_id DESC LIMIT 0,1");
    $drawdata = dbarray($drawresult);
    echo "<div align='center'><strong>" . $locale['ugly_203'] . "</strong></div><br />";
    if ($drawdata['endtime'] > time()) {
        echo "<div align='center'>" . sprintf($locale['ugly_204'], ucwords(showdate("longdate", $drawdata['endtime'])));
        echo "<br />" . sprintf($locale['ugly_205'], $drawdata['lot_price'], UGLD_GOLDTEXT, $drawdata['prize'], $drawdata['jtype'], $drawdata['lots'], $drawdata['lot_amnt']) . "</div>";
        $ticket_count = dbcount("(lot_id)", DB_UG_LOTTERY_LOTS, "lot_owner='" . $userdata['user_id'] . "' AND lot_draw='" . $drawdata['draw_id'] . "'");
        $ticket_bought_count = dbcount("(lot_id)", DB_UG_LOTTERY_LOTS, "lot_draw='" . $drawdata['draw_id'] . "'");
예제 #9
0
function textcharge($userid, $text, $base, $type = 'word')
{
    if ($type == 'char') {
        $count_message = strlen($text);
    } else {
        $count_message = str_word_count($text);
    }
    if ($count_message <= '5') {
        $charge = $base / $base;
    } elseif ($count_message >= '5' && $count_message <= '20') {
        $charge = $base / 2;
    } elseif ($count_message <= '49' && $count_message >= '21') {
        $charge = $base;
    } elseif ($count_message >= '50') {
        $charge = $base * 2;
    } else {
        $charge = $base;
    }
    takegold2($userid, $charge, 'cash');
    return $charge;
}
예제 #10
0
function gamble_gamble()
{
    //Gamble for gold
    global $locale, $golddata, $userdata;
    if (isset($_POST['agree']) && isset($_POST['op'])) {
        $agree = $_POST['agree'];
        $op = $_POST['op'];
    }
    table_top($locale['urg_gamble_113']);
    echo "<table width='100%' cellpadding='5' cellspacing='0' border='0' class='tbl-border'>\n";
    echo "<tr valign='top' width='100%'>\n";
    echo "<td width='100%' align='center'>\n";
    if ($golddata['gamble'] < date('Ymd')) {
        if (isset($agree) == '1') {
            if ($golddata['cash'] + $golddata['bank'] < UGLD_GAMBLE_ALLOW) {
                //simple randomization of the difference between the two numers
                $amount = mt_rand(UGLD_GAMBLE_LOW, UGLD_GAMBLE_HIGH);
                //is it positive amount?
                if ($amount < 0) {
                    $amountLoss = abs($amount);
                    if ($golddata['cash'] > $amountLoss) {
                        takegold2($userdata['user_id'], $amountLoss, 'cash', 1);
                        echo $locale['urg_gamble_114'] . formatMoney($amountLoss) . "!\n";
                        pagerefresh('meta', '5', FUSION_SELF . '?op=gamble_menu');
                        //show message
                    } else {
                        //do we need this? we now have the force and accountant so maybe can remove it?
                        $result = db_query("UPDATE " . DB_UG3 . " SET bank = bank - " . $amountLoss . " WHERE owner_id = '" . $userdata['user_id'] . "' LIMIT 1");
                        echo $locale['urg_gamble_114'] . formatMoney($amountLoss) . $locale['urg_gamble_116'];
                    }
                } else {
                    //$points = $golddata['cash'] + $amount;
                    payuser($userdata['user_id'], $amount, 'cash');
                    echo $locale['urg_gamble_115'] . formatMoney($amount) . '!';
                    pagerefresh('meta', '5', FUSION_SELF . '?op=gamble_menu');
                    //show message
                }
            } else {
                echo $locale['urg_gamble_117'];
            }
            //timer for daily steal only
            dbquery("UPDATE " . DB_UG3 . " SET gamble = '" . date('Ymd') . "' WHERE owner_id = '" . $golddata['owner_id'] . "' LIMIT 1");
        } else {
            if ($golddata['cash'] + $golddata['bank'] < UGLD_GAMBLE_ALLOW) {
                echo "<form action='index.php' method='post'>\n";
                echo "<input type='hidden' name='op' value='gamble_gamble' />\n";
                echo $locale['urg_gamble_118'] . formatMoney(UGLD_GAMBLE_LOW) . "<br />\n";
                echo $locale['urg_gamble_119'] . formatMoney(UGLD_GAMBLE_HIGH) . "<br />\n";
                echo "<strong>" . $locale['urg_gamble_120'] . "</strong>\n";
                echo "<input type='checkbox' name='agree' value='1' />&nbsp;\n";
                echo "&nbsp;<input class='button' type='submit' value='" . $locale['urg_gamble_121'] . "' />\n";
                echo "</form>\n";
            } else {
                echo $locale['urg_gamble_117'];
            }
        }
    } else {
        echo $locale['urg_gamble_122'];
        pagerefresh('meta', '5', FUSION_SELF . '?op=gamble_menu');
        //show message
    }
    echo "</td>\n";
    echo "</tr>\n</table>\n";
    closetable();
}
예제 #11
0
function bank_complete()
{
    //Finalize transactions at the bank
    global $userdata, $locale, $golddata;
    if (!ItemOwned("GLD_BANK_ACCOUNT", $golddata['owner_id']) || !UGLD_BANK_ENABLED) {
        redirect(FUSION_SELF . "?op=bank_menu");
    }
    $erro = '';
    table_top($locale['urg_bank_121']);
    echo "<div>\n";
    if ($_POST['type'] == "" || $_POST['amount'] == "") {
        echo $locale['urg_bank_113'];
        $erro = '1';
    } elseif ($_POST['type'] == "deposit") {
        $_POST['amount'] = (int) $_POST['amount'];
        if ($_POST['amount'] > $golddata['cash']) {
            echo $locale['urg_bank_114'];
            $erro = '1';
        } elseif ($_POST['amount'] <= 0) {
            echo $locale['urg_bank_115'];
            $erro = '1';
        } elseif ($_POST['amount'] < UGLD_BANK_DEPOSIT_MIN) {
            echo sprintf($locale['urg_bank_116'], formatMoney(UGLD_BANK_DEPOSIT_MIN));
            $erro = '1';
        } elseif ($_POST['amount'] + $golddata['bank'] > 9999999.99) {
            echo sprintf($locale['urg_bank_131'], UGLD_GOLDTEXT);
            $erro = '1';
        } else {
            takegold2($userdata['user_id'], $_POST['amount'], 'cash');
            payuser($userdata['user_id'], $_POST['amount'], 'bank');
            echo sprintf($locale['urg_bank_117'], formatMoney($golddata['bank'] + $_POST['amount']), formatMoney($golddata['cash'] - $_POST['amount'])) . "<br />";
        }
    } elseif ($_POST['type'] == "withdraw") {
        $_POST['amount'] = (int) $_POST['amount'];
        if ($_POST['amount'] > $golddata['bank']) {
            echo sprintf($locale['urg_bank_118'], UGLD_BANK_NAME);
            $erro = '1';
        } elseif ($_POST['amount'] <= 0) {
            echo $locale['urg_bank_115'];
            $erro = '1';
        } elseif ($_POST['amount'] < UGLD_BANK_WITHDRAW_MIN) {
            echo sprintf($locale['urg_bank_116'], formatMoney(UGLD_BANK_WITHDRAW_MIN));
            $erro = '1';
        } else {
            takegold2($userdata['user_id'], $_POST['amount'], 'bank');
            payuser($userdata['user_id'], $_POST['amount'], 'cash');
            echo sprintf($locale['urg_bank_119'], formatMoney($golddata['cash'] + $_POST['amount']), formatMoney($golddata['bank'] - $_POST['amount'])) . "<br />";
        }
    } else {
        echo $locale['urg_bank_120'];
    }
    unset($_REQUEST['amount'], $_REQUEST['type'], $_REQUEST['op']);
    if ($erro == '1') {
        pagerefresh('meta', '2', FUSION_SELF . '?op=bank_start');
        //show message
    } else {
        pagerefresh('java', '0', FUSION_SELF . '?op=bank_start');
        //just go
    }
    echo "</div>\n";
    closetable();
}
예제 #12
0
         } else {
             $gold = dbarray(dbquery("SELECT * FROM " . $db_prefix . "users_points WHERE owner_id={$userdata['user_id']}"));
             $available = $gold['points_total'] + 1;
         }
         //edited to work with UG3 and UG2 - End
         if ($available <= $game['cost'] && $game['cost'] > 1) {
             if (!isset($p)) {
                 redirect("" . INFUSIONS . "varcade/arcade.php?lackofgold&game=" . $game['lid'] . "");
             } else {
                 redirect("" . INFUSIONS . "varcade/arcade.php?p=1&lackofgold&game=" . $game['lid'] . "");
             }
             exit;
         } else {
             //edited to work with UG3 and UG2 - Start
             if (USERGOLD) {
                 takegold2($userdata['user_id'], $game['cost'], 'cash', 0);
             } else {
                 $payment = $gold['points_total'] - $game['cost'];
                 $result = dbquery("UPDATE " . $db_prefix . "users_points SET points_total = '{$payment}' WHERE owner_id ={$userdata['user_id']} LIMIT 1");
             }
             //edited to work with UG3 and UG2 - End
             echo '<tr><td colspan="4" class="tbl1" align="center"><B>' . $locale['GARC115'] . ' ' . $game['cost'] . ' ' . $locale['GARC116'] . '</B></td></tr><br>';
         }
     }
 }
 if ($varcsettings['ratings'] == "1") {
     echo "<tr><td align='center'>";
     rating_bar($game['lid']);
     echo "</td></tr>";
 }
 echo '</table>';