ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-lib
php-lib
[phplib-users] Problem with loginform.ihtml inclusion passing from PH4 to PHP5
by Davide Strepparava other posts by this author
Jan 30 2007 1:10AM messages near this date
Re: [phplib-users] phplib and PHP5? | Re: [phplib-users] Problem with loginform.ihtml inclusion passing from PH4 to PHP5
Hi all,
I am a newbie with phplib and I must port an old software that use them 
from PHP4 to PHP5.
Unfortunately I don't realize to do it.

This is the old system where the software runs correctly:
OS: Debian Woody 3.0
PHP version: 4.1.2-4
Apache version:  1.3.26
MySQL server version: 3.23.49-8
PHPLib version: 7.4

Before on this system there was an old PHPlib version, but copying 
logger.inc and language.inc in phplib
directory I realize to use PHPLib 7.4 with no problem (I have no errors 
in Apache's error.log).

Instead this is the new system where the software does not run correctly:
OS: OpenSuSE 10.2
PHP version: 5.2.0
Apache version:  2.2.3
MySQL server version: 5.0.26
PHPLib version: 7.4

On this system when I go to DocumentRoot's index.php, the browser give 
me nothing as output.
After some test I noted that when local.inc is loaded by prepend.inc the 
function auth_loginform that includes loginform.ihtml
is not executed. In this way I can't access the login form. I am sure 
the local.inc has been executed.
auth_loginforn belongs to Control_Auth class, an extension of Auth, this 
class is defined in the DocumentRoot's local.inc,
I report it below:

class Control_Auth extends Auth {
  var $classname      = "Control_Auth";

  var $lifetime       =  120; // two hours
  var $refresh        =    1; // validate perms every 10 minutes

  var $database_class = "DB_Control";
  var $database_table = "auth_user";
 
  function auth_loginform() {            #Function that has been 
executed with the old system
    global $sess;                        #but not with the new.
   
    include("loginform.ihtml");        
  }
 
  function auth_validatelogin() {
    global $username, $password;
   
    if(isset($username)) {
      $this-> auth["uname"]=$username;        ## This provides access for 
"loginform.ihtml"
    }
   
   
    $uid = false;
   
    $this-> db->query(sprintf("select user_id, perms ".
                             "        from %s ".
                             "       where username = '%s' ".
                             "         and password = '%s'",
                          $this-> database_table,
                          addslashes($username),
                          addslashes($password)));

    while($this-> db->next_record()) {
      $uid = $this-> db->f("user_id");
      $this-> auth["perm"] = $this->db->f("perms");
    }

    if ($uid) {
      $this-> db->query(sprintf("update %s set lastlog=now() WHERE 
user_id='%s'",
        $this-> database_table,
        addslashes($uid)));
      $log = new Control_Logger;
      $log-> message(sprintf("User %s logged in.", $username), $username);
    }
   
    return $uid;
  }

  function auth_refreshlogin() {
    $uid = false;
   
    //print "3: I am in auth_refreshlogin<br> ";
   
    $this-> db->query(sprintf("select user_id, perms ".
                             "        from %s ".
                             "       where user_id = '%s' ",
                             $this-> database_table,
                             addslashes($this-> auth["uid"])));

    while($this-> db->next_record()) {
      $uid = $this-> db->f("user_id");
      $this-> auth["perm"] = $this->db->f("perms");
    }

    return $uid;
  }
}


In the old system all works fine also with the newest version of PHPlib, 
so I don't think the problem is due to PHPlib.
Have you any ideas, please?

Kind regards and thank you for the attention,
Davide Strepparava





-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
phplib-users mailing list
phplib-users@[...].net
https://lists.sourceforge.net/lists/listinfo/phplib-users
Thread:
Davide Strepparava
Frank Bax
Layne Weathers

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved