diff --git a/COPYING b/COPYING
index 4bc8da0..6626ba0 100644
--- a/COPYING
+++ b/COPYING
@@ -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
diff --git a/README b/README
index 579fcce..d83f3ea 100644
--- a/README
+++ b/README
@@ -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:
diff --git a/TODO-session_handling.txt b/TODO-session_handling.txt
new file mode 100644
index 0000000..8b679f4
--- /dev/null
+++ b/TODO-session_handling.txt
@@ -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();
\ No newline at end of file
diff --git a/online/admin.php b/online/admin.php
index 411812a..df06a2c 100644
--- a/online/admin.php
+++ b/online/admin.php
@@ -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
diff --git a/online/admin/aalist.php b/online/admin/aalist.php
index e0a4a56..432e5f1 100644
--- a/online/admin/aalist.php
+++ b/online/admin/aalist.php
@@ -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
@@ -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);
}
diff --git a/online/admin/admform.php b/online/admin/admform.php
index 5d3899f..22b7538 100644
--- a/online/admin/admform.php
+++ b/online/admin/admform.php
@@ -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
@@ -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
";
- $result = mysql_query ($q, $db);
+ $result = mysqli_query ($db, $q );
if (!$result) {
echo "Update/insert into $table ".
diff --git a/online/admin/admhead.php b/online/admin/admhead.php
index 5033c7e..4fd57a7 100644
--- a/online/admin/admhead.php
+++ b/online/admin/admhead.php
@@ -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
@@ -20,8 +20,8 @@
*/
require_once "../auth_check.php";
-
require_once "../options.php";
+
pre_auth($Username,$Password,$Planetid,$Valid);
require_once "../dblogon.php";
@@ -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'");
?>
diff --git a/online/admin/admmain.php b/online/admin/admmain.php
index 6b2c636..27d3920 100644
--- a/online/admin/admmain.php
+++ b/online/admin/admmain.php
@@ -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
@@ -30,38 +30,38 @@
";
$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
";
$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
";
$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
";
$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
";
diff --git a/online/admin/admnav.php b/online/admin/admnav.php
index e426c8a..998a203 100644
--- a/online/admin/admnav.php
+++ b/online/admin/admnav.php
@@ -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
@@ -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) {
-?>
-
-
-
+ ?>
+
+
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
-