Example #1
0
function pointConversion($conn, $total, $id)
{
    $before = getPoints($conn, $id);
    $points = 0;
    if ($total >= 49000 && $total <= 69999) {
        $points = 10;
    } else {
        if ($total >= 70000 && $total <= 90999) {
            $points = 15;
        } else {
            if ($total >= 91000 && $total <= 111999) {
                $points = 20;
            } else {
                if ($total >= 112000 && $total <= 132999) {
                    $points = 25;
                } else {
                    if ($total >= 133000) {
                        $points = 30;
                    }
                }
            }
        }
    }
    $after = $before + $points;
    setPoints($conn, $id, $after);
}
Example #2
0
<?php

require_once './www.playconquest.com/db_connect.php';
//require_once('./db_connect.php');
$servercount = getServerNumber();
for ($x = 1; $x < $servercount + 1; $x++) {
    $query = "SELECT researchmod,ownerid FROM planets{$x} WHERE researchmod>0";
    $result = mysql_query($query);
    while ($row = mysql_fetch_array($result)) {
        $points = getPoints($x, $row[ownerid]);
        $points += $row[researchmod];
        setPoints($points, $x, $row[ownerid]);
    }
}
Example #3
0
function addResearch($rid, $sid, $id)
{
    //Get the points
    $points = getPoints($sid, $id);
    //Get the cost and check that the user has enough points
    $points -= getResearchStat(points, $rid);
    if ($points < 0) {
        return false;
    }
    //Add the research
    $type = getResearchStat(type, $rid);
    $query = "INSERT INTO tech{$sid}(ownerid,techid,type) VALUES({$id},{$rid},{$type})";
    $result = @mysql_query($query);
    if ($result) {
        //Take the points
        setPoints($points, $sid, $id);
        return true;
    } else {
        return false;
    }
}