Changeset 1558 in ExiteCMS for trunk/setuser.php


Ignore:
Timestamp:
07/30/08 16:04:17 (4 years ago)
Author:
hverton
Message:

added preliminary support for multiple authentication methods. Currently, local database and OpenID are supported

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/setuser.php

    r1454 r1558  
    1515require_once dirname(__FILE__)."/includes/core_functions.php"; 
    1616require_once dirname(__FILE__)."/includes/theme_functions.php"; 
    17  
    1817// temp storage for template variables 
    1918$variables = array(); 
     
    5756        $message['line2'] =  "<b>".$locale['196']."</b>"; 
    5857    } else { 
     58        if (isset($_GET['openid_mode'])) { 
     59            // handle openid login 
     60            require_once(PATH_INCLUDES."class.openid.php"); 
     61            $openid = new SimpleOpenID; 
     62            $openid->SetIdentity(urldecode($_GET['openid_identity'])); 
     63            if ($openid->ValidateWithServer()) { 
     64                $result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_openid_url='".strtolower($_GET['openid_identity'])."'"); 
     65                if (dbrows($result) != 0) { 
     66                    // found, get the record and do some more validation 
     67                    $res = auth_user_validate(dbarray($result)); 
     68                    if (!is_array($res)) { 
     69                        die('invalid res'); 
     70                    } 
     71                } else { 
     72                    die('user not found'); 
     73                } 
     74            } else { 
     75                _debug($openid->GetError(), true); 
     76            } 
     77        } 
    5978        if (isset($_SESSION['userinfo'])) { 
     79            // handle local login 
    6080            $userinfo_vars = explode(".", $_SESSION['userinfo']); 
    6181            $user_pass = (preg_match("/^[0-9a-z]{32}$/", $userinfo_vars['1']) ? $userinfo_vars['1'] : ""); 
     
    6787                } 
    6888                $result = dbquery("DELETE FROM ".$db_prefix."online WHERE online_user='0' AND online_ip='".USER_IP."'"); 
    69                 $message['line2'] =  "<b>".$locale['193'].$user."</b>"; 
     89                $message['line2'] =  "<b>".$locale['193'].$data['user_name']."</b>"; 
    7090            } else { 
    7191                $message['line2'] =  "<b>".$locale['196']."</b>"; 
Note: See TracChangeset for help on using the changeset viewer.