Date: 10/29/00
- Next message: c _wyong: "[phplib] does Phplib have full support on php4?"
- Previous message: Hyun Jo: "[phplib] how do i cancel a login?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Dear folks,
I'm a NewBie on PhpLib and I believe there is only littel misspell in
the code, but I can't fix it.
I'm running Linux 6.2, with Apache 1.3.4, PHP 3.0.7, PHPLib Rel. 7.2b
and MySQL 3.22.21.
PHP is installed as CGI-Version and I don't use an auto_prepend
statement.
1. error:
If I call the following testfile.php3, the browser want's to set a
cookie named Example_Session and the page will be opened. But on reload
the browser sets an cookie again and my variable $s is not incremented.
Why?
The connection to my database works fine. In the tables active_sessions
and session_stats the sessions are always registered.
2. error:
This error comes with the variable $fallback_mode = "get"; If I take
this to my local.inc it result in an endless loop to accept always the
same cookie with always the same values and I have to kill the process.
----- my testfile.php3 in document-root /opt/www_test/phptest -------
<?php
include("/opt/www_test/phplib/php/prepend.php3");
page_open(array("sess"=>"Example_Session"));
$sess->register("s");
if (!isset($s)) $s = 0;
$s++;
?>
<html>
<head><title> Incrementing global Var $s </title></head>
<body>Global Var $s is: <?php print $s ?></body>
</html>
<?php page_close(); ?>
----------- my prepend.php3 -------------------------------------------
<?php
if (!isset($_PHPLIB) or !is_array($_PHPLIB)) {
# Aren't we nice? We are prepending this everywhere
# we require or include something so you can fake
# include_path when hosted at provider that sucks.
$_PHPLIB["libdir"] = "/opt/www_test/phplib/php/";
}
require($_PHPLIB["libdir"] . "db_mysql.inc");
require($_PHPLIB["libdir"] . "ct_sql.inc");
require($_PHPLIB["libdir"] . "session.inc");
# require($_PHPLIB["libdir"] . "auth.inc");
# require($_PHPLIB["libdir"] . "perm.inc");
# require($_PHPLIB["libdir"] . "user.inc");
require($_PHPLIB["libdir"] . "local.inc");
require($_PHPLIB["libdir"] . "page.inc");
?>
------------my local.inc -----------------------------------------------
<?php
class DB_Example extends DB_Sql {
var $Host = "localhost";
var $Database = "myDB";
var $User = "username";
var $Password = "userspassword";
}
class Example_CT_Sql extends CT_Sql {
var $database_class = "DB_Example";
var $database_table = "active_sessions";
}
class Example_Session extends Session {
var $classname = "Example_Session";
var $magic = "Hocuspocus"; ## ID seed
var $mode = "cookie"; ## We propagate session IDs
with cookies
# var $fallback_mode = "get"; ## if set this variable I
have to accept thousands of cookies or to kill the browser
var $lifetime = 0; ## 0 = do session cookies,
else minutes
var $that_class = "Example_CT_Sql"; ## name of data storage
container
var $auto_init = "setup.inc";
}
?>
-------------my setup.inc ----------------------------
<?php
global $HTTP_REFERER, $REMOTE_ADDR, $HTTP_USER_AGENT;
$db = new DB_Example;
$tab = "session_stats";
$now = date("YmdHis", time());
$query = sprintf("insert into %s ( name, sid, start_time, referer,
addr, user_agent ) values ( '%s', '%s', '%s', '%s', '%s',
'%s' )",
$tab,
$sess->name,
$sess->id,
$now,
$HTTP_REFERER,
$REMOTE_ADDR,
$HTTP_USER_AGENT);
$db->query($query);
# define variable $s as global
global $s;
$sess->register($s);
?>
Thank's
Armin
----- http://www.armin-grubert.vu.de ------
Dipl.-Geol. A. Grubert Oppenheimer Straße 28
Tel.: 06737 - 809076 55278 Köngernheim
--------- agrubert <email protected> --------
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: c _wyong: "[phplib] does Phplib have full support on php4?"
- Previous message: Hyun Jo: "[phplib] how do i cancel a login?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

