PHP Child Account Manager Release

Last post 01-24-2008 3:23 PM by BarryR. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 11-03-2007 3:42 AM

    • BarryR
    • Top 10 Contributor
    • Joined on 07-20-2007
    • San Diego
    • Posts 576

    PHP Child Account Manager Release

    The child account manager written for PHP is now available for download.  This application shows the PHP code necessary to interact with the Authentication and Accounting namespaces.  This application lets you create, delete, and modify child accounts.  The account listing shows the child accounts, the storage usage, and any contact/limits that are on that account.  You can change the contact information and limits for the selected account.

    Let me know if there are any issues with the first release of this application here in the forums.

    The file can be downloaded here:

    http://developer.nirvanix.com/files/folders/php/entry268.aspx
     

    Regards,
        Barry R.
     

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
    Filed under: , ,
  • 11-03-2007 7:11 AM In reply to

    • aagee
    • Top 50 Contributor
    • Joined on 10-11-2007
    • Posts 7

    Re: PHP Child Account Manager Release

    Great to see this in PHP. Thanks.
    Filed under: , ,
  • 11-05-2007 2:33 PM In reply to

    • aagee
    • Top 50 Contributor
    • Joined on 10-11-2007
    • Posts 7

    Re: PHP Child Account Manager Release

    Hi I am in the process of testing the PHP child manager and I am able to login using my application key, username and password. I also seem to be able to create a child account, however, when the app returns to browse.php the page is blank. I am also unable to see the newly created child account listed inside my Nirvanix Management Portal. Am I missing the point here? Thanks. A
  • 11-05-2007 5:08 PM In reply to

    • BarryR
    • Top 10 Contributor
    • Joined on 07-20-2007
    • San Diego
    • Posts 576

    Re: PHP Child Account Manager Release

    If you look in the HTML it writes the results of the web service calls in an html comment.  Check to see if there are any errors and let me know.

    Regards,
        Barry R.

     

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
  • 12-03-2007 5:42 PM In reply to

    Re: PHP Child Account Manager Release

     Hi. I just downloaded the child manager php script. And i am having some trouble with it.

     I try to log into the my account to create a new child account. And i get the following errors.

    Fatal error: Call to undefined function curl_init() in /var/www/testaws/child/NirvanixAPI/RestUtils.php on line 27

     

     I really appreciate if some one could help me out .

    Thanks 

  • 12-03-2007 8:00 PM In reply to

    • bej34
    • Top 10 Contributor
    • Joined on 11-12-2007
    • Posts 44

    Re: PHP Child Account Manager Release

    Check to see if you have CURL enabled in your PHP settings. 

    http://www.brianjinwright.com
    Filed under:
  • 12-06-2007 3:55 AM In reply to

    Re: PHP Child Account Manager Release

    I followed the  child account manager sample. I got the script working fine. It was some trouble with CURL being not enabled for php5. Anyways the problem that i am facing is that when i use that sample it asks me to enter in the information for the new child account. Yet when i click the create account it just refreshes to the first page. I check my NMP and it does not show any child account for my application.

     

    Could some one tell me whats wrong. I dont know why its not creating the child account.


    Regards

    Hareem. Haque
     

  • 12-06-2007 4:06 PM In reply to

    • aagee
    • Top 50 Contributor
    • Joined on 10-11-2007
    • Posts 7

    Re: PHP Child Account Manager Release

    Hareem, I have had the same problem with the PHP Child Account Manager. I am also looking for answers on this because it is preventing me from using the system. I will continue to monitor this thread. A.
  • 12-07-2007 6:55 PM In reply to

    • BarryR
    • Top 10 Contributor
    • Joined on 07-20-2007
    • San Diego
    • Posts 576

    Re: PHP Child Account Manager Release

     I will go through the steps that are the usual output so I can get a better understanding of what area is failing.

    The Create Account link on the main page (browse.php) should send you to the CreateAccount.php page.

    After filling in a minimum of Username and password (required fields) then clicking on the "Create Account" button below should submit the form to the saveaccount.php with the parameter operation=create.

    In the saveaccount.php page you should see a success or failure result.  If you look in the comments of the output html debugging information is written to the page that looks like:

    <!--CreateChildAccount: <?xml version="1.0" encoding="utf-8"?>
    <Response>
    <ResponseCode>0</ResponseCode>
    </Response>-->
    <div class="container">
    <h4>The create operation completed successfully.</h4>
    <a href="browse.php?account=testuser2" class="link">Return</a>
            </div>
    <!--Logout: <?xml version="1.0" encoding="utf-8"?>
    <Response>
    <ResponseCode>0</ResponseCode>
    </Response>-->

     


    If there is an error condition the result should display an error message.

    Let me know where in these steps you are failing and what response is coming from the web services.

    I want to stress that the reference applications, while full applications, are designed to teach you how to use the web services.  The goal is to provide a simple example of each area of our namespaces so error handling and exception cases are not all covered to reduce the complexity of the presentation layer of the applications.  Please let me know if you are having any issues integrating with the web services directly with PHP or are having any secondary issues.

    Regards,
        Barry R.
     

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
  • 01-23-2008 10:48 AM In reply to

    • mmania
    • Top 10 Contributor
    • Joined on 01-20-2008
    • Netherlands
    • Posts 91

    Re: PHP Child Account Manager Release

     

     Barry,

     there are some basic errors in the script, it doesn't create any child account as the saveaccount.php file is incorrect

    all variable definitions are incorrect as they come from GET and POST operations, but in the script they are simply defined as $variable instead of something like $_REQUEST/POST/GET['variable']

    I changed saveaccount.php from:

       elseif ($operation == "create")
        {
            // The CreateAccount page is asking us to create a new account under this master/AppKey
            $xml = $accounting->CreateChildAccount($sessionToken, $account, $password, $firstname,
                $lastname, $middleinitial, $phonenumber, $emailaddress, $emailformat,
                $addressline1, $addressline2, $city, $state, $countryID, $postalcode);
        }  

    to
         elseif ($_REQUEST['operation'] == "create")
        {
            // The CreateAccount page is asking us to create a new account under this master/AppKey
            $xml = $accounting->CreateChildAccount($sessionToken, $_REQUEST['account'], $_REQUEST['password'], $firstname,
                $lastname, $middleinitial, $phonenumber, $emailaddress, $emailformat,
                $addressline1, $addressline2, $city, $state, $countryID, $postalcode);
        }

    and the account gets created and displays correctly in the NMP control panel. Btw, the above is only a partial modification, actually all variables need to be corrected. Deleting the account doesn't work either (same variable issue) see below for the correct version (teste and it works)

     if you find any errors let me know...

     
    hope it helps
     

    ciao

     
    Luca

     

     <?php
    /****
    Author:  Nirvanix
    Date:    10-20-2007
    Website: http://developer.nirvanix.com/
    License: See http://developer.nirvanix.com/content/license.aspx
            Limited Permissive License
            This license governs use of the accompanying software. If you use the software,
            you accept this license. If you do not accept the license, do not use or distribute
            the software.
    ****/

        // start the session for userData.
        session_start();    
        
        $pagetitle = "Delete Account";
        
        require_once "header.php";
        require_once "NirvanixAPI/Accounting.php";
        require_once "NirvanixAPI/Authentication.php";
        
        // Create an Accounting object.
        $accounting = new Accounting();
        
        // Get a sessionToken
        $auth = new Authentication();
        $stxml = $auth->Login($_SESSION['userData']['username'], $_SESSION['userData']['password'],
            $_SESSION['userData']['appKey']);

        $sessionToken = $stxml[0]["children"][1]["tagData"];
            
        // Check to see if the user has confirmed the operation.
        if (isset($_REQUEST['confirmed']))
        {
            // call to delete the account.
            // THIS WILL DELETE ALL FILES UNDER THE CHILD ACCOUNT.
            $accounting->DeleteChildAccount($sessionToken, $_REQUEST['account']);
            ?>        
            <div class="container">
            <h4><?php echo htmlspecialchars($_REQUEST['account']); ?> was deleted successfully.</h4>
            <a href="browse.php">Return</a>
            </div>
            
            
            <?php
        }
        else
        {
    ?>
            <div class="container">
            <h4>Are you sure you wish to delete the account: <?php echo htmlspecialchars($_REQUEST['account']); ?></h4><font size="-1">*All Files will be removed as well.</font><br />&nbsp;
            <form ENCTYPE="multipart/form-data" action="deleteaccount.php" method="post">
                <input type="hidden" name="account" value="<?php echo $_REQUEST['account'] ?>">
                <input type="hidden" name="confirmed" value="true">            
                <input type="submit" value="Delete Child Account"/>
                <input type="Button" value="Cancel" onClick="BLOCKED SCRIPT location.href='browse.php?account=<?php echo $_REQUEST['account']; ?>'; return true;">
            </form>
            </div>
    <?php
        }
        // Cleanup session
        $auth->Logout($sessionToken);
        
        require_once "footer.php";
    ?>

     

  • 01-24-2008 3:23 PM In reply to

    • BarryR
    • Top 10 Contributor
    • Joined on 07-20-2007
    • San Diego
    • Posts 576

    Re: PHP Child Account Manager Release

     This is excellent.  I had gotten requests on some systems of the child account manager was having some problems and clearly this was the issue.  I will update the code with your changes at my first opportunity and get a new release out.

    Thank you,
        Barry R.
     

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
Page 1 of 1 (11 items)