Example #1
0
//fleet();
switch ($act) {
    case del:
        del();
        news();
        show_battlereports();
        show_research();
        planets();
        fleets();
        production();
        break;
    case delete_all:
        delete_all();
        news();
        show_battlereports();
        show_research();
        planets();
        fleets();
        production();
        break;
    default:
        news();
        show_battlereports();
        show_research();
        planets();
        fleets();
        production();
        break;
}
// ENDE
include "../spaceregentsinc/footer.inc.php";
Example #2
0
function start()
{
    global $uid;
    global $tid;
    global $time;
    $sth = mysql_query("select * from tech where t_id={$tid} and com_time={$time}");
    if (!$sth) {
        show_error("Database failure!");
        return 0;
    }
    if (mysql_num_rows($sth) == 0) {
        show_error("Little hacker, eh? :D");
        return 0;
    }
    $sth = mysql_query("select * from researching where uid='" . $uid . "'");
    if (mysql_num_rows($sth) > 0) {
        show_error("You are already researching!");
        status();
        show_research();
        return 0;
    }
    $sth = mysql_query("select t.* from tech as t left join research as r on t.t_id=r.t_id and r.uid={$uid} and r.t_id={$tid} where r.t_id is NULL");
    if (!$sth) {
        show_error("Database failure!");
        return 0;
    }
    $ausgabe = false;
    while ($research = mysql_fetch_array($sth)) {
        $sth1 = mysql_query("select * from tech where t_id=" . $research["t_id"] . " and depend is NULL");
        // $sth2=mysql_query("select * from tech as t left join research as r on (t.excl=r.t_id and r.uid=$uid) where r.t_id is NULL and t.t_id=".$research["t_id"]);
        $sth2 = mysql_query("select t.* from tech as t,research as r where r.t_id=t.excl and t.t_id=" . $research["t_id"]);
        $sth3 = mysql_query("select t.* from tech as t,research as r where t.depend=r.t_id and r.uid={$uid} and t.t_id=" . $research["t_id"]);
        if ((mysql_num_rows($sth1) > 0 or mysql_num_rows($sth3) > 0) and mysql_num_rows($sth2) == 0 and $research["t_id"] == $tid) {
            $ausgabe = true;
        }
    }
    if ($ausgabe != true) {
        show_error("You are not permitted to research this technology!");
        status();
        show_research();
        return 0;
    }
    $sth = mysql_query("insert into researching (t_id,uid,time) values ('{$tid}','{$uid}','{$time}')");
    if (!$sth) {
        show_error("Database failure!");
        return 0;
    }
}