Re: PHP script gives no output or error message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Dec 27, 2008 at 1:13 PM, Daniel Brown <danbrown@xxxxxxx> wrote:
>    Good afternoon, John;
>
>    There's a syntax error on line 19:
>
>> if(external_fud_login(fud_fetch_user($user)['id']))!=NULL) //User ID is valid and logged in
>
>    It should be:
>        if(external_fud_login(fud_fetch_user($user['id']))!=NULL)
> //User ID is valid and logged in

Thanks, turns out there were multiple problems with my code. My final
working code is:

<?php
//Here we grab the authenticated user's name
//and either automatically log them in using an existing account
//or register them

require_once('/users/u15/jmusbach/.html_pages/FUDforum2/GLOBALS.php');
require_once('/users/u15/jmusbach/FUDforumDAT/scripts/fudapi.inc.php');
require_once('/users/u15/jmusbach/FUDforumDAT/scripts/forum_login.php');

global $_SERVER;
$user=$_SERVER['WEBAUTH_USER'];
$realname = $_SERVER['WEBAUTH_LDAP_GIVENNAME'] . ' '
.$_SERVER['WEBAUTH_LDAP_SN'];
$email = $user . '@blah.com';
$uid=_fud_simple_fetch_query(array("'".$user."'"), "SELECT * FROM
".$GLOBALS['DBHOST_TBL_PREFIX']."users WHERE login IN({ARG})");
$login=external_fud_login($uid->id);
if(!empty($uid->id) && !empty($login)) //User ID is valid and logged in
{
        //echo("Welcome, " . $user . ", please wait while you are
logged in...");
	header( 'Location: https://blah.com/~jmusbach/FUDforum2/?S='.$login);

}
else //User ID is invalid, register and log in
{
	//echo("Welcome, " . $user . ", please wait while you are registered
and logged in...");
        $vals['login']=$user;
        $vals['passwd']="password";
        $vals['email']=$email;
        $vals['name']=$realname;
        $uid=fud_add_user($vals,$error);
        $login=external_fud_login($uid);

        if($uid!=0 and empty($error))
        {
          header('Location: https://blah.com/~jmusbach/FUDforum2/?S='.$login);
	}
        else
        {
          echo($error);
          die();
        }
	
}



?>

for anyone who may be trying to accomplish the same thing as me. In
addition I edited index.php in the themes folder and added a php
clause such that in the event the user is anonymous they are
redirected to the autologin.php script and I also edited the
register.php themes script to omit the UserCP password field and
password confirmation since everyone in this setup is assigned one
long random password (the thought being that the kerberos
username/password is enough to worry about, there should be no need to
worry about another username/password).

-- 
Best Regards,

John Musbach

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux