PHP Authentication Class

Hello,
I just wanted to inform every that I have a php class 95% completed which basicilly mimics that of the perl script to authenticate. I'll be willing to share the script if anyone is interested.
Aaron Axelsen
UW-Whitewater

The class was written for PHP5, and you must be running PHP4. Give this one a try: http://omega1.uww.edu/itunesu/itunes.php4.txt
All the config file does is load in the global settings. You could make a config.php that holds the settings, or you can just modify the first function to actually have your information obtained from iTunes U instead of variables:
$this->siteURL = "somesite";
$this->debugSuffix = "/123456";
$this->sharedSecret = "asdf";
$this->administratorCredential = "Administrator@etc";

Similar Messages

  • NAM 3.2.1 Custom Authentication Class for BASIC not loaded

    Hi!
    Im trying to write a custom authentication class for
    BASIC/PROTECTED_BASIC, so I started with the PasswordClass sample from
    SDK novell-nacm3_2-devel-2012.08.10.tar.gz, stripped out the
    STSAuthenticationClass and changed the type to
    AuthnConstants.PROTECTED_PASSWORD --> and it works!
    public String getType() {
    return AuthnConstants.PROTECTED_PASSWORD;
    Next I wanted to create a custom BASIC auth class by changing the type
    to AuthnConstants.BASIC / AuthnConstants.PROTECTED_BASIC
    public String getType() {
    return AuthnConstants.PROTECTED_BASIC;
    but now IDP complains about the unsupported type.
    <amLogEntry> 2012-12-20T15:11:17Z WARNING NIDS Application:
    AM#300105006: AMDEVICEID#FC77EC2A45509E7B: Failed to load
    authentication class due to unsupported type: ITdBasicTestClass
    </amLogEntry>
    Im running NAM 3.2.1 single box appliance for development/testing.
    There is an old thread here, that looks like the same issue:
    http://tinyurl.com/c6eawj6
    Any hits?
    regards
    Thomas
    PS: What i really want to solve is strip out the Domain from the
    username on basic authentication since most MS apps/clients provide the
    username in format DOMAIN\USER...
    reibenwein
    reibenwein's Profile: https://forums.netiq.com/member.php?userid=1382
    View this thread: https://forums.netiq.com/showthread.php?t=46430

    hmmm, well try writing the value out to stderr and see if you can at least make sure you are getting
    a good read.
    Like a System.out.println(AuthnConstants.PROTECTED_PASSWO RD);
    I ran into some strange stuff where some constants had no values for no apparent reason when they
    should.
    I would also try supplying the actual value instead of the constant and see if it goes through that
    way. ("ProtectedBasic")
    On 1/10/2013 11:14 AM, reibenwein wrote:
    >
    > Hi!
    >
    >
    > I copied com.novell.nam.authentication.PasswordClass to start with my
    > test custom auth class. It includes a method getType() like this:
    >
    > /**
    > * Get the authentication type this class implements
    > *
    > * @return returns the authentication type represented by this
    > class
    > */
    > public String getType() {
    > return AuthnConstants.PROTECTED_PASSWORD;
    > }
    >
    >
    > --> IDP loads my custom auth class, as long as a leave getType()
    > returning AuthnConstants.PROTECTED_PASSWORD! But this is form base
    > authentication. According to the API documentation (see page 17 in
    > namc_enu.pfd within the sdk download), getType should
    > returnAuthnConstants. PROTECTED_BASIC for secure Basic authentication
    > (or AuthnConstants.BASIC for non SSL Basic auth). So i changed getType()
    > like this:
    >
    >
    > /**
    > * Get the authentication type this class implements
    > *
    > * @return returns the authentication type represented by this class
    > */
    > public String getType() {
    > return AuthnConstants.PROTECTED_BASIC;
    > }
    >
    >
    > --> and then IPD comes with the error "Failed to load authentication
    > class due to unsupported type"...
    >
    >
    > regards,
    > Thomas
    >
    >

  • Connecting to a PHP authenticated website in Java

    Hi,
    I have some free time this Summer so I wanted to play around with Java. I'm trying to write a program that will connect to a PHP authenticated website, use it's search and download stuff from the site.
    My question is, what is the easiest way to authenticate? I saw that Java can do HTTP authentication, are there any classes in the library that will do this for me?
    Thanks,
    blanny

    Ensure you have the database set up as an ODBC data source and the following should work.
    Connection cconnection;
              try
                   String URL = "jdbc:odbc:YouDatabaseName" ;
       String user = "UserName specified for this DB";
                   String password = "PasswordYouSetForDB";
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   connection = DriverManager.getConnection(URL, user, password);
       System.out.println("CONNECTED TO DATABASE");
              catch(SQLException sqlex)
                   System.out.println(sqlex.toString());
              catch(ClassNotFoundException cnfex)
                   System.out.println(cnfex.toString());
              }

  • Omit the XML declaration when using the PHP MM_XSLTransform class

    Hi
    Is there any way to omit the XML declaration when using the
    PHP MM_XSLTransform class?
    When using the PHP MM_XSLTransform to transform some XML into
    HTML, the XML declaration is faithfully delivered, which is
    expected. In my case though this ends up in the body of the
    document and is not desired. I wish to choose that the XML
    declaration is not shown.
    I have tried to use the <xsl:output method="xml"
    encoding="utf-8" omit-xml-declaration="yes"/> in the XSL
    stylesheet but the declaration still appears.
    Any help?
    all the best
    Dave

    Jim20005 wrote:
    > I'm using XLS transfomation in DW for reading XML files.
    Now (I'm just back
    > form holiday), my webspace provider has updated to php
    5.1.5. I'm getting this
    > error:
    Comment out line 301 and add two new lines immediately after
    it like this:
    // $xml = DOMDocument::loadXML($content);
    $doc = new DOMDocument();
    $err = $doc->loadXML($content);
    This is part of a PHP 8.0.2 hotfix that can be obtained
    directly from
    Adobe support.
    David Powers
    Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    http://foundationphp.com/

  • Use Authentication class

    hi all,
    i see when i downloaded the urlservices that there is a class
    oracle.portal.provider.v1.http.Authentication
    that can dynamically change attr in provider.xml
    the question is where can i make use of the class ..
    should i create a dynamic page and write java code in it that uses this or what?

    Ahmed,
    Take a look at the Yahoo External Application sample. This sample uses the Authentication class.
    The Authentication class is used to authenticate your user against an existing external web application and then display the personalized contents as a portlet.
    Take a look at both the Basic Authentication and External application samples and articles
    Sue

  • Logon failure: unknown user name or bad password... ?Authenticator class?

    I'm connecting to a MS Exchange server (internally) but I'm getting the following error:
    ........Non SSL........
    POP3: connecting to host "xxxx.xxx.com", port 110
    S: +OK Microsoft Exchange POP3 server version 5.5.2658.25 ready
    C: USER [email protected]
    S: +OK
    C: PASS
    S: -ERR Logon failure: unknown user name or bad password.
    C: QUIT
    S: +OK Microsoft Exchange POP3 server version 5.5.2658.25 signing off
    test2 :: javax.mail.AuthenticationFailedException: Logon failure: unknown user name or bad password.
    I can get my email using Outlook because I don't have to provide a password to connect. So I left it blank in my program but I still can't
    login. Does this mean that I need to use the authenticator class?
    Here's the code I'm using to connect:
    public class ListMailSubjectLines
         private static void ListMailSubjectsLines()
              try
                   Properties pop3Props = new Properties();     
                     Session session = null;
                     Store store = null;
                   pop3Props.put("mail.pop3.host","xxxx.xxx.com");
                   pop3Props.put("mail.user","[email protected]");
                   pop3Props.setProperty("mail.passwd","");
                   //     String host = "";
                   //     String username = "";
                   //     String password = "";
                     if((pop3Props.getProperty("mail.pop3.ssl") != null) && (pop3Props.getProperty("mail.pop3.ssl").equalsIgnoreCase("true")))
                        System.out.println("........SSL........");
                           String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
                           pop3Props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY);
                           pop3Props.setProperty("mail.pop3.socketFactory.fallback", "false");
                           String portStr = ((pop3Props.getProperty("mail.pop3.port") != null) ? pop3Props.getProperty("mail.pop3.port") : "110");
                           pop3Props.setProperty("mail.pop3.port",  portStr);
                           pop3Props.setProperty("mail.pop3.socketFactory.port", portStr);
                           URLName url = new URLName("pop3://"+pop3Props.getProperty("mail.user")+":"+pop3Props.getProperty("mail.passwd")+"@"+pop3Props.getProperty("mail.host")+":"+pop3Props.getProperty("mail.pop3.port"));
                           session = Session.getInstance(pop3Props, null);
                           store = new POP3SSLStore(session, url);
                     else
                          System.out.println("........Non SSL........");
                           session = Session.getInstance(pop3Props, null);
                           store = session.getStore("pop3");
    session.setDebug(true);
                   store.connect(pop3Props.getProperty("mail.host"), pop3Props.getProperty("mail.user"), pop3Props.getProperty("mail.passwd"));
                     //store.connect(host, username, password);
                     Folder folder = store.getFolder("INBOX");
                     folder.open(Folder.READ_WRITE);
                     Message[] Msgs = folder.getMessages();
                     for(int i = 0; i < Msgs.length; i++)
                       System.out.println(Msgs.getSubject());
                   folder.close(true);
                   store.close();
                   System.out.println(Msgs[0].getSubject() + "test");
                   catch(NoSuchProviderException ec)
                        System.out.println("test1");
                   catch(MessagingException em)
                        System.out.println("\ntest2 :: " + em);
         public static void main( String args[] )
                   ListMailSubjectsLines();
    Thanks,
    ls6

    In case anyone wants to see the format and the final code here it is:
    Login name format:
    pop3Props.setProperty("mail.user","TEST_DOMAIN\\UserID\\mailboxID");
    Code
    import com.sun.mail.pop3.POP3SSLStore;
    import javax.mail.URLName;
    import javax.mail.Session;
    import javax.mail.Store;
    import javax.mail.Folder;
    import javax.mail.Message;
    import javax.mail.NoSuchProviderException;
    import javax.mail.MessagingException;
    import java.util.Properties;
    public class ListMailSubjectLines
         private static void ListMailSubjectsLines()
              try
              Properties pop3Props = new Properties();     
                Session session = null;
              Store store = null;                 
              pop3Props.put("mail.pop3.host","mailHOST");
              pop3Props.setProperty("mail.user","TEST_DOMAIN\\UserID\\mailboxID");
              pop3Props.setProperty("mail.passwd","passWord");               
                if((pop3Props.getProperty("mail.pop3.ssl") != null) && (pop3Props.getProperty("mail.pop3.ssl").equalsIgnoreCase("true")))
                   System.out.println("### SSL ###");
                      String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
                      pop3Props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY);
                      pop3Props.setProperty("mail.pop3.socketFactory.fallback", "false");
                      String portStr = ((pop3Props.getProperty("mail.pop3.port") != null) ? pop3Props.getProperty("mail.pop3.port") : "110");
                      pop3Props.setProperty("mail.pop3.port",  portStr);
                      pop3Props.setProperty("mail.pop3.socketFactory.port", portStr);
                      URLName url = new URLName("pop3://"+pop3Props.getProperty("mail.user")+":"+pop3Props.getProperty("mail.passwd")+"@"+pop3Props.getProperty("mail.pop3.host")+":"+pop3Props.getProperty("mail.pop3.port"));
                      session = Session.getInstance(pop3Props, null);
                      store = new POP3SSLStore(session, url);
                else
                     System.out.println( "### Non SSL ###" );
                      session = Session.getInstance( pop3Props, null );
                      store = session.getStore( "pop3" );
    //System.out.println(session.getStore());
    session.setDebug( true );
                   store.connect(pop3Props.getProperty( "mail.host" ), pop3Props.getProperty("mail.user"), pop3Props.getProperty("mail.passwd"));
                   if( store.isConnected() )
                           System.out.println( "\nCONNECTED\n" );
                   Folder folder = store.getDefaultFolder();
                   folder = folder.getFolder( "INBOX" );
                   folder.open( Folder.READ_WRITE );
                   Message[] Msgs = folder.getMessages();
                   for( int i = 0; i < Msgs.length; i++ )
                                         System.out.println( Msgs.getSubject() );
                   folder.close( true );
                   store.close();
              Folder folder = store.getFolder( "INBOX" );
              //Folder folder = store.getDefaultFolder();
              //folder = folder.getFolder( "INBOX" );
              folder.open( Folder.READ_ONLY );
              Message[] Msgs = folder.getMessages();
              for( int i = 0; i < Msgs.length; i++ )
                   System.out.println( folder.getUnreadMessageCount() );
                   System.out.println( Msgs[i].getSubject() );
                   System.out.println( Msgs[i].getContentType() );
                   System.out.println( Msgs[i].getSize() );
              folder.close( true );
              store.close();
              catch(NoSuchProviderException nSPE)
                   System.err.print( "### Line[88] ### " );
                   System.err.println( nSPE );
              catch(MessagingException mE)
                   System.err.print( "### Line[93] ### " );
                   System.err.println( mE );
    public static void main( String args[] )
              ListMailSubjectsLines();

  • PHP Authentication & Internet Explorer

    I am using DW8.02 and PHP 5.0 to develop my website. My
    service provider is using a Linux box and Apache. My PHP login
    webpages work fine using Firefox, Opera, and Netscape but I get my
    'access not allowed' webpage when using Internet Explorer 6.0 and
    7.0. I am using Dreamweaver 8.02's built-in 'Authentication Server
    Behavior' to create the log in page and to add a 'Restrict Access
    to Page' PHP script to the restricted webpages. Here is my code:
    Log in User:
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType,
    $theDefinedValue = "", $theNotDefinedValue = "")
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue)
    : $theValue;
    $theValue = function_exists("mysql_real_escape_string") ?
    mysql_real_escape_string($theValue) :
    mysql_escape_string($theValue);
    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" :
    "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? "'" . doubleval($theValue) .
    "'" : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" :
    "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue :
    $theNotDefinedValue;
    break;
    return $theValue;
    ?>
    <?php
    // *** Validate request to login to this site.
    if (!isset($_SESSION)) {
    session_start();
    $loginFormAction = $_SERVER['PHP_SELF'];
    if (isset($_GET['accesscheck'])) {
    $_SESSION['PrevUrl'] = $_GET['accesscheck'];
    if (isset($_POST['Username'])) {
    $loginUsername=$_POST['Username'];
    $password=$_POST['Password'];
    $MM_fldUserAuthorization = "Status";
    $MM_redirectLoginSuccess = "comm_t4tadmin_edit.php";
    $MM_redirectLoginFailed = "access_error.html";
    $MM_redirecttoReferrer = false;
    mysql_select_db($database_leathernecks, $leathernecks);
    $LoginRS__query=sprintf("SELECT Username, Password, Status
    FROM tblaccess WHERE Username=%s AND Password=%s",
    GetSQLValueString($loginUsername, "text"),
    GetSQLValueString($password, "text"));
    $LoginRS = mysql_query($LoginRS__query, $leathernecks) or
    die(mysql_error());
    $loginFoundUser = mysql_num_rows($LoginRS);
    if ($loginFoundUser) {
    $loginStrGroup = mysql_result($LoginRS,0,'Status');
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;
    if (isset($_SESSION['PrevUrl']) && false) {
    $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
    header("Location: " . $MM_redirectLoginSuccess );
    else {
    header("Location: ". $MM_redirectLoginFailed );
    ?>
    Restrict Access:
    <?php
    if (!isset($_SESSION)) {
    session_start();
    $MM_authorizedUsers = "edit";
    $MM_donotCheckaccess = "false";
    // *** Restrict Access To Page: Grant or deny access to this
    page
    function isAuthorized($strUsers, $strGroups, $UserName,
    $UserGroup) {
    // For security, start by assuming the visitor is NOT
    authorized.
    $isValid = False;
    // When a visitor has logged into this site, the Session
    variable MM_Username set equal to their username.
    // Therefore, we know that a user is NOT logged in if that
    Session variable is blank.
    if (!empty($UserName)) {
    // Besides being logged in, you may restrict access to only
    certain users based on an ID established when they
    login.
    // Parse the strings into arrays.
    $arrUsers = Explode(",", $strUsers);
    $arrGroups = Explode(",", $strGroups);
    if (in_array($UserName, $arrUsers)) {
    $isValid = true;
    // Or, you may restrict access to only certain users based
    on their username.
    if (in_array($UserGroup, $arrGroups)) {
    $isValid = true;
    if (($strUsers == "") && false) {
    $isValid = true;
    return $isValid;
    ?>
    Does anyone have any ideas why this is not working in only
    Internet Explorer? Any suggestions or help to resolve this is
    greatly appreciated.

    holymackeral wrote:
    > Another curious note... whether or not "Allow Cookies"
    is tuned on in IE 7.0,
    > localhost (running WindowsXP/IIS5.1) correctly processes
    the logons and
    > displays the restricted webpages locally. However with
    "Allow Cookies" turned
    > on, IE 7.0 still will not open restricted webpages on
    the remote host site
    > (running Linux/Apache).
    >
    > Does this narrow or broaden the issue? Help??
    No idea, sorry. :(
    David Powers
    Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    http://foundationphp.com/

  • Error: SHA1 digest error for javax/mail/Authenticator.class

    I am using javax.mail api to sending emails.
    when I calls main method of the class to send email its works perfect, but when I imports the same class in jsp its shows me above said error.
    My email server requires authentication before sending mails.
    please guide me how to use this class in jsp .
    class code is as below :
    =========================
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    import java.io.*;
    public class SendMailUsingAuthentication
    private static final String SMTP_HOST_NAME = "myserver.smtphost.com";
    private static final String SMTP_AUTH_USER = "myusername";
    private static final String SMTP_AUTH_PWD = "mypwd";
    private static final String emailMsgTxt = "Online Order Confirmation Message. Also include the Tracking Number.";
    private static final String emailSubjectTxt = "Order Confirmation Subject";
    private static final String emailFromAddress = "[email protected]";
    // Add List of Email address to who email needs to be sent to
    private static final String[] emailList = {"[email protected]", "[email protected]"};
    public static void main(String args[]) throws Exception
    SendMailUsingAuthentication smtpMailSender = new SendMailUsingAuthentication();
    smtpMailSender.postMail( emailList, emailSubjectTxt, emailMsgTxt, emailFromAddress);
    System.out.println("Sucessfully Sent mail to All Users");
    public void postMail( String recipients[ ], String subject,
    String message , String from) throws MessagingException
    boolean debug = false;
    //Set the host smtp address
    Properties props = new Properties();
    props.put("mail.smtp.host", SMTP_HOST_NAME);
    props.put("mail.smtp.auth", "true");
    Authenticator auth = new SMTPAuthenticator();
    Session session = Session.getDefaultInstance(props, auth);
    session.setDebug(debug);
    // create a message
    Message msg = new MimeMessage(session);
    // set the from and to address
    InternetAddress addressFrom = new InternetAddress(from);
    msg.setFrom(addressFrom);
    InternetAddress[] addressTo = new InternetAddress[recipients.length];
    for (int i = 0; i < recipients.length; i++)
    addressTo[i] = new InternetAddress(recipients);
    msg.setRecipients(Message.RecipientType.TO, addressTo);
    // Setting the Subject and Content Type
    msg.setSubject(subject);
    msg.setContent(message, "text/plain");
    Transport.send(msg);
    * SimpleAuthenticator is used to do simple authentication
    * when the SMTP server requires it.
    private class SMTPAuthenticator extends javax.mail.Authenticator
    public PasswordAuthentication getPasswordAuthentication()
    String username = SMTP_AUTH_USER;
    String password = SMTP_AUTH_PWD;
    return new PasswordAuthentication(username, password);

    Find all the jar files under Tomcat's installation directory and all the jar files in the jre/lib/ext directory.
    Make sure only one of them includes javax.mail.* classes.
    Note that setting CLASSPATH to a directory does not cause all jar files in that directory to be loaded.
    Finally, make sure Eclipse isn't copying the class files out of mail.jar and packaging them with your
    application.

  • PHP MPD Class

    Most mpd.class.php's are old and produce a lot of errors which caused me much frustration in this thread.
    I was wrapping my head around why phpmpreloaded worked and the others never and it's because it uses an updated mpd.class.php. To save others the frustration and hassle I figured I'd post the new class here.
    Enjoy.
    <?php
    * Sven Ginka 03/2010
    * Version mpd.class.php-1.3
    * - take over from Hendrik Stoetter
    * - removed "split()" as this function is marked depracted
    * - added property "xfade" (used by IPodMp, phpMp+)
    * - added property "bitrate" (used by phpMp+)
    * - added define "MPD_SEARCH_FILENAME"
    * - included sorting algorithm "msort"
    * - added function validateFile() for guessing a title if no ID3 data is given
    * Hendrik Stoetter 03/2008
    * - this a lightly modified version of mod.class Version 1.2.
    * - fixed some bugs and added some new functions
    * - Changes:
    * GetDir($url) -> GetDir(url,$sort)
    * var $stats
    * Benjamin Carlisle 05/05/2004
    * mpd.class.php - PHP Object Interface to the MPD Music Player Daemon
    * Version 1.2, Released 05/05/2004
    * Copyright (C) 2003-2004 Benjamin Carlisle ([email protected])
    * http://mpd.24oz.com/ | http://www.musicpd.org/
    * This program is free software; you can redistribute it and/or modify
    * it under the terms of the GNU General Public License as published by
    * the Free Software Foundation; either version 2 of the License, or
    * (at your option) any later version.
    * This program is distributed in the hope that it will be useful,
    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    * GNU General Public License for more details.
    * You should have received a copy of the GNU General Public License
    * along with this program; if not, write to the Free Software
    * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    // Create common command definitions for MPD to use
    define("MPD_CMD_STATUS", "status");
    define("MPD_CMD_STATISTICS", "stats");
    define("MPD_CMD_VOLUME", "volume");
    define("MPD_CMD_SETVOL", "setvol");
    define("MPD_CMD_PLAY", "play");
    define("MPD_CMD_STOP", "stop");
    define("MPD_CMD_PAUSE", "pause");
    define("MPD_CMD_NEXT", "next");
    define("MPD_CMD_PREV", "previous");
    define("MPD_CMD_PLLIST", "playlistinfo");
    define("MPD_CMD_PLADD", "add");
    define("MPD_CMD_PLREMOVE", "delete");
    define("MPD_CMD_PLCLEAR", "clear");
    define("MPD_CMD_PLSHUFFLE", "shuffle");
    define("MPD_CMD_PLLOAD", "load");
    define("MPD_CMD_PLSAVE", "save");
    define("MPD_CMD_KILL", "kill");
    define("MPD_CMD_REFRESH", "update");
    define("MPD_CMD_REPEAT", "repeat");
    define("MPD_CMD_LSDIR", "lsinfo");
    define("MPD_CMD_SEARCH", "search");
    define("MPD_CMD_START_BULK", "command_list_begin");
    define("MPD_CMD_END_BULK", "command_list_end");
    define("MPD_CMD_FIND", "find");
    define("MPD_CMD_RANDOM", "random");
    define("MPD_CMD_SEEK", "seek");
    define("MPD_CMD_PLSWAPTRACK", "swap");
    define("MPD_CMD_PLMOVETRACK", "move");
    define("MPD_CMD_PASSWORD", "password");
    define("MPD_CMD_TABLE", "list");
    define("MPD_CMD_PLMOVE", "move" );
    // Predefined MPD Response messages
    define("MPD_RESPONSE_ERR", "ACK");
    define("MPD_RESPONSE_OK", "OK");
    // MPD State Constants
    define("MPD_STATE_PLAYING", "play");
    define("MPD_STATE_STOPPED", "stop");
    define("MPD_STATE_PAUSED", "pause");
    // MPD Searching Constants
    define("MPD_SEARCH_ARTIST", "artist");
    define("MPD_SEARCH_TITLE", "title");
    define("MPD_SEARCH_ALBUM", "album");
    define("MPD_SEARCH_ANY", "any");
    define("MPD_SEARCH_FILENAME","filename");
    // MPD Cache Tables
    define("MPD_TBL_ARTIST","artist");
    define("MPD_TBL_ALBUM","album");
    $mpd_debug = 0;
    function addLog($text){
    global $mpd_debug;
    $style="background-color:lightgrey;border:thin solid grey;margin:5px;padding:5px";
    if ($mpd_debug) echo '<div style="'.$style.'">log:>'.$text.'</div>';
    function addErr($err){
    global $mpd_debug;
    if ($mpd_debug) echo 'error:>'.$err.'<br>';
    class mpd {
    // TCP/Connection variables
    var $host;
    var $port;
    var $password;
    var $mpd_sock = NULL;
    var $connected = FALSE;
    // MPD Status variables
    var $mpd_version = "(unknown)";
    var $state;
    var $current_track_position;
    var $current_track_length;
    var $current_track_id;
    var $volume;
    var $repeat;
    var $random;
    var $uptime;
    var $playtime;
    var $db_last_refreshed;
    var $num_songs_played;
    var $playlist_count;
    var $xfade;
    var $bitrate;
    var $num_artists;
    var $num_albums;
    var $num_songs;
    var $playlist = array();
    var $stats;
    // Misc Other Vars
    var $mpd_class_version = "1.2";
    var $debugging = FALSE; // Set to TRUE to turn extended debugging on.
    var $errStr = ""; // Used for maintaining information about the last error message
    var $command_queue; // The list of commands for bulk command sending
    // =================== BEGIN OBJECT METHODS ================
    /* mpd() : Constructor
    * Builds the MPD object, connects to the server, and refreshes all local object properties.
    function mpd($srv,$port,$pwd = NULL, $debug= FALSE ) {
    $this->host = $srv;
    $this->port = $port;
    $this->password = $pwd;
    $this->debugging = $debug;
    global $mpd_debug;
    $mpd_debug = $debug;
    $resp = $this->Connect();
    if ( is_null($resp) ) {
    addErr( "Could not connect" );
    return;
    } else {
    addLog( "connected");
    list ( $this->mpd_version ) = sscanf($resp, MPD_RESPONSE_OK . " MPD %s\n");
    if ( ! is_null($pwd) ) {
    if ( is_null($this->SendCommand(MPD_CMD_PASSWORD,$pwd)) ) {
    $this->connected = FALSE;
    addErr("bad password");
    return; // bad password or command
    if ( is_null($this->RefreshInfo()) ) { // no read access -- might as well be disconnected!
    $this->connected = FALSE;
    addErr("Password supplied does not have read access");
    return;
    } else {
    if ( is_null($this->RefreshInfo()) ) { // no read access -- might as well be disconnected!
    $this->connected = FALSE;
    addErr("Password required to access server");
    return;
    /* Connect()
    * Connects to the MPD server.
    * NOTE: This is called automatically upon object instantiation; you should not need to call this directly.
    function Connect() {
    addLog( "mpd->Connect() / host: ".$this->host.", port: ".$this->port."\n" );
    $this->mpd_sock = fsockopen($this->host,$this->port,$errNo,$errStr,10);
    if (!$this->mpd_sock) {
    addErr("Socket Error: $errStr ($errNo)");
    return NULL;
    } else {
    $counter=0;
    while(!feof($this->mpd_sock)) {
    $counter++;
    if ($counter > 10){
    addErr("no file end");
    return NULL;
    $response = fgets($this->mpd_sock,1024);
    addLog( $response );
    if (strncmp(MPD_RESPONSE_OK,$response,strlen(MPD_RESPONSE_OK)) == 0) {
    $this->connected = TRUE;
    return $response;
    if (strncmp(MPD_RESPONSE_ERR,$response,strlen(MPD_RESPONSE_ERR)) == 0) {
    // close socket
    fclose($this->mpd_sock);
    addErr("Server responded with: $response");
    return NULL;
    // close socket
    fclose($this->mpd_sock);
    // Generic response
    addErr("Connection not available");
    return NULL;
    /* SendCommand()
    * Sends a generic command to the MPD server. Several command constants are pre-defined for
    * use (see MPD_CMD_* constant definitions above).
    function SendCommand($cmdStr,$arg1 = "",$arg2 = "") {
    addLog("mpd->SendCommand() / cmd: ".$cmdStr.", args: ".$arg1." ".$arg2 );
    // Clear out the error String
    $this->errStr = NULL;
    $respStr = "";
    if ( ! $this->connected ) {
    addErr( "mpd->SendCommand() / Error: Not connected");
    } else {
    // Check the command compatibility:
    if ( ! $this->_checkCompatibility($cmdStr) ) {
    return NULL;
    if (strlen($arg1) > 0) $cmdStr .= " \"$arg1\"";
    if (strlen($arg2) > 0) $cmdStr .= " \"$arg2\"";
    fputs($this->mpd_sock,"$cmdStr\n");
    while(!feof($this->mpd_sock)) {
    $response = fgets($this->mpd_sock,1024);
    //addLog($response);
    // An OK signals the end of transmission -- we'll ignore it
    if (strncmp(MPD_RESPONSE_OK,$response,strlen(MPD_RESPONSE_OK)) == 0) {
    break;
    // An ERR signals the end of transmission with an error! Let's grab the single-line message.
    if (strncmp(MPD_RESPONSE_ERR,$response,strlen(MPD_RESPONSE_ERR)) == 0) {
    list ( $junk, $errTmp ) = strtok(MPD_RESPONSE_ERR . " ",$response );
    addErr( strtok($errTmp,"\n") );
    return NULL;
    // Build the response string
    $respStr .= $response;
    addLog("mpd->SendCommand() / response: '".$respStr."'\n");
    return $respStr;
    /* QueueCommand()
    * Queues a generic command for later sending to the MPD server. The CommandQueue can hold
    * as many commands as needed, and are sent all at once, in the order they are queued, using
    * the SendCommandQueue() method. The syntax for queueing commands is identical to SendCommand().
    function QueueCommand($cmdStr,$arg1 = "",$arg2 = "") {
    if ( $this->debugging ) echo "mpd->QueueCommand() / cmd: ".$cmdStr.", args: ".$arg1." ".$arg2."\n";
    if ( ! $this->connected ) {
    echo "mpd->QueueCommand() / Error: Not connected\n";
    return NULL;
    } else {
    if ( strlen($this->command_queue) == 0 ) {
    $this->command_queue = MPD_CMD_START_BULK . "\n";
    if (strlen($arg1) > 0) $cmdStr .= " \"$arg1\"";
    if (strlen($arg2) > 0) $cmdStr .= " \"$arg2\"";
    $this->command_queue .= $cmdStr ."\n";
    if ( $this->debugging ) echo "mpd->QueueCommand() / return\n";
    return TRUE;
    /* SendCommandQueue()
    * Sends all commands in the Command Queue to the MPD server. See also QueueCommand().
    function SendCommandQueue() {
    if ( $this->debugging ) echo "mpd->SendCommandQueue()\n";
    if ( ! $this->connected ) {
    echo "mpd->SendCommandQueue() / Error: Not connected\n";
    return NULL;
    } else {
    $this->command_queue .= MPD_CMD_END_BULK . "\n";
    if ( is_null($respStr = $this->SendCommand($this->command_queue)) ) {
    return NULL;
    } else {
    $this->command_queue = NULL;
    if ( $this->debugging ) echo "mpd->SendCommandQueue() / response: '".$respStr."'\n";
    return $respStr;
    /* AdjustVolume()
    * Adjusts the mixer volume on the MPD by <modifier>, which can be a positive (volume increase),
    * or negative (volume decrease) value.
    function AdjustVolume($modifier) {
    if ( $this->debugging ) echo "mpd->AdjustVolume()\n";
    if ( ! is_numeric($modifier) ) {
    $this->errStr = "AdjustVolume() : argument 1 must be a numeric value";
    return NULL;
    $this->RefreshInfo();
    $newVol = $this->volume + $modifier;
    $ret = $this->SetVolume($newVol);
    if ( $this->debugging ) echo "mpd->AdjustVolume() / return\n";
    return $ret;
    /* SetVolume()
    * Sets the mixer volume to <newVol>, which should be between 1 - 100.
    function SetVolume($newVol) {
    if ( $this->debugging ) echo "mpd->SetVolume()\n";
    if ( ! is_numeric($newVol) ) {
    $this->errStr = "SetVolume() : argument 1 must be a numeric value";
    return NULL;
    // Forcibly prevent out of range errors
    if ( $newVol < 0 ) $newVol = 0;
    if ( $newVol > 100 ) $newVol = 100;
    // If we're not compatible with SETVOL, we'll try adjusting using VOLUME
    if ( $this->_checkCompatibility(MPD_CMD_SETVOL) ) {
    if ( ! is_null($ret = $this->SendCommand(MPD_CMD_SETVOL,$newVol))) $this->volume = $newVol;
    } else {
    $this->RefreshInfo(); // Get the latest volume
    if ( is_null($this->volume) ) {
    return NULL;
    } else {
    $modifier = ( $newVol - $this->volume );
    if ( ! is_null($ret = $this->SendCommand(MPD_CMD_VOLUME,$modifier))) $this->volume = $newVol;
    if ( $this->debugging ) echo "mpd->SetVolume() / return\n";
    return $ret;
    /* GetDir()
    * Retrieves a database directory listing of the <dir> directory and places the results into
    * a multidimensional array. If no directory is specified, the directory listing is at the
    * base of the MPD music path.
    function GetDir($dir = "",$sort = "") {
    addLog( "mpd->GetDir()" );
    $resp = $this->SendCommand(MPD_CMD_LSDIR,$dir);
    $listArray = $this->_parseFileListResponse($resp);
    if ($listArray==null){
    return null;
    // we have 3 differnt items: directory, playlist and file
    // we have to sort them individually and separate
    // playlist and directory by name
    // file by $sort
    // 1st: subarrays
    $array_directory = $listArray['directories'];
    $array_playlist = $listArray['playlists'];
    $array_file = $listArray['files'];
    // 2nd: sort them
    natcasesort($array_directory);
    natcasesort($array_playlist);
    usort($array_file,"msort");
    // 3rd: rebuild
    $array_return= array(
    "directories"=> $array_directory,
    "playlists"=> $array_playlist,
    "files"=> $array_file
    foreach ($array_directory as $value) {
    $array_return[]["directory"] = $value;
    foreach ($array_playlist as $value) {
    $array_return[]["playlist"] = $value;
    $array_return = array_merge($array_return,$array_file);
    addLog( "mpd->GetDir() / return ".print_r($array_return,true));
    return $array_return;
    /* GetDirTest() (Unoffical add) -- Returns readable dir contents
    * Retrieves a database directory listing of the <dir> directory and places the results into
    * a multidimensional array. If no directory is specified, the directory listing is at the
    * base of the MPD music path.
    function GetDirTest($dir = "") {
    if ( $this->debugging ) echo "mpd->GetDir()\n";
    $resp = $this->SendCommand(MPD_CMD_LSDIR,$dir);
    #$dirlist = $this->_parseFileListResponse($resp);
    $dirlist = $this->_parseFileListResponseHumanReadable($resp);
    if ( $this->debugging ) echo "mpd->GetDir() / return ".print_r($dirlist)."\n";
    return $dirlist;
    /* PLAdd()
    * Adds each track listed in a single-dimensional <trackArray>, which contains filenames
    * of tracks to add, to the end of the playlist. This is used to add many, many tracks to
    * the playlist in one swoop.
    function PLAddBulk($trackArray) {
    if ( $this->debugging ) echo "mpd->PLAddBulk()\n";
    $num_files = count($trackArray);
    for ( $i = 0; $i < $num_files; $i++ ) {
    $this->QueueCommand(MPD_CMD_PLADD,$trackArray[$i]);
    $resp = $this->SendCommandQueue();
    $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->PLAddBulk() / return\n";
    return $resp;
    /* PLAdd()
    * Adds the file <file> to the end of the playlist. <file> must be a track in the MPD database.
    function PLAdd($fileName) {
    if ( $this->debugging ) echo "mpd->PLAdd()\n";
    if ( ! is_null($resp = $this->SendCommand(MPD_CMD_PLADD,$fileName))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->PLAdd() / return\n";
    return $resp;
    /* PLMoveTrack()
    * Moves track number <origPos> to position <newPos> in the playlist. This is used to reorder
    * the songs in the playlist.
    function PLMoveTrack($origPos, $newPos) {
    if ( $this->debugging ) echo "mpd->PLMoveTrack()\n";
    if ( ! is_numeric($origPos) ) {
    $this->errStr = "PLMoveTrack(): argument 1 must be numeric";
    return NULL;
    if ( $origPos < 0 or $origPos > $this->playlist_count ) {
    $this->errStr = "PLMoveTrack(): argument 1 out of range";
    return NULL;
    if ( $newPos < 0 ) $newPos = 0;
    if ( $newPos > $this->playlist_count ) $newPos = $this->playlist_count;
    if ( ! is_null($resp = $this->SendCommand(MPD_CMD_PLMOVETRACK,$origPos,$newPos))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->PLMoveTrack() / return\n";
    return $resp;
    /* PLShuffle()
    * Randomly reorders the songs in the playlist.
    function PLShuffle() {
    if ( $this->debugging ) echo "mpd->PLShuffle()\n";
    if ( ! is_null($resp = $this->SendCommand(MPD_CMD_PLSHUFFLE))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->PLShuffle() / return\n";
    return $resp;
    /* PLLoad()
    * Retrieves the playlist from <file>.m3u and loads it into the current playlist.
    function PLLoad($file) {
    if ( $this->debugging ) echo "mpd->PLLoad()\n";
    if ( ! is_null($resp = $this->SendCommand(MPD_CMD_PLLOAD,$file))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->PLLoad() / return\n";
    return $resp;
    /* PLSave()
    * Saves the playlist to <file>.m3u for later retrieval. The file is saved in the MPD playlist
    * directory.
    function PLSave($file) {
    if ( $this->debugging ) echo "mpd->PLSave()\n";
    $resp = $this->SendCommand(MPD_CMD_PLSAVE,$file);
    if ( $this->debugging ) echo "mpd->PLSave() / return\n";
    return $resp;
    /* PLClear()
    * Empties the playlist.
    function PLClear() {
    if ( $this->debugging ) echo "mpd->PLClear()\n";
    if ( ! is_null($resp = $this->SendCommand(MPD_CMD_PLCLEAR))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->PLClear() / return\n";
    return $resp;
    /* PLRemove()
    * Removes track <id> from the playlist.
    function PLRemove($id) {
    if ( $this->debugging ) echo "mpd->PLRemove()\n";
    if ( ! is_numeric($id) ) {
    $this->errStr = "PLRemove() : argument 1 must be a numeric value";
    return NULL;
    if ( ! is_null($resp = $this->SendCommand(MPD_CMD_PLREMOVE,$id))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->PLRemove() / return\n";
    return $resp;
    /* SetRepeat()
    * Enables 'loop' mode -- tells MPD continually loop the playlist. The <repVal> parameter
    * is either 1 (on) or 0 (off).
    function SetRepeat($repVal) {
    if ( $this->debugging ) echo "mpd->SetRepeat()\n";
    $rpt = $this->SendCommand(MPD_CMD_REPEAT,$repVal);
    $this->repeat = $repVal;
    if ( $this->debugging ) echo "mpd->SetRepeat() / return\n";
    return $rpt;
    /* SetRandom()
    * Enables 'randomize' mode -- tells MPD to play songs in the playlist in random order. The
    * <rndVal> parameter is either 1 (on) or 0 (off).
    function SetRandom($rndVal) {
    if ( $this->debugging ) echo "mpd->SetRandom()\n";
    $resp = $this->SendCommand(MPD_CMD_RANDOM,$rndVal);
    $this->random = $rndVal;
    if ( $this->debugging ) echo "mpd->SetRandom() / return\n";
    return $resp;
    /* Shutdown()
    * Shuts down the MPD server (aka sends the KILL command). This closes the current connection,
    * and prevents future communication with the server.
    function Shutdown() {
    if ( $this->debugging ) echo "mpd->Shutdown()\n";
    $resp = $this->SendCommand(MPD_CMD_SHUTDOWN);
    $this->connected = FALSE;
    unset($this->mpd_version);
    unset($this->errStr);
    unset($this->mpd_sock);
    if ( $this->debugging ) echo "mpd->Shutdown() / return\n";
    return $resp;
    /* DBRefresh()
    * Tells MPD to rescan the music directory for new tracks, and to refresh the Database. Tracks
    * cannot be played unless they are in the MPD database.
    function DBRefresh() {
    if ( $this->debugging ) echo "mpd->DBRefresh()\n";
    $resp = $this->SendCommand(MPD_CMD_REFRESH);
    // Update local variables
    $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->DBRefresh() / return\n";
    return $resp;
    /* Play()
    * Begins playing the songs in the MPD playlist.
    function Play() {
    if ( $this->debugging ) echo "mpd->Play()\n";
    if ( ! is_null($rpt = $this->SendCommand(MPD_CMD_PLAY) )) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->Play() / return\n";
    return $rpt;
    /* Stop()
    * Stops playing the MPD.
    function Stop() {
    if ( $this->debugging ) echo "mpd->Stop()\n";
    if ( ! is_null($rpt = $this->SendCommand(MPD_CMD_STOP) )) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->Stop() / return\n";
    return $rpt;
    /* Pause()
    * Toggles pausing on the MPD. Calling it once will pause the player, calling it again
    * will unpause.
    function Pause() {
    if ( $this->debugging ) echo "mpd->Pause()\n";
    if ( ! is_null($rpt = $this->SendCommand(MPD_CMD_PAUSE) )) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->Pause() / return\n";
    return $rpt;
    /* SeekTo()
    * Skips directly to the <idx> song in the MPD playlist.
    function SkipTo($idx) {
    if ( $this->debugging ) echo "mpd->SkipTo()\n";
    if ( ! is_numeric($idx) ) {
    $this->errStr = "SkipTo() : argument 1 must be a numeric value";
    return NULL;
    if ( ! is_null($rpt = $this->SendCommand(MPD_CMD_PLAY,$idx))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->SkipTo() / return\n";
    return $idx;
    /* SeekTo()
    * Skips directly to a given position within a track in the MPD playlist. The <pos> argument,
    * given in seconds, is the track position to locate. The <track> argument, if supplied is
    * the track number in the playlist. If <track> is not specified, the current track is assumed.
    function SeekTo($pos, $track = -1) {
    if ( $this->debugging ) echo "mpd->SeekTo()\n";
    if ( ! is_numeric($pos) ) {
    $this->errStr = "SeekTo() : argument 1 must be a numeric value";
    return NULL;
    if ( ! is_numeric($track) ) {
    $this->errStr = "SeekTo() : argument 2 must be a numeric value";
    return NULL;
    if ( $track == -1 ) {
    $track = $this->current_track_id;
    if ( ! is_null($rpt = $this->SendCommand(MPD_CMD_SEEK,$track,$pos))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->SeekTo() / return\n";
    return $pos;
    /* Next()
    * Skips to the next song in the MPD playlist. If not playing, returns an error.
    function Next() {
    if ( $this->debugging ) echo "mpd->Next()\n";
    if ( ! is_null($rpt = $this->SendCommand(MPD_CMD_NEXT))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->Next() / return\n";
    return $rpt;
    /* Previous()
    * Skips to the previous song in the MPD playlist. If not playing, returns an error.
    function Previous() {
    if ( $this->debugging ) echo "mpd->Previous()\n";
    if ( ! is_null($rpt = $this->SendCommand(MPD_CMD_PREV))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->Previous() / return\n";
    return $rpt;
    /* Search()
    * Searches the MPD database. The search <type> should be one of the following:
    * MPD_SEARCH_ARTIST, MPD_SEARCH_TITLE, MPD_SEARCH_ALBUM
    * The search <string> is a case-insensitive locator string. Anything that contains
    * <string> will be returned in the results.
    function Search($type,$string) {
    addLog("mpd->Search()");
    if ( $type != MPD_SEARCH_ARTIST and
    $type != MPD_SEARCH_ALBUM and
    $type != MPD_SEARCH_ANY and
    $type != MPD_SEARCH_TITLE ) {
    addErr( "mpd->Search(): invalid search type" );
    return NULL;
    } else {
    if ( is_null($resp = $this->SendCommand(MPD_CMD_SEARCH,$type,$string))) return NULL;
    $searchlist = $this->_parseFileListResponse($resp);
    addLog( "mpd->Search() / return ".print_r($searchlist,true) );
    return $searchlist;
    /* Find()
    * Find() looks for exact matches in the MPD database. The find <type> should be one of
    * the following:
    * MPD_SEARCH_ARTIST, MPD_SEARCH_TITLE, MPD_SEARCH_ALBUM
    * The find <string> is a case-insensitive locator string. Anything that exactly matches
    * <string> will be returned in the results.
    function Find($type,$string) {
    if ( $this->debugging ) echo "mpd->Find()\n";
    if ( $type != MPD_SEARCH_ARTIST and
    $type != MPD_SEARCH_ALBUM and
    $type != MPD_SEARCH_TITLE ) {
    $this->errStr = "mpd->Find(): invalid find type";
    return NULL;
    } else {
    if ( is_null($resp = $this->SendCommand(MPD_CMD_FIND,$type,$string))) return NULL;
    $searchlist = $this->_parseFileListResponse($resp);
    if ( $this->debugging ) echo "mpd->Find() / return ".print_r($searchlist)."\n";
    return $searchlist;
    /* Disconnect()
    * Closes the connection to the MPD server.
    function Disconnect() {
    if ( $this->debugging ) echo "mpd->Disconnect()\n";
    fclose($this->mpd_sock);
    $this->connected = FALSE;
    unset($this->mpd_version);
    unset($this->errStr);
    unset($this->mpd_sock);
    /* GetArtists()
    * Returns the list of artists in the database in an associative array.
    function GetArtists() {
    if ( $this->debugging ) echo "mpd->GetArtists()\n";
    if ( is_null($resp = $this->SendCommand(MPD_CMD_TABLE, MPD_TBL_ARTIST))) return NULL;
    $arArray = array();
    $arLine = strtok($resp,"\n");
    $arName = "";
    $arCounter = -1;
    while ( $arLine ) {
    list ( $element, $value ) = explode(": ",$arLine);
    if ( $element == "Artist" ) {
    $arCounter++;
    $arName = $value;
    $arArray[$arCounter] = $arName;
    $arLine = strtok("\n");
    if ( $this->debugging ) echo "mpd->GetArtists()\n";
    return $arArray;
    /* GetAlbums()
    * Returns the list of albums in the database in an associative array. Optional parameter
    * is an artist Name which will list all albums by a particular artist.
    function GetAlbums( $ar = NULL) {
    if ( $this->debugging ) echo "mpd->GetAlbums()\n";
    if ( is_null($resp = $this->SendCommand(MPD_CMD_TABLE, MPD_TBL_ALBUM, $ar ))) return NULL;
    $alArray = array();
    $alLine = strtok($resp,"\n");
    $alName = "";
    $alCounter = -1;
    while ( $alLine ) {
    list ( $element, $value ) = explode(": ",$alLine);
    if ( $element == "Album" ) {
    $alCounter++;
    $alName = $value;
    $alArray[$alCounter] = $alName;
    $alLine = strtok("\n");
    if ( $this->debugging ) echo "mpd->GetAlbums()\n";
    return $alArray;
    //***************************** INTERNAL FUNCTIONS ******************************//
    /* _computeVersionValue()
    * Computes a compatibility value from a version string
    private function _computeVersionValue($verStr) {
    list ($ver_maj, $ver_min, $ver_rel ) = explode(".",$verStr);
    return ( 100 * $ver_maj ) + ( 10 * $ver_min ) + ( $ver_rel );
    /* _checkCompatibility()
    * Check MPD command compatibility against our internal table. If there is no version
    * listed in the table, allow it by default.
    private function _checkCompatibility($cmd) {
    // Check minimum compatibility
    if (isset($this->COMPATIBILITY_MIN_TBL[$cmd])){
    $req_ver_low = $this->COMPATIBILITY_MIN_TBL[$cmd];
    } else {
    $req_ver_low = "0.9.1";
    // check max compatibility
    if (isset($this->COMPATIBILITY_MAX_TBL[$cmd])){
    $req_ver_hi = $this->COMPATIBILITY_MAX_TBL[$cmd];
    } else {
    $req_ver_hi = "0.20.0";
    $mpd_ver = $this->_computeVersionValue($this->mpd_version);
    if ( $req_ver_low ) {
    $req_ver = $this->_computeVersionValue($req_ver_low);
    if ( $mpd_ver < $req_ver ) {
    addErr("Command '$cmd' is not compatible with this version of MPD, version ".$req_ver_low." required");
    return FALSE;
    // Check maximum compatibility -- this will check for deprecations
    if ( $req_ver_hi ) {
    $req_ver = $this->_computeVersionValue($req_ver_hi);
    if ( $mpd_ver > $req_ver ) {
    addErr("Command '$cmd' has been deprecated in this version of MPD.");
    return FALSE;
    return TRUE;
    * checks the file entry and complete it if necesarry
    * checked fields are 'Artist', 'Genre' and 'Title'
    private function _validateFile( $fileItem ){
    $filename = $fileItem['file'];
    if (!isset($fileItem['Artist'])){ $fileItem['Artist']=null; }
    if (!isset($fileItem['Genre'])){ $fileItem['Genre']=null; }
    // special conversion for streams
    if (stripos($filename, 'http' )!==false){
    if (!isset($fileItem['Title'])) $title = ''; else $title=$fileItem['Title'];
    if (!isset($fileItem['Name'])) $name = ''; else $name=$fileItem['Name'];
    if (!isset($fileItem['Artist'])) $artist = ''; else $artist=$fileItem['Artist'];
    if (strlen($title.$name.$artist)==0){
    $fileItem['Title'] = $filename;
    } else {
    $fileItem['Title'] = 'stream://'.$title.' '.$name.' '.$artist;
    if (!isset($fileItem['Title'])){
    $file_parts = explode('/', $filename);
    $fileItem['Title'] = $filename;
    return $fileItem;
    * take the response of mpd and split it up into
    * items of types 'file', 'directory' and 'playlist'
    private function _extractItems( $resp ){
    if ( $resp == null ) {
    addLog('empty file list');
    return NULL;
    // strip unwanted chars
    $resp = trim($resp);
    // split up into lines
    $lineList = explode("\n", $resp );
    $array = array();
    $item=null;
    foreach ($lineList as $line ){
    list ( $element, $value ) = explode(": ",$line);
    // if one of the key words come up, store the item
    if (($element == "directory") or ($element=="playlist") or ($element=="file")){
    if ($item){
    $array[] = $item;
    $item = array();
    $item[$element] = $value;
    // check if there is a last item to store
    if (sizeof($item)>0){
    $array[] = $item;
    return $array;
    /* _parseFileListResponse()
    * Builds a multidimensional array with MPD response lists.
    * NOTE: This function is used internally within the class. It should not be used.
    private function _parseFileListResponse($resp) {
    $valuesArray = $this->_extractItems( $resp );
    if ($valuesArray == null ){
    return null;
    //1. create empty arrays
    $directoriesArray = array();
    $filesArray = array();
    $playlistsArray = array();
    //2. sort the items
    foreach ( $valuesArray as $item ) {
    if (isset($item['file'])){
    $filesArray[] = $this->_validateFile($item);
    } else if (isset($item['directory'])){
    $directoriesArray[] = $item['directory'];
    } else if (isset($item['playlist'])){
    $playlistsArray[] = $item['playlist'];
    } else {
    addErr('should not enter this');
    //3. create a combined list of items
    $returnArray = array(
    "directories"=>$directoriesArray,
    "playlists"=>$playlistsArray,
    "files"=>$filesArray
    addLog( print_r($valuesArray,true) );
    return $returnArray;
    /* RefreshInfo()
    * Updates all class properties with the values from the MPD server.
    * NOTE: This function is automatically called upon Connect() as of v1.1.
    function RefreshInfo() {
    // Get the Server Statistics
    $statStr = $this->SendCommand(MPD_CMD_STATISTICS);
    if ( !$statStr ) {
    return NULL;
    } else {
    $stats = array();
    $statStr=trim($statStr);
    $statLine = explode( "\n", $statStr );
    foreach ( $statLine as $line ) {
    list ( $element, $value ) = explode(": ",$line);
    $stats[$element] = $value;
    // Get the Server Status
    $statusStr = $this->SendCommand(MPD_CMD_STATUS);
    if ( ! $statusStr ) {
    return NULL;
    } else {
    $status = array();
    $statusStr=trim($statusStr);
    $statusLine = explode("\n", $statusStr );
    foreach ( $statusLine as $line ) {
    list ( $element, $value ) = explode(": ",$line);
    $status[$element] = $value;
    // Get the Playlist
    $plStr = $this->SendCommand(MPD_CMD_PLLIST);
    $array = $this->_parseFileListResponse($plStr);
    $playlist = $array['files'];
    $this->playlist_count = count($playlist);
    $this->playlist = array();
    if (sizeof($playlist)>0){
    foreach ($playlist as $item ){
    $this->playlist[$item['Pos']]=$item;
    // Set Misc Other Variables
    $this->state = $status['state'];
    if ( ($this->state == MPD_STATE_PLAYING) || ($this->state == MPD_STATE_PAUSED) ) {
    $this->current_track_id = $status['song'];
    list ($this->current_track_position, $this->current_track_length ) = explode(":",$status['time']);
    } else {
    $this->current_track_id = -1;
    $this->current_track_position = -1;
    $this->current_track_length = -1;
    $this->repeat = $status['repeat'];
    $this->random = $status['random'];
    $this->db_last_refreshed = $stats['db_update'];
    $this->volume = $status['volume'];
    $this->uptime = $stats['uptime'];
    $this->playtime = $stats['playtime'];
    $this->num_songs_played = $stats['songs'];
    $this->num_artists = $stats['artists'];
    $this->num_songs = $stats['songs'];
    $this->num_albums = $stats['albums'];
    $this->xfade = $status['xfade'];
    if(isset($status['bitrate'])) $this->bitrate = $status['bitrate'];
    else $this->bitrate = FALSE;
    return TRUE;
    /* ------------------ DEPRECATED METHODS -------------------*/
    /* GetStatistics()
    * Retrieves the 'statistics' variables from the server and tosses them into an array.
    * NOTE: This function really should not be used. Instead, use $this->[variable]. The function
    * will most likely be deprecated in future releases.
    function GetStatistics() {
    if ( $this->debugging ) echo "mpd->GetStatistics()\n";
    $stats = $this->SendCommand(MPD_CMD_STATISTICS);
    if ( !$stats ) {
    return NULL;
    } else {
    $statsArray = array();
    $statsLine = strtok($stats,"\n");
    while ( $statsLine ) {
    list ( $element, $value ) = explode(": ",$statsLine);
    $statsArray[$element] = $value;
    $statsLine = strtok("\n");
    if ( $this->debugging ) echo "mpd->GetStatistics() / return: " . print_r($statsArray) ."\n";
    return $statsArray;
    /* GetStatus()
    * Retrieves the 'status' variables from the server and tosses them into an array.
    * NOTE: This function really should not be used. Instead, use $this->[variable]. The function
    * will most likely be deprecated in future releases.
    function GetStatus() {
    if ( $this->debugging ) echo "mpd->GetStatus()\n";
    $status = $this->SendCommand(MPD_CMD_STATUS);
    if ( ! $status ) {
    return NULL;
    } else {
    $statusArray = array();
    $statusLine = strtok($status,"\n");
    while ( $statusLine ) {
    list ( $element, $value ) = explode(": ",$statusLine);
    $statusArray[$element] = $value;
    $statusLine = strtok("\n");
    if ( $this->debugging ) echo "mpd->GetStatus() / return: " . print_r($statusArray) ."\n";
    return $statusArray;
    /* GetVolume()
    * Retrieves the mixer volume from the server.
    * NOTE: This function really should not be used. Instead, use $this->volume. The function
    * will most likely be deprecated in future releases.
    function GetVolume() {
    if ( $this->debugging ) echo "mpd->GetVolume()\n";
    $volLine = $this->SendCommand(MPD_CMD_STATUS);
    if ( ! $volLine ) {
    return NULL;
    } else {
    list ($vol) = sscanf($volLine,"volume: %d");
    if ( $this->debugging ) echo "mpd->GetVolume() / return: $vol\n";
    return $vol;
    /* GetPlaylist()
    * Retrieves the playlist from the server and tosses it into a multidimensional array.
    * NOTE: This function really should not be used. Instead, use $this->playlist. The function
    * will most likely be deprecated in future releases.
    function GetPlaylist() {
    if ( $this->debugging ) echo "mpd->GetPlaylist()\n";
    $resp = $this->SendCommand(MPD_CMD_PLLIST);
    $playlist = $this->_parseFileListResponse($resp);
    if ( $this->debugging ) echo "mpd->GetPlaylist() / return ".print_r($playlist)."\n";
    return $playlist;
    /* ----------------- Command compatibility tables --------------------- */
    var $COMPATIBILITY_MIN_TBL = array(
    MPD_CMD_SEEK => "0.9.1" ,
    MPD_CMD_PLMOVE => "0.9.1" ,
    MPD_CMD_RANDOM => "0.9.1" ,
    MPD_CMD_PLSWAPTRACK => "0.9.1" ,
    MPD_CMD_PLMOVETRACK => "0.9.1" ,
    MPD_CMD_PASSWORD => "0.10.0" ,
    MPD_CMD_SETVOL => "0.10.0"
    var $COMPATIBILITY_MAX_TBL = array(
    MPD_CMD_VOLUME => "0.10.0"
    } // ---------------------------- end of class ------------------------------
    function msort($a,$b) {
    global $sort_array,$filenames_only;
    $i=0;
    $ret = 0;
    while($filenames_only!="yes" && $i<4 && $ret==0) {
    if(!isset($a[$sort_array[$i]])) {
    if(isset($b[$sort_array[$i]])) {
    $ret = -1;
    else if(!isset($b[$sort_array[$i]])) {
    $ret = 1;
    else if(strcmp($sort_array[$i],"Track")==0) {
    $ret = strnatcmp($a[$sort_array[$i]],$b[$sort_array[$i]]);
    else {
    $ret = strcasecmp($a[$sort_array[$i]],$b[$sort_array[$i]]);
    $i++;
    if($ret==0)
    $ret = strcasecmp($a["file"],$b["file"]);
    return $ret;
    function picksort($pick) {
    global $sort_array;
    if(0==strcmp($pick,$sort_array[0])) {
    return "$sort_array[0],$sort_array[1],$sort_array[2],$sort_array[3]";
    else if(0==strcmp($pick,$sort_array[1])) {
    return "$pick,$sort_array[0],$sort_array[2],$sort_array[3]";
    else if(0==strcmp($pick,$sort_array[2])) {
    return "$pick,$sort_array[0],$sort_array[1],$sort_array[3]";
    else if(0==strcmp($pick,$sort_array[3])) {
    return "$pick,$sort_array[0],$sort_array[1],$sort_array[2]";
    ?>

    BaconPie wrote:I used it to make a web based remote control for my phone. Glad it was of some help.
    regarding the phone client, ... there is one in the phpMpReloaded project called IPodMp :-)
    http://phpmpreloaded.sourceforge.net/sc … IPodMp.png
    cheers
    -tswaehn

  • PHP iTunes U authentication issue

    I’ve been working with integrating iTunes U with Moodle. On the Moodle site there is an iTunes U block available for integrating the 2 systems. I’ve been trying to use this and I am able to get to the iTunes U site from Moodle, but I am not being signed into the site as an authenticated user. I can’t seem to figure out why. I was however able to authenticate with a Perl script.
    The Moodle block has a Setting section where I fill in all my site specific information such as the Shared Secret. This is definitely working fine as I am able to get to my site without issue. But, the passing of the credentials and identity do not seem to be working because I am not being signed in as an authenticated user.
    Right now my Credentials are very basic – formatted just like the sample ones – such as:
    Adminstrator@urn:mace:itunesu.com:sites:example.edu (where example.edu is my school’s name).
    Can anyone review the files below and shed some light on why I am not getting authenticated?
    Thanks.
    Itunes_redirect.php
    <?php // $Id: itunesu_redirect.php,v 1.1 2008/06/06 19:08:49 mchurch Exp $
    require_once('../../config.php');
    global $USER, $CFG;
    require_once($CFG->dirroot.'/lib/weblib.php');
    require_once($CFG->dirroot.'/lib/moodlelib.php');
    require_once($CFG->dirroot.'/blocks/itunesu/itunes.php');
    if (!isloggedin()) {
    print_error('sessionerroruser', '' , $CFG->wwwroot);
    $destination = required_param('destination', SITEID, PARAM_INT); // iTunes U destination
    $name = fullname($USER);
    /* Create instance of the itunes class and initalized instance variables */
    $itunes = new itunes();
    $itunes->setUser($name, $USER->email, $USER->username, $USER->id);
    /* more work needs to be done with determining credentials */
    $itunes->setAdminCredential($CFG->blockitunesuadmincred);
    $itunes->setInstructorCredential($CFG->blockitunesuinsturctcred);
    $itunes->addAdminCredentials();
    $itunes->setSiteURL($CFG->blockitunesuurl);
    $itunes->setSharedSecret($CFG->blockitunesusharedsecret);
    $itunes->setDestination($destination);
    $itunes->invokeAction();
    ?>
    Itunes.php file:
    <?php
    # iTunes Authentication Class
    # Written by Aaron Axelsen - [email protected]
    # University of Wisconsin - Whitewater
    # Edited by Ryan Pharis, [email protected] - Texas Tech University
    # Class based on the Apple provided ITunesU.pl
    # example script.
    # REQUIREMENTS:
    # PHP:
    # - tested with PHP 5.2
    # - make sure hash_hmac() works - <a class="jive-link-external-small" href="http://us2.php.net/manual/en/function.hash-hmac.php">http://us2.php.net/m anual/en/function.hash-hmac.php</a>
    # - php curl support
    #Example Usage:
    <?php
    include('itunes.php');
    $itunes = new itunes();
    // show loading screen while processing request
    //include(ROOTURL.'/includes/pages/itunesload.php');
    // Set User
    $itunes->setUser("Jane Doe", "[email protected]", "jdoe", "42");
    // Set Admin Permissions
    $itunes->addAdminCredentials();
    // Set Instructor Permission
    //$itunes->addInstructorCredential('uniquename_fromitunes');
    // Set Student Credential
    //$itunes->addStudentCredential('uniquename_fromitunes');
    // Set Handle
    // This will direct login to the specific page
    #$itunes->setHandle('');
    // iTunes U Auth Debugging
    $itunes->setDebug(true);
    $itunes->invokeAction();
    ?>
    class itunes {
    // Oktech - add
    var $authtoken;
    var $siteURL;
    var $debugSuffix;
    var $sharedSecret;
    var $administratorCredential;
    var $instructorCredential;
    var $studentCredential;
    var $urlonly;
    var $urlcredentials;
    var $destination;
    // Oktech
    * Create iTunes Object
    public function __construct() {
    $this->setDebug(false);
    $this->siteURL = 'https://deimos.apple.com/WebObjects/Core.woa/Browse/example.edu';
    $this->directSiteURL = 'https://www.example.edu/cgi-bin/itunesu';
    $this->debugSuffix = '/abc1234';
    $this->sharedSecret = 'STRINGOFTHIRTYTWOLETTERSORDIGITS';
    $this->administratorCredential = 'Administrator@urn:mace:itunesu.com:sites:example.edu';
    $this->studentCredential = 'Student@urn:mace:itunesu.com:sites:example.edu';
    $this->instructorCredential = 'Instructor@urn:mace:itunesu.com:sites:example.edu';
    $this->credentials = array();
    // Set domain
    $this->setDomain();
    // Oktech add
    public function getInstructorCredential() {
    return $this->instructorCredential;
    public function setInstructorCredential($credential) {
    $this->instructorCredential = $credential;
    public function getStudentCredential() {
    return $this->studentCredential;
    public function setStudentCredential($credential) {
    $this->studentCredential = $credential;
    public function getAdminCredential() {
    return $this->administratorCredential;
    public function setAdminCredential($credential) {
    $this->administratorCredential = $credential;
    public function getSharedSecret() {
    return $this->sharedSecret;
    public function setSharedSecret($sharedsecret) {
    $this->sharedSecret = $sharedsecret;
    public function getAuthToken() {
    return $this->authtoken;
    public function setAuthToken($authtoken) {
    $this->authtoken = $authtoken;
    public function getDebugSuffix() {
    return $this->directSiteURL;
    public function setDebugSuffix($debugsuffix) {
    $this->directSiteURL = $debugsuffix;
    public function getSiteURL() {
    return $this->siteURL;
    public function setSiteURL($siteurl) {
    $this->siteURL = $siteurl;
    * Extract the URL from the return html
    * block from the iTunes U server. Replace
    * Apple's itmss tag with https
    private function extractURL($htmlblock) {
    $remainder = '';
    $pos = 0;
    $result = '';
    $remainder = strstr($htmlblock, "_open('i");
    $remainder = substr_replace($remainder, '', 0, 7);
    $remainder = substr_replace($remainder, 'https', 0, 5);
    $pos = strpos($remainder, "');");
    $result = substr_replace($remainder, '', $pos);
    $this->urlonly = $result;
    public function getExtractedURL() {
    return $this->urlonly;
    * Extract the credentials part from the returned URL from
    * the iTunes U server
    public function extractURLCredentials($url) {
    $result = '';
    $pos = 0;
    $remainder = strstr($url, "gtcc.edu?");
    $remainder = substr_replace($remainder, '', 0, 9);
    $this->urlcredentials = $remainder;
    public function getExtractedURLCredentials() {
    return $this->urlcredentials;
    public function setDestination($destination) {
    $this->destination = $destination;
    public function getDestination() {
    return $this->destination;
    // Oktech add
    * Add's admin credentials for a given user
    public function addAdminCredentials() {
    $this->addCredentials($this->administratorCredential);
    * Add Student Credential for a given course
    public function addStudentCredential($unique) {
    $this->addCredentials($this->studentCredential.":$unique");
    * Add Instructor Credential for a given course
    public function addInstructorCredential($unique) {
    $this->addCredentials($this->instructorCredential.":$unique");
    * Set User Information
    public function setUser($name, $email, $netid, $userid) {
    $this->name = $name;
    $this->email = $email;
    $this->netid = $netid;
    $this->userid = $userid;
    return true;
    * Set the Domain
    * Takes the siteURL and splits off the destination, hostname and action path.
    private function setDomain() {
    $tmpArray = split("/",$this->siteURL);
    $this->siteDomain = $tmpArray[sizeof($tmpArray)-1];
    $this->actionPath = preg_replace("/https:\/\/(.+?)\/.*/",'$1',$this->siteURL);
    $pattern = "/https:\/\/".$this->actionPath."(.*)/";
    $this->hostName = preg_replace($pattern,'$1',$this->siteURL);
    $this->destination = $this->siteDomain;
    return true;
    * Set the Handle
    * Takes the handle as input and forms the get upload url string
    * This is needed for using the API to upload files directly to iTunes U
    public function setHandle($handleIn) {
    $this->handle = $handleIn;
    $this->getUploadUrl = "http://deimos.apple.com/WebObjects/Core.woa/API/GetUploadURL/".$this->siteDoma in.'.'.$this->handle;
    return true;
    * Get Identity String
    * Combine user identity information into an appropriately formatted string.
    * take the arguments passed into the function copy them to variables
    private function getIdentityString() {
    # wrap the elements into the required delimiters.
    return sprintf('"%s" <%s> (%s) [%s]', $this->name, $this->email, $this->netid, $this->userid);
    * Add Credentials to Array
    * Allows to push multiple credientials for a user onto the array
    public function addCredentials($credentials) {
    array_push($this->credentials,$credentials);
    return true;
    * Get Credentials String
    * this is equivalent to join(';', @_); this function is present
    * for consistency with the Java example.
    * concatenates all the passed in credentials into a string
    * with a semicolon delimiting the credentials in the string.
    private function getCredentialsString() {
    #make sure that at least one credential is passed in
    if (sizeof($this->credentials) < 1)
    return false;
    return implode(";",$this->credentials);
    private function getAuthorizationToken() {
    # Create a buffer with which to generate the authorization token.
    $buffer = "";
    # create the POST Content and sign it
    $buffer .= "credentials=" . urlencode($this->getCredentialsString());
    $buffer .= "&identity=" . urlencode($this->identity);
    $buffer .= "&time=" . urlencode(mktime());
    # returns a signed message that is sent to the server
    $signature = hash_hmac('SHA256', $buffer, $this->sharedSecret);
    # append the signature to the POST content
    return sprintf("%s&signature=%s", $buffer, $signature);
    * Invoke Action
    * Send a request to iTunes U and record the response.
    * Net:HTTPS is used to get better control of the encoding of the POST data
    * as HTTP::Request::Common does not encode parentheses and Java's URLEncoder
    * does.
    public function invokeAction() {
    $this->identity = $this->getIdentityString();
    $this->token = $this->getAuthorizationToken();
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $this->generateURL() . '?' . $this->token);
    //curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    // Oktech - change
    $this->authtoken = curl_exec($ch);
    curl_close($ch);
    /* Start a new sesstion and send a request for specific content with the appropriate credentials */
    $ch = curl_init();
    $this->extractURL($this->authtoken);
    $this->extractURLCredentials($this->urlonly);
    curl_setopt($ch, CURLOPT_URL, $this->siteURL . '.' . $this->destination . '?' . $this->urlcredentials);
    //curl_setopt($ch, CURLOPT_POST, 1);
    curl_exec($ch);
    curl_close($ch);
    // Oktech
    * Auth and Upload File to iTunes U
    * This method is said to not be as heavily tested by apple, so you may have
    * unexpected results.
    * $fileIn - full system path to the file you desire to upload
    public function uploadFile($fileIn) {
    $this->identity = $this->getIdentityString();
    $this->token = $this->getAuthorizationToken();
    // Escape the filename
    $f = escapeshellcmd($fileIn);
    // Contact Apple and Get the Upload URL
    $upUrl = curl_init($this->getUploadUrl.'?'.$this->token);
    curl_setopt($upUrl, CURLOPT_RETURNTRANSFER, true);
    $uploadURL = curl_exec($upUrl);
    $error = curl_error($upUrl);
    $http_code = curl_getinfo($upUrl ,CURLINFOHTTPCODE);
    curl_close($upUrl);
    print $http_code;
    print "
    $uploadURL";
    if ($error) {
    print "
    $error";
    # Currently not working using php/curl functions. For now, we are just going to echo a system command .. see below
    #// Push out the designated file to iTunes U
    #// Build Post Fields
    #$postfields = array("file" => "@$fileIn");
    #$pushUrl = curl_init($uploadURL);
    #curl_setopt($pushUrl, CURLOPT_FAILONERROR, 1);
    #curl_setopt($pushUrl, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
    #curl_setopt($pushUrl, CURLOPT_VERBOSE, 1);
    #curl_setopt($pushUrl, CURLOPT_RETURNTRANSFER, true);
    #curl_setopt($pushUrl, CURLOPT_POST, true);
    #curl_setopt($pushUrl, CURLOPT_POSTFILEDS, $postfields);
    #$output = curl_exec($pushUrl);
    #$error = curl_error($pushUrl);
    #$http_code = curl_getinfo($pushUrl, CURLINFOHTTPCODE);
    #curl_close($pushUrl);
    #print "
    #print $http_code;
    #print "
    $output";
    #if ($error) {
    # print "
    $error";
    // Set the php time limit higher so it doesnt time out.
    settimelimit(1200);
    // System command to initiate curl and upload the file. (Temp until I figure out the php curl commands to do it)
    $command = "curl -S -F file=@$f $uploadURL";
    echo "
    echo $command;
    exec($command, $result, $error);
    if ($error) {
    echo "I'm busted";
    } else {
    print_r($result);
    echo $command;
    * Set Debugging
    * Enable/Disable debugging of iTunes U Authentication
    public function setDebug($bool) {
    if ($bool) {
    $this->debug = true;
    } else {
    $this->debug = false;
    return true;
    * Generate Site URL
    * Append debug suffix to end of url if debugging is enabled
    private function generateURL() {
    if ($this->debug) {
    return $this->siteURL.$this->debugSuffix;
    } elseif ($this->isHandleSet()) {
    return $this->directSiteURL.'.'.$this->handle;
    } else {
    return $this->siteURL;
    * Check to see if the handle is set
    private function isHandleSet() {
    if (isset($this->handle))
    return true;
    else
    return false;
    ?>

    Janet ... hmmm ... I suppose it could also be "Jane T. Smith" ... ah well, anywho,
    One thing to understand when it comes to credentialling is that, even if your transfer CGI (Moodle block) doesn't work ... if you redirect someone to your iTunes U site, that person will -always- carry two credentials ... "Unauthenticated" and "All". You do not have to assign the credentials ... they are automatic.
    Put it this way, if I direct you to my site:
    https://deimos.apple.com/WebObjects/Core.woa/Browse/uic.edu
    if you click on that link, authentication or no, Apple will give you the "Unauthenticated" and "All" credentials. Anywhere on my site where those creds are good, you'll have access.
    Hmmm ... maybe I can rephrase it this way ... there are four credentials that are a part of every site ...
    All ... everyone who accesses your site gets this cred ... everyone.
    Authenticated ... if you pass a valid iTunes U URL request for a user, he/she will get this cred.
    Unauthenticated ... this cred is given whenever someone gets to your site -without- a tokenized (credentials, identity, time, signature) URL request. For example, if someone uses your site base URL without any modification.
    Administrator ... this cred has total access to a site.
    So if you access your site using your admin cred, you'll actually carry three creds ... "Administrator" (of course), but also "All" and "Authenticated".
    So why this long discussion of creds? Well, if you're getting in with the "Unauthenticated" credential, it's a sure sign your transfer CGI (Moodle thingy) isn't working ... at all. It's not that you can't pass the admin cred ... or identity info ... you're not passing any info. And because you're not passing any info, iTunes U does the default thing ... give you "All" and "Unauthenticated" access.

  • Two remote objects calls on the same php class

    Hi to all,
           I've encountered a strange issue while developing with remote objects.
    I've a mxml component with an init() method inside which is called by a menu.
    When the init() method is called it makes 7 remote object calls which are bound to some components' dataprovider.
    Among this calls I've got 2 remote object which refer to the same remote class. This because I have to call the class twice and the bind the result to two different combobox. Below you find the code:
    <mx:RemoteObject id="myFile" source="myRemoteClass" destination="amfphp"  showBusyCursor="true" makeObjectsBindable="true" fault="traceFault(event)"/>
    <mx:RemoteObject id="myXls"  source="myRemoteClass" destination="amfphp"  showBusyCursor="true" makeObjectsBindable="true" fault="traceFault(event)"/>
    in the init function I make this calls:
    myFile.listDir("dir_1")
    myXls.listDir("dir_2")
    then in the mxml code I bound the result of myFile to combobox1 and the result of myXls on combobox2.
    The problem arise when I call the myXls' listDir method. When I call it I receive the following error:
    code:
    Client.Error.DeliveryInDoubt
    Message:
    Channel disconnected
    Detail:
    Channel disconnected before an acknowledgement was received
    The strange thing is that not only the myXls object returns this error, but also all the other 6 remote object return the same error above.
    I'm not sure, but I guess that the error could be caused by the two remote object which call the same php remote class. If I comment one of the two calls everything works fine.
    Do you have any suggestion about?
    Thanks!!
    Bye
    Luke

    Hi Jan.
    1) We have the 2 VO, each with 3 rows to fill in data. What I mean is that when i just fill in all the fields for the first row of the first VO, and the value of one of these fields is bigger than 50, then after the exception is thrown and the message is displayed, the fields for the first VO are duplicated and shown in the second VO as if the user had inserted them.
    2) We tried yesterday the validateEntity and a Method and Atributte Validator approaches after reading that white paper with the same results.
    The validation is correctly done using any of the those methods.
    I will try to reproduce this issue with the HR schema.
    Thanks in advance once again.

  • Set the value of a shared secret in a custom auth class

    Hello All,
    We are trying to use a custom authentication class to gain
    additional parameter to pass along in a SAML assertion to a third party
    vendor. We have successfully added the new custom auth class, but we
    are unable to determine how to assign the value of this new parameter to
    anything that is accessible in the creation of the SAML profile.
    The first idea was to use a shared secret. Although we have been able
    to create the shared secret, it does not have any value assigned.
    Here's the code used based on the code used by the PwLookupLogin class
    in the ba-idp-auth.jar file:
    private void setUserTAG(String paramString) {
    SSSecret localSSSecret = new SSSecret();
    localSSSecret.setName(new SSName("tag_van"));
    SSSecretEntry localSSSecretEntry = new SSSecretEntry("tag_van",
    paramString);
    localSSSecret.addSecretEntry(localSSSecretEntry);
    addCredential(WSCQSSToken.SS_SecretName, localSSSecretEntry);
    The second idea was to make use of the "CustomizableStringOne" found in
    a posting in this forum on how to extend a X.509 auth class:
    http://forums.novell.com/novell-deve....html#poststop
    The code we have tried follows:
    private void setUserSSN(String paramString) {
    // Makes use of the "Customizable String One [Custom Profile]"
    try
    // Customizable attribute 1 is the one we use to contain
    customer data to send,
    // but this can change to another if necessary
    WSCMOPToken token =
    (WSCMOPToken)WSCToken.getToken(WSCMOPToken.OP_CS_C ustomizableString1.getTokenUniqueId());
    // Build object for new data
    WSFModelEntry modelEntry = token.getModelEntry();
    IDSISCommonAttributeElement data =
    modelEntry.getSchemaClassInstance();
    if (data instanceof IDSISLeafAttributeElement) {
    ((IDSISLeafAttributeElement)data).setText(paramStr ing);
    WSCMDataToken dataToken = new WSCMDataToken(token, data);
    dataToken.setAllowOverride(true);
    catch (Exception ex) {}
    Again, the same problem. No value is found when the idpsend CGI tries
    to generate the assertion.
    We are really struggling to understand how this should work. The basic
    problem is this: How can we set a variable within a Java class that can
    be accessed by the idpsend CGI to be used as an attribute within the
    SAML assertion?
    Any ideas would be greatly appreciated. Thanks.
    keongregory
    keongregory's Profile: http://forums.novell.com/member.php?userid=40599
    View this thread: http://forums.novell.com/showthread.php?t=415440

    keongregory wrote:
    >
    > Hello All,
    > We are trying to use a custom authentication class to gain
    > additional parameter to pass along in a SAML assertion to a third
    > party vendor. We have successfully added the new custom auth class,
    > but we are unable to determine how to assign the value of this new
    > parameter to anything that is accessible in the creation of the SAML
    > profile.
    >
    > The first idea was to use a shared secret. Although we have been
    > able to create the shared secret, it does not have any value
    > assigned. Here's the code used based on the code used by the
    > PwLookupLogin class in the ba-idp-auth.jar file:
    >
    > private void setUserTAG(String paramString) {
    > SSSecret localSSSecret = new SSSecret();
    > localSSSecret.setName(new SSName("tag_van"));
    > SSSecretEntry localSSSecretEntry = new SSSecretEntry("tag_van",
    > paramString);
    > localSSSecret.addSecretEntry(localSSSecretEntry);
    > addCredential(WSCQSSToken.SS_SecretName, localSSSecretEntry);
    > }
    >
    >
    > The second idea was to make use of the "CustomizableStringOne" found
    > in a posting in this forum on how to extend a X.509 auth class:
    > http://forums.novell.com/novell-deve...ess-manager/37
    > 6654-using-x509-subject-identity-injection-post1826642.html#poststop
    >
    >
    > The code we have tried follows:
    >
    >
    > private void setUserSSN(String paramString) {
    > // Makes use of the "Customizable String One [Custom Profile]"
    > try
    > {
    > // Customizable attribute 1 is the one we use to contain
    > customer data to send,
    > // but this can change to another if necessary
    > WSCMOPToken token =
    > (WSCMOPToken)WSCToken.getToken(WSCMOPToken.OP_CS_C ustomizableString1.g
    > etTokenUniqueId());
    >
    > // Build object for new data
    > WSFModelEntry modelEntry = token.getModelEntry();
    > IDSISCommonAttributeElement data =
    > modelEntry.getSchemaClassInstance();
    > if (data instanceof IDSISLeafAttributeElement) {
    > ((IDSISLeafAttributeElement)data).setText(paramStr ing);
    > }
    >
    > WSCMDataToken dataToken = new WSCMDataToken(token, data);
    > dataToken.setAllowOverride(true);
    > }
    > catch (Exception ex) {}
    > }
    >
    >
    > Again, the same problem. No value is found when the idpsend CGI
    > tries to generate the assertion.
    >
    > We are really struggling to understand how this should work. The
    > basic problem is this: How can we set a variable within a Java class
    > that can be accessed by the idpsend CGI to be used as an attribute
    > within the SAML assertion?
    >
    > Any ideas would be greatly appreciated. Thanks.
    We are using this successfully (the code looks stragely familiar ).
    Don't try to store it in the secret store. you can actually store it in
    the customizable string attributes.
    Try to use this:
    protected int doAuthenticate()
    String attribute1 = m_Request.getParameter("attribute1");
    //Custom Attribute 1
    try
    // Customizable attribute 1 is the one we use to contain customer
    data to send,
    // but this can change to another if necessary
    WSCMOPToken token =
    (WSCMOPToken)WSCToken.getToken(WSCMOPToken.OP_CS_C ustomizableString1.get
    TokenUniqueId());
    // Build object for new data
    WSFModelEntry modelEntry = token.getModelEntry();
    IDSISCommonAttributeElement data =
    modelEntry.getSchemaClassInstance();
    if (data instanceof IDSISLeafAttributeElement)
    ((IDSISLeafAttributeElement)data).setText(attribut e1);
    WSCMDataToken dataToken = new WSCMDataToken(token, data);
    dataToken.setAllowOverride(true);
    catch (Exception ex) {}
    String url =
    m_SessionData.appendIDToUrl(NIDPContext.getNIDPCon text().getBaseUrl() +
    getProperty("Protocol") + "/idpsend?PID=" + getProperty("ITS"));
    m_Request.setAttribute("url",url);
    // Going to top ensures we are not displaying in any frames
    ((NIDPServletContext)NIDPContext.getNIDPContext()) .goJSP(m_Request,m_Res
    ponse,"top");
    return HANDLED_REQUEST;
    The above code is a non-identifying method (it doesn't return a
    'authenticated'). YOu would chain it with another method that
    identifies the user before this is being processed.
    To check if a user is authenticated or not you could use:
    if (!m_Session.isAuthenticated())
    return NOT_AUTHENTICATED;
    Once the method is processed it should have created a
    LibertyUserProfile object within the eDir that comes with the admin
    console.
    You can find these in
    ou=libertyUserProfile0,ou=<clusterobject>,ou=clust er,ou=nids,ou=accessMa
    nagerContainer,o=novell
    Hopefully this helps.
    Cheers,
    Edward

  • Custom Authorization Class to set Credentials

    I am basing this off of the 'Access Management Authentication Class
    Extension to Retrieve Password for Single Sign-on | Novell User
    Communities'
    (http://www.novell.com/communities/no...rd-single-sign)
    coolsolution. I have tried the exact class from this coolsolution, and
    I have also tried decompiling the code and making numerous changes to it
    for validation. I have not been able to verify that this coolsolution
    works in 3.1.
    We have two methods on a contract. The first method uses the Kerberos
    class. The second was custom developed, who's purpose is to find the ID
    of the logged in user (the NIDPPrincipal), grab the password from
    Universal Password (using NMAS tools), and set it in the AM credential
    profile for use in policies.
    The status is that Kerberos authenticates successfully, the second
    class runs, successfully grabs the Universal Password, and runs the
    following commands:
    SSSecret localSSSecret = new SSSecret();
    localSSSecret.setName(new SSName("LDAPCredentials"));
    SSSecretEntry localSSSecretEntry = new
    SSSecretEntry("UserPassword", paramString);
    localSSSecret.addSecretEntry(localSSSecretEntry);
    addCredential(WSCQSSToken.SS_SecretEntry_LDAPCrede ntials_UserPassword,
    localSSSecretEntry);
    Where "paramString" is the Universal Password. I have printed this
    password to the log to verify it is the correct Universal Password for
    the user.
    If I do a getCredentials() prior to running the addCredential method, I
    get 0 back. If I run it after, I get 1. This seems OK, however I would
    expect that my username and DN should already be in the credential
    profile, and that I should initially be getting 2 credentials back, not
    0.
    Here is a section of the IDP log that I see directly after the second,
    custom, Authentication class runs. I copied it twice, once in the
    scenario when the custom authentication class follows a Kerberos class
    (so no password provided by the user), and the second when followed by a
    Form-based authentication (password provided by the user). In the first
    case, notice there is no "WSCCacheEntry Found!" entry in the log after
    the final lookup of UserPassword, but it does appear in the Form
    example.
    I have tried doing an addCredentials() in the custom auth class, and
    this adds two more entries into the credential profile (when I run the
    getCredentials() function). However, still the password credential is
    not available after the class is done.
    Set: AuthenticationCredentials, Allowed override: false
    </amLogEntry>
    <amLogEntry> 2009-04-24T16:29:37Z NIDS Trace: Method:
    WSCCachePushedCacheSet.find()
    Thread: http-80-Processor21
    (1 of 6):
    Looking for WSCCacheEntry in WSCCachePushedCacheSet! Target token
    uniqueId:
    NEPXurn~3Anovell~3Acredentialprofile~3A2005-03~2Fcp~3ASecrets~2Fcp~3ASecret~40~40~40~40WSCQSST oken~40~40~40~40~2Fcp~3ASecrets~2Fcp~3ASecret~5Bcp ~3AName~3D~22LDAPCredentials~22~5D,
    set: AuthenticationCredentials
    (2 of 6):
    Looking for WSCCacheEntry in WSCCachePushedCacheSet! Target token
    uniqueId:
    NEPXurn~3Anovell~3Acredentialprofile~3A2005-03~2Fcp~3ASecrets~2Fcp~3ASecret~2Fcp~3AEntry~40~40 ~40~40WSCQSSToken~40~40~40~40~2Fcp~3ASecrets~2Fcp~ 3ASecret~5Bcp~3AName~3D~22LDAPCredentials~22~5D~2F cp~3AEntry~5Bcp~3AName~3D~22UserName~22~5D,
    set: AuthenticationCredentials
    (3 of 6):
    WSCCacheEntry Found!
    (4 of 6):
    Looking for WSCCacheEntry in WSCCachePushedCacheSet! Target token
    uniqueId:
    NEPXurn~3Anovell~3Acredentialprofile~3A2005-03~2Fcp~3ASecrets~2Fcp~3ASecret~2Fcp~3AEntry~40~40 ~40~40WSCQSSToken~40~40~40~40~2Fcp~3ASecrets~2Fcp~ 3ASecret~5Bcp~3AName~3D~22LDAPCredentials~22~5D~2F cp~3AEntry~5Bcp~3AName~3D~22UserDN~22~5D,
    set: AuthenticationCredentials
    (5 of 6):
    WSCCacheEntry Found!
    (6 of 6):
    Looking for WSCCacheEntry in WSCCachePushedCacheSet! Target token
    uniqueId:
    NEPXurn~3Anovell~3Acredentialprofile~3A2005-03~2Fcp~3ASecrets~2Fcp~3ASecret~2Fcp~3AEntry~40~40 ~40~40WSCQSSToken~40~40~40~40~2Fcp~3ASecrets~2Fcp~ 3ASecret~5Bcp~3AName~3D~22LDAPCredentials~22~5D~2F cp~3AEntry~5Bcp~3AName~3D~22UserPassword~22~5D,
    set: AuthenticationCredentials
    </amLogEntry>
    When doing in the form auth, I see the following:
    Set: AuthenticationCredentials, Allowed override: false
    </amLogEntry>
    <amLogEntry> 2009-04-24T16:48:32Z NIDS Trace: Method:
    WSCCachePushedCacheSet.find()
    Thread: http-80-Processor25
    (1 of 7):
    Looking for WSCCacheEntry in WSCCachePushedCacheSet! Target token
    uniqueId:
    NEPXurn~3Anovell~3Acredentialprofile~3A2005-03~2Fcp~3ASecrets~2Fcp~3ASecret~40~40~40~40WSCQSST oken~40~40~40~40~2Fcp~3ASecrets~2Fcp~3ASecret~5Bcp ~3AName~3D~22LDAPCredentials~22~5D,
    set: AuthenticationCredentials
    (2 of 7):
    Looking for WSCCacheEntry in WSCCachePushedCacheSet! Target token
    uniqueId:
    NEPXurn~3Anovell~3Acredentialprofile~3A2005-03~2Fcp~3ASecrets~2Fcp~3ASecret~2Fcp~3AEntry~40~40 ~40~40WSCQSSToken~40~40~40~40~2Fcp~3ASecrets~2Fcp~ 3ASecret~5Bcp~3AName~3D~22LDAPCredentials~22~5D~2F cp~3AEntry~5Bcp~3AName~3D~22UserName~22~5D,
    set: AuthenticationCredentials
    (3 of 7):
    WSCCacheEntry Found!
    (4 of 7):
    Looking for WSCCacheEntry in WSCCachePushedCacheSet! Target token
    uniqueId:
    NEPXurn~3Anovell~3Acredentialprofile~3A2005-03~2Fcp~3ASecrets~2Fcp~3ASecret~2Fcp~3AEntry~40~40 ~40~40WSCQSSToken~40~40~40~40~2Fcp~3ASecrets~2Fcp~ 3ASecret~5Bcp~3AName~3D~22LDAPCredentials~22~5D~2F cp~3AEntry~5Bcp~3AName~3D~22UserDN~22~5D,
    set: AuthenticationCredentials
    (5 of 7):
    WSCCacheEntry Found!
    (6 of 7):
    Looking for WSCCacheEntry in WSCCachePushedCacheSet! Target token
    uniqueId:
    NEPXurn~3Anovell~3Acredentialprofile~3A2005-03~2Fcp~3ASecrets~2Fcp~3ASecret~2Fcp~3AEntry~40~40 ~40~40WSCQSSToken~40~40~40~40~2Fcp~3ASecrets~2Fcp~ 3ASecret~5Bcp~3AName~3D~22LDAPCredentials~22~5D~2F cp~3AEntry~5Bcp~3AName~3D~22UserPassword~22~5D,
    set: AuthenticationCredentials
    (7 of 7):
    WSCCacheEntry Found!
    </amLogEntry>
    So, somehow it doesn't seem to set the value in the credential cache,
    or whatever that thing is. And since it's not there, it doesn't add it
    to the credential set.
    Any thoughts on whether should be doing what I want it to? This whole
    scenario can be tested by installing the coolsolution package and adding
    it after a Kerberos class.
    Thanks to anyone who can support me on this.
    jessesmith
    jessesmith's Profile: http://forums.novell.com/member.php?userid=10189
    View this thread: http://forums.novell.com/showthread.php?t=371692

    jessesmith;1786627 Wrote:
    > I am basing this off of the 'Access Management Authentication Class
    > Extension to Retrieve Password for Single Sign-on | Novell User
    > Communities'
    > (http://www.novell.com/communities/no...rd-single-sign)
    > coolsolution. I have tried the exact class from this coolsolution, and
    > I have also tried decompiling the code and making numerous changes to it
    > for validation. I have not been able to verify that this coolsolution
    > works in 3.1.
    >
    > We have two methods on a contract. The first method uses the Kerberos
    > class. The second was custom developed, who's purpose is to find the ID
    > of the logged in user (the NIDPPrincipal), grab the password from
    > Universal Password (using NMAS tools), and set it in the AM credential
    > profile for use in policies.
    >
    > The status is that Kerberos authenticates successfully, the second
    > class runs, successfully grabs the Universal Password, and runs the
    > following commands:
    >
    > SSSecret localSSSecret = new SSSecret();
    > localSSSecret.setName(new SSName("LDAPCredentials"));
    > SSSecretEntry localSSSecretEntry = new
    > SSSecretEntry("UserPassword", paramString);
    > localSSSecret.addSecretEntry(localSSSecretEntry);
    >
    > addCredential(WSCQSSToken.SS_SecretEntry_LDAPCrede ntials_UserPassword,
    > localSSSecretEntry);
    >
    > Where "paramString" is the Universal Password. I have printed this
    > password to the log to verify it is the correct Universal Password for
    > the user.
    >
    > If I do a getCredentials() prior to running the addCredential method, I
    > get 0 back. If I run it after, I get 1. This seems OK, however I would
    > expect that my username and DN should already be in the credential
    > profile, and that I should initially be getting 2 credentials back, not
    > 0.
    >
    > Here is a section of the IDP log that I see directly after the second,
    > custom, Authentication class runs. I copied it twice, once in the
    > scenario when the custom authentication class follows a Kerberos class
    > (so no password provided by the user), and the second when followed by a
    > Form-based authentication (password provided by the user). In the first
    > case, notice there is no "WSCCacheEntry Found!" entry in the log after
    > the final lookup of UserPassword, but it does appear in the Form
    > example.
    >
    > I have tried doing an addCredentials() in the custom auth class, and
    > this adds two more entries into the credential profile (when I run the
    > getCredentials() function). However, still the password credential is
    > not available after the class is done.
    >
    > Set: AuthenticationCredentials, Allowed override: false
    > </amLogEntry>
    > <amLogEntry> 2009-04-24T16:29:37Z NIDS Trace: Method:
    > WSCCachePushedCacheSet.find()
    > Thread: http-80-Processor21
    > (1 of 6):
    > Looking for WSCCacheEntry in WSCCachePushedCacheSet! Target token
    > uniqueId:
    > NEPXurn~3Anovell~3Acredentialprofile~3A2005-03~2Fcp~3ASecrets~2Fcp~3ASecret~40~40~40~40WSCQSST oken~40~40~40~40~2Fcp~3ASecrets~2Fcp~3ASecret~5Bcp ~3AName~3D~22LDAPCredentials~22~5D,
    > set: AuthenticationCredentials
    > (2 of 6):
    > Looking for WSCCacheEntry in WSCCachePushedCacheSet! Target token
    > uniqueId:
    > NEPXurn~3Anovell~3Acredentialprofile~3A2005-03~2Fcp~3ASecrets~2Fcp~3ASecret~2Fcp~3AEntry~40~40 ~40~40WSCQSSToken~40~40~40~40~2Fcp~3ASecrets~2Fcp~ 3ASecret~5Bcp~3AName~3D~22LDAPCredentials~22~5D~2F cp~3AEntry~5Bcp~3AName~3D~22UserName~22~5D,
    > set: AuthenticationCredentials
    > (3 of 6):
    > WSCCacheEntry Found!
    > (4 of 6):
    > Looking for WSCCacheEntry in WSCCachePushedCacheSet! Target token
    > uniqueId:
    > NEPXurn~3Anovell~3Acredentialprofile~3A2005-03~2Fcp~3ASecrets~2Fcp~3ASecret~2Fcp~3AEntry~40~40 ~40~40WSCQSSToken~40~40~40~40~2Fcp~3ASecrets~2Fcp~ 3ASecret~5Bcp~3AName~3D~22LDAPCredentials~22~5D~2F cp~3AEntry~5Bcp~3AName~3D~22UserDN~22~5D,
    > set: AuthenticationCredentials
    > (5 of 6):
    > WSCCacheEntry Found!
    > (6 of 6):
    > Looking for WSCCacheEntry in WSCCachePushedCacheSet! Target token
    > uniqueId:
    > NEPXurn~3Anovell~3Acredentialprofile~3A2005-03~2Fcp~3ASecrets~2Fcp~3ASecret~2Fcp~3AEntry~40~40 ~40~40WSCQSSToken~40~40~40~40~2Fcp~3ASecrets~2Fcp~ 3ASecret~5Bcp~3AName~3D~22LDAPCredentials~22~5D~2F cp~3AEntry~5Bcp~3AName~3D~22UserPassword~22~5D,
    > set: AuthenticationCredentials
    > </amLogEntry>
    >
    >
    >
    >
    > When doing in the form auth, I see the following:
    >
    > Set: AuthenticationCredentials, Allowed override: false
    > </amLogEntry>
    > <amLogEntry> 2009-04-24T16:48:32Z NIDS Trace: Method:
    > WSCCachePushedCacheSet.find()
    > Thread: http-80-Processor25
    > (1 of 7):
    > Looking for WSCCacheEntry in WSCCachePushedCacheSet! Target token
    > uniqueId:
    > NEPXurn~3Anovell~3Acredentialprofile~3A2005-03~2Fcp~3ASecrets~2Fcp~3ASecret~40~40~40~40WSCQSST oken~40~40~40~40~2Fcp~3ASecrets~2Fcp~3ASecret~5Bcp ~3AName~3D~22LDAPCredentials~22~5D,
    > set: AuthenticationCredentials
    > (2 of 7):
    > Looking for WSCCacheEntry in WSCCachePushedCacheSet! Target token
    > uniqueId:
    > NEPXurn~3Anovell~3Acredentialprofile~3A2005-03~2Fcp~3ASecrets~2Fcp~3ASecret~2Fcp~3AEntry~40~40 ~40~40WSCQSSToken~40~40~40~40~2Fcp~3ASecrets~2Fcp~ 3ASecret~5Bcp~3AName~3D~22LDAPCredentials~22~5D~2F cp~3AEntry~5Bcp~3AName~3D~22UserName~22~5D,
    > set: AuthenticationCredentials
    > (3 of 7):
    > WSCCacheEntry Found!
    > (4 of 7):
    > Looking for WSCCacheEntry in WSCCachePushedCacheSet! Target token
    > uniqueId:
    > NEPXurn~3Anovell~3Acredentialprofile~3A2005-03~2Fcp~3ASecrets~2Fcp~3ASecret~2Fcp~3AEntry~40~40 ~40~40WSCQSSToken~40~40~40~40~2Fcp~3ASecrets~2Fcp~ 3ASecret~5Bcp~3AName~3D~22LDAPCredentials~22~5D~2F cp~3AEntry~5Bcp~3AName~3D~22UserDN~22~5D,
    > set: AuthenticationCredentials
    > (5 of 7):
    > WSCCacheEntry Found!
    > (6 of 7):
    > Looking for WSCCacheEntry in WSCCachePushedCacheSet! Target token
    > uniqueId:
    > NEPXurn~3Anovell~3Acredentialprofile~3A2005-03~2Fcp~3ASecrets~2Fcp~3ASecret~2Fcp~3AEntry~40~40 ~40~40WSCQSSToken~40~40~40~40~2Fcp~3ASecrets~2Fcp~ 3ASecret~5Bcp~3AName~3D~22LDAPCredentials~22~5D~2F cp~3AEntry~5Bcp~3AName~3D~22UserPassword~22~5D,
    > set: AuthenticationCredentials
    > (7 of 7):
    > WSCCacheEntry Found!
    > </amLogEntry>
    >
    >
    >
    >
    > So, somehow it doesn't seem to set the value in the credential cache,
    > or whatever that thing is. And since it's not there, it doesn't add it
    > to the credential set.
    >
    > Any thoughts on whether should be doing what I want it to? This whole
    > scenario can be tested by installing the coolsolution package and adding
    > it after a Kerberos class.
    >
    > Thanks to anyone who can support me on this.
    just updating this one with the solution ... just needed to go to the
    method used and disable the 'identify user' option.
    Here's the online help regarding this option:
    Identifies User: Specifies whether this authentication method should be
    used to identify the user. Usually, you should enable this option. When
    configuring multiple methods for a contract, you might need to disable
    this option for some methods.
    If you enable this option on two or more methods in a contract, these
    methods need to identify the same user in the same user store.
    If you enable this option on just one method in the contract, that
    method identifies the user when the authentication method succeeds. The
    other methods in the contract must succeed, but might not authenticated
    the user. For example, the method that identifies the user could require
    a name and a password for authentication, and the other method in the
    contract could prompt for a certificate that identifies the users
    computer.
    ncashell
    ncashell's Profile: http://forums.novell.com/member.php?userid=7281
    View this thread: http://forums.novell.com/showthread.php?t=371692

  • Userid prefix when connected to LCCS via PHP

    I'm using the PHP service class packaged in the SDK and each user connects to the LCCS with the getAuthenticationToken function.
    But when I get updates within a running flash app from the UserManager, the userid got a prefix of "EXT-{lccs account name}-{userid}" where
    I expect it only to be "{userid}".
    How can I fix that? Or is it just the way LCCS handles authentications through PHP?
    Thanks in advance,
    Florus

    this is how external user ids are generated on our server. In order to have globally unique identifier the format is :
         EXT-<youraccountname>-<youruserid>
    With the latest SDK I have added a Session.getUserID method that given your id returns the service id, so that you don't have to know the magic.

  • I need help getting my local testing server to work - PHP/MySQL

    Hello,
    I am using DW CS5 and have installed XAMPP for my Server/PHP/DB package (which is the same as my live site).
    I have gone thru every tuitorial and all information on this subject, and unfortunately I can't get the server set up correct. Other than my page not showing in a browser (or live view) when I try to view it, DW just says: "Dynamically-related files could not be resolved because the site definition is not correct for this server" when I have index.php open and try to find the files.
    One major question is I am unsure of what folder to have as the root folder of the site, which has a public_htlm directory and www directory - or do I just use the main folder they are both located in as the root folder?
    (Not to get too deep with this first question, but I also looked at the error log file in Apache c:\xampp\apache\logs\error.log and it is not finding the following:
    [Tue Oct 09 14:26:38.573504 2012] [:error] [pid 3100:tid 1488] [client ::1:56261] script 'C:/xampp/htdocs/BusinessTube/index_e5pebna8e.php' not found or unable to stat]
    I'm guessing that the file "index_e5pebna8e.php" is a cached version of the file generated by index.php - but I'm unsure why it is not being 'found'.)
    Second question is about having to set the php.ini file to listen to port 88 as this computer also has IIS installed. I have done this, and it works with a local project directly from NetBeans (which I have to use for a PHP development class). How will this change my DW site definitions? I'm assuming that anywhere I would have localhost I will now need to have localhost:88 but once again I'm not sure.
    I am eager to get this site working locally so I can start using the new PHP skills I'm learning - any help will be GREATLY appreciated.
    Kirk

    You're getting mixed up over the meaning of public_html.
    Most hosting companies that offer PHP use the Apache web server, which has a single server root folder called htdocs. XAMPP also uses Apache, so c:/xampp/htdocs is the XAMPP server root, and its URL is http://localhost/.
    Although Apache has only one server root, virtual hosts make it possible to run multiple websites on the same server. Each virtual host is located in a separate folder that acts as the site root. It's common for this folder to be called public_html. What bregent was describing was the location of the site root on your remote server. The name of the site root in your local testing setup can be whatever you decide to call it.
    When learning to use PHP, most people use a subfolder of the Apache server root because it doesn't require further configuration. However, once you're working with real sites, it's normal to set up a virtual host for each one. I create all my virtual hosts in a folder called C:/vhosts. So for example, I might have one in C:/vhosts/site1. In the virtual hosts configuration file, I designate C:/vhosts/site1 as the root folder for a virtual host called site1, which can then be accessed as http://site1/.
    The only reason I might have a folder called public_html is if I designated C:/vhosts/site1/public_html as the site root.
    I hope that's clear. Once you understand the principle of virtual hosts, the concept of the site (or server) root becomes obvious, but it can be difficult to explain. I remember it took me a while before the concept sank in.

Maybe you are looking for

  • Offline approval workflow not working - SRM 5.0

    Hi Team, Suddenly we have an issue in SRM production server with Offline approval workflow, inbound mails are not getting processed in SOIN and workitems are not getting cleared. So document status is not getting changed. There is no problem in recei

  • Issue with Local Member

    Hi BPC Experts, We have migrated our environment from BPC 7.5 to BPC 10. We have also migrated our reports from EVDRE to EPM. Now we have few reports where local members are used. The report is buil up like this - Entity in columns and account in row

  • ILOM on X4x00 - temperature monitoring snmp, automatic shutdown

    Hello, we run some X4100/X4200 servers. I want to monitor temperatures via ILOM's snmp interface. Unfortunately I get all kind of information with snmpwalk like sensor typ, hysteresis, unit, .... except the current sensor readings. Did anybody succee

  • Process Flow Deployment using Oracle workflow

    Hi, If I have my own Process Flow in XPDL, can I deploy it to the Oracle workflow? I couldn't find any doc regarding how Oracle workflow (standalone) imports XPDL file. Is the Oracle workflow packaged with the OWB comes with some adapter that underst

  • In Page 4.3 and 5 the "Insert Date

    In Page 4.3 and 5 the "Insert Date & Time" responds with 20December 2013; notice the lack of space between day and month. This makes me believe that the user gets to format the Date & Time, and that I did just that many years ago. Please guide me to