[PHPLIB-DEV] cvs commit From: athompso (phplib-dev <email protected>)
Date: 10/29/99

From: athompso
Date: Fri Oct 29 12:13:02 1999
Modified files:
      php-lib/pages/admin/view_sessions.php3

Log message:
OK, I went crazy, but now it actually works fairly nicely. :-)
To think one simple suggestion about backward compatability would cause so
many headaches...

Index: php-lib/pages/admin/view_sessions.php3
diff -u php-lib/pages/admin/view_sessions.php3:1.6 php-lib/pages/admin/view_sessions.php3:1.7
--- php-lib/pages/admin/view_sessions.php3:1.6 Fri Oct 29 11:28:03 1999
+++ php-lib/pages/admin/view_sessions.php3 Fri Oct 29 12:12:31 1999
@@ -10,11 +10,32 @@
   ## Create a subclass of table specifically to override table_cell in order to handle
   ## the base64-encoded session data
   class Base64_Table extends Table {
- function table_cell($row, $col, $key, $val, $class="")
+
+ var $enc_methods = array(
+ "base64" => array("enc" => "base64_encode", "dec" => "base64_decode"),
+ "slashes" => array("enc" => "addslashes", "dec" => "stripslashes")
+ );
+ var $encoding_mode = "base64";
+
+
+ function table_cell($row, $col, $key, $val, $class="")
     {
       $this->table_cell_open($class);
- if( $key=="val") { $val = base64_decode($val); };
- printf("%s", $val);
+ if( $key=="val") {
+ # get encoding method from (method:value) pair
+ $colon_pos = strpos($val,':');
+ $str_method = substr ( $val , 0 , $colon_pos );
+ $str_value = substr ( $val , $colon_pos + 1 );
+ if( empty($str_method) ) {
+ $cmd = $this->enc_methods[$this->encoding_mode]["dec"];
+ } else {
+ $cmd = $this->enc_methods[$str_method]["dec"];
+ };
+ $dec_val = $cmd($str_value);
+ printf("<FONT COLOR=\"green\"><EM>Decoded using %s:</EM></FONT><BR>%s", $cmd, $dec_val);
+ } else {
+ printf("%s", $val);
+ };
       $this->table_cell_close($class);
     }
   };
@@ -105,6 +126,6 @@
 </table>
 </form>
 <?php page_close() ?>
-<!-- $Id: view_sessions.php3,v 1.6 1999/10/29 09:28:03 athompso Exp $ -->
+<!-- $Id: view_sessions.php3,v 1.7 1999/10/29 10:12:31 athompso Exp $ -->
 </body>
 </html>

-
PHPLIB Developers Mailing List. Send messages to <phplib-dev <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>> in
the body, not the subject, of your message.