Skip to content

Commit

Permalink
Snapshot 0.8.16-rc2
Browse files Browse the repository at this point in the history
  • Loading branch information
quassy committed Jan 20, 2015
1 parent 2bbdee8 commit 91031b5
Show file tree
Hide file tree
Showing 157 changed files with 4,819 additions and 3,177 deletions.
2 changes: 1 addition & 1 deletion COPYING
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MyPHPpa (c) 2003 Jens Beyer, khan@web.de
MyPHPpa (c) 2003, 2007 Jens Beyer, khan@web.de

The following license GPL 2 or newer applize to all code in
and below this directory except for the 'battlecalc' who's
Expand Down
4 changes: 3 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ You will need a Unix machine (probably linux) to run this.

I've run it on a MySQL-3 (You need to create a database there -
mine was named planetarion), and PHP-4.
(NB: for mysql-4 you might need to convert some names)

Version 0.8.16 is an update to run on PHP-5 (eg 5.1) and
MySQL-4.1/5.0 (the 5.0 is less tested as is 0.8.16 at all).

To edit:

Expand Down
90 changes: 90 additions & 0 deletions TODO-session_handling.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@

Session Handling V2 f�r MyPHPPa
-------------------------------

Was bisher geschah
------------------

Session-handling V1 ist ein Sessionmanagement auf cookies, ihrer
Lebensdauer und den darin gespeicherten Userbezogenen Daten simples
Authentifizierungssystem.
Vorteil:
- F�r PHP < 4.1 einfach zu realisieren (in sp�teren Versionen sind cookies
per default keine globalen Variablen mehr).
Nachteil:
- Userdaten werden im Cookie auf Clientseite abgelegt.
- Nur Lebensdauer der Session wird DB-gest�zt auf Serverseite kontrolliert
- Jeder Request muss im Applikationscode gegen die DB authentifiziert werden


Wie soll es werden
------------------

Session-handling V2 soll auf dem PHP-Sessionmanagement basieren - im
speziellen implementiert unter PHP 5 ohne R�ckw�rtskompatibilit�t.

Anforderung:
- Keine userbezogenen Daten auf Clientseite
- Einfache Intergration in MyPHPpa
- Weitere sessionbezogenen Informationen innerhalb der Session (lokal)
speichern
- Vereinfachung der Request-Authentifizierung
- Loadbalancer f�hige Session

Technisches Konzept
-------------------
Das eigentliche Session-handling wird von PHP5 �bernommen; auf Clientseite
wird lediglich eine SessionID (per Cookie oder URL) verwaltet w�hrend das
Sessionmodul des Applikationscodes die lokal gehaltenen Autorisierungsdaten
erstellt und �berpr�ft.
Im ersten Schritt wird das eigentliche Sessionmodule mit Session-Datenfiles
unter /tmp realisiert. Sp�ter kann hierzu eine DB-basierende Methode
hinzukommen um die Forderung nach Rechner�bergreifenden Sessions nachzukommen.

Sessiondaten:
- PlanetId
- Sessiontimeout (Nicht mehr DB-gest�zt)
- ClientIP (Neu: �berpr�fung)

Folgende Usecases sind zu ber�cksichtigen:
- Login, Keine Session registriert
* Session erstellen
- Login, Session regged
-> last > session-timeout ?
* Neue session erstellen
Failure
- Pagerequest, Session
- Session valid ? IP korrekt ?
* Renew
Session beenden

Funktionen:
session_init # init (pre-)session settings
session_cache_expire()
session_start()

session_create # create new user session
_find_session # check if user has a session

session_check # check if session is valid/alive
_session_ip_check # check the embedded IP versus this request

session_destroy # destroy this session context

session_flush # flush and close session handling for this request

# Maybe
session_store # put a variable into the session
session_retrieve # get the data back

Prototypen:
int session_init();

int session_create();
int _find_session();

int session_check();
int _session_ip_check();

int session_destroy();
void session_flush();
2 changes: 1 addition & 1 deletion online/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/*
* MyPHPpa
* Copyright (C) 2003 Jens Beyer
* Copyright (C) 2003, 2007 Jens Beyer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
4 changes: 2 additions & 2 deletions online/admin/aalist.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/*
* MyPHPpa
* Copyright (C) 2003 Jens Beyer
* Copyright (C) 2003, 2007 Jens Beyer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -38,7 +38,7 @@
$myrow["alliance_id"] = 0;
print_alliance_status ($all);
} else {
$ref = "$PHP_SELF?allid=";
$ref = "$_SERVER[PHP_SELF]?allid=";
list_alliances_admin($ref);
}

Expand Down
8 changes: 4 additions & 4 deletions online/admin/admform.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/*
* MyPHPpa
* Copyright (C) 2003 Jens Beyer
* Copyright (C) 2003, 2007 Jens Beyer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -40,16 +40,16 @@ function submit_values($id, $values, $table) {
global $db;

$q = "select * from $table WHERE id = '$id'";
$result = mysql_query ($q, $db);
$result = mysqli_query ($db, $q );

if (mysql_num_rows($result) > 0) {
if (mysqli_num_rows($result) > 0) {
$q = "UPDATE $table set $values WHERE id='$id'";
} else {
$q = "INSERT INTO $table set $values";
}

echo "$q<br>";
$result = mysql_query ($q, $db);
$result = mysqli_query ($db, $q );

if (!$result) {
echo "<font color=\"red\">Update/insert into $table ".
Expand Down
12 changes: 6 additions & 6 deletions online/admin/admhead.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/*
* MyPHPpa
* Copyright (C) 2003 Jens Beyer
* Copyright (C) 2003, 2007 Jens Beyer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -20,8 +20,8 @@
*/

require_once "../auth_check.php";

require_once "../options.php";

pre_auth($Username,$Password,$Planetid,$Valid);

require_once "../dblogon.php";
Expand All @@ -35,14 +35,14 @@

require_once "../header.php";

if ($extra_header) {
if (ISSET($extra_header)) {
my_header($extra_header,0,0);
} else {
my_header("",0,0);
}

mysql_query("UPDATE user set last=NOW(),last_tick='$mytick',".
"ip='$HTTP_SERVER_VARS[REMOTE_ADDR]' ".
"WHERE planet_id='$Planetid'");
mysqli_query($db, "UPDATE user set last=NOW(),last_tick='$mytick'".
"ip='$_SERVER[REMOTE_ADDR]' ".
"WHERE planet_id='$Planetid'");

?>
26 changes: 13 additions & 13 deletions online/admin/admmain.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/*
* MyPHPpa
* Copyright (C) 2003 Jens Beyer
* Copyright (C) 2003, 2007 Jens Beyer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -30,38 +30,38 @@
<?php

$q = "SELECT count(*) FROM user";
$res = mysql_query($q, $db);
$rowu = mysql_fetch_row($res);
$res = mysqli_query($db, $q );
$rowu = mysqli_fetch_row($res);

$q = "SELECT count(*) FROM planet";
$res = mysql_query($q, $db);
$rowp = mysql_fetch_row($res);
$res = mysqli_query($db, $q );
$rowp = mysqli_fetch_row($res);

$gdate = date("D, d M Y H:i:s T");

echo "Currently $rowu[0] users on $rowp[0] planets [$gdate]<br>";

$q = "SELECT count(*) FROM planet WHERE mode=0";
$res = mysql_query($q, $db);
$rowm = mysql_fetch_row($res);
$res = mysqli_query($db, $q );
$rowm = mysqli_fetch_row($res);

echo "Banned: $rowm[0] planets<br>";

$q = "SELECT count(*) FROM news";
$res = mysql_query($q, $db);
$row = mysql_fetch_row($res);
$res = mysqli_query($db, $q );
$row = mysqli_fetch_row($res);

echo "News: $row[0] entries<br>";

$q = "SELECT count(*) FROM journal";
$res = mysql_query($q, $db);
$row = mysql_fetch_row($res);
$res = mysqli_query($db, $q );
$row = mysqli_fetch_row($res);

echo "Journal: $row[0] entries<br>";

$q = "SELECT count(*) FROM logging";
$res = mysql_query($q, $db);
$row = mysql_fetch_row($res);
$res = mysqli_query($db, $q );
$row = mysqli_fetch_row($res);

echo "logging: $row[0] entries<br>";

Expand Down
74 changes: 37 additions & 37 deletions online/admin/admnav.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/*
* MyPHPpa
* Copyright (C) 2003 Jens Beyer
* Copyright (C) 2003, 2007 Jens Beyer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -36,89 +36,89 @@

require_once "../header.php";

if ($extra_header) {
if (ISSET($extra_header)) {
my_header($extra_header,0);
} else {
my_header("",0);
}

mysql_query("UPDATE user set last=NOW(),last_tick='$mytick',".
"ip='$HTTP_SERVER_VARS[REMOTE_ADDR]' ".
"WHERE planet_id='$Planetid'");
mysqli_query($db, "UPDATE user set last=NOW(),last_tick='$mytick'".
"ip='$_SERVER[REMOTE_ADDR]' ".
"WHERE planet_id='$Planetid'");

if ($Planetid==1) {
?>
<center>
<table border="1" width="640">
<tr>
?>
<center>
<table border="1" width="640">
<tr>
<th colspan="5"> Administration </th>
<tr>
<tr>
<td width="20%"><a href="pinfo.php" target="admmain">Player Info</a></td>
<td width="20%"><a href="plog.php" target="admmain">Player Log</a></td>
<td width="20%"><a href="pban.php" target="admmain">Ban Player</a></td>
<td width="20%"><a href="pmail.php" target="admmain">Player Mail</a></td>
<td width="20%"><a href="pnews.php" target="admmain">Planet News</a></td>
</tr>
<tr>
</tr>
<tr>
<td width="20%"><a href="apol.php" target="admmain">Politics</a></td>
<td width="20%"><a href="aalist.php" target="admmain">Alliances</a></td>
<td width="20%"><a href="amem.php" target="admmain">A Members</a></td>
<td width="20%"><a href="afor.php" target="admmain">A Forum</a></td>
<td width="20%"><a href="ptop.php" target="admmain">Player Top</a></td>
</tr>
<tr>
</tr>
<tr>
<td width="20%"><a href="pdelete.php" target="admmain">Delete Player</a></td>
<td width="20%"><a href="ipban.php" target="admmain">Ban IP</a></td>
<td width="20%"><a href="pidle.php" target="admmain">Idle New</a></td>
<td width="20%"><a href="pidle2.php" target="admmain">Idle old</a></td>
<td width="20%"><a href="pmove.php" target="admmain">Player move</a></td>
<tr>
</tr>
<tr>
</tr>
<td width="20%"><a href="scan.php" target="admmain">Scans</a></td>
<td width="20%"><a href="units.php" target="admmain">Units</a></td>
<td width="20%"><a href="rc.php" target="admmain">Res/Con</a></td>
<td width="20%"><a href="high.php" target="admmain">Set Highscore</a></td>
<td width="20%"><a href="opt.php" target="admmain">Optimize</a></td>
</tr>
<tr>
</tr>
<tr>
<td width="20%"><a href="galpic.php" target="admmain">Galpic</a></td>
<td width="20%"><a href="pshuffle.php" target="admmain">Shuffle</a></td>
<td width="20%"><a href="freset.php" target="admmain">Reset All</a></td>
<td width="20%"><a href="havoc.php" target="admmain">Havoc</a></td>
<td width="20%"><a href="expand.php" target="admmain">Expand</a></td>
</tr>
</tr>

</table>
</center>
<hr>
<?php
} else {
?>
<center>
<table border="1" width="640">
<tr>
</table>
</center>
<hr>
<?php
} else {
?>
<center>
<table border="1" width="640">
<tr>
<th colspan="5"> Administration </th>
<tr>
<tr>
<td width="20%"><a href="pinfo.php" target="admmain">Player Info</a></td>
<td width="20%"><a href="plog.php" target="admmain">Player Log</a></td>
<td width="20%"><a href="pidle.php" target="admmain">Idle New</a></td>
<td width="20%"><a href="pidle2.php" target="admmain">Idle old</a></td>
<td width="20%"><a href="ipban.php" target="admmain">Ban IP</a></td>
</tr>
<tr>
</tr>
<tr>
<td width="20%"><a href="apol.php" target="admmain">Politics</a></td>
<td width="20%"><a href="aalist.php" target="admmain">Alliances</a></td>
<td width="20%"><a href="amem.php" target="admmain">A Members</a></td>
<td width="20%"><a href="afor.php" target="admmain">A Forum</a></td>
<td width="20%"><a href="ptop.php" target="admmain">Player Top</a></td>
</tr>
</tr>

</table>
</center>
<hr>
</table>
</center>
<hr>

<?php
}
<?php
}
echo "</center></body>";
require_once "../footerf.php";
?>
Loading

0 comments on commit 91031b5

Please sign in to comment.