Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2008
    Location
    Victoria AU
    Posts
    48
    Plugin Contributions
    0

    Default Integrating with zencart from VB Script

    I would like to do some integration with Zen Cart from VB Script in order to do some automation work. For example automatically generating notifications to various groups when new orders are detected in the 'Orders' page in admin. Typically this can be achieved with code similar to below, but this just returns the log in page. Any help greatly appreciated.

    Code:
    Set xml = CreateObject("Microsoft.XMLHTTP")
    shop_url = "http://www.mydomain.com/shop/admin/orders.php"
    
    Set fs = CreateObject ("Scripting.FileSystemObject")
    xml.Open "POST", shop_url , False, "admin", "password"
    xml.Send
    
    MsgBox(xml.responseText)

  2. #2
    Join Date
    Apr 2004
    Location
    vienna
    Posts
    198
    Plugin Contributions
    9

    Default Re: Integrating with zencart from VB Script

    look at : 4guysfromrolla.com/webtech/110100-1.2.shtml

    your code only handles auth-access
    if you wish to post zencart-credit you can use
    PHP Code:
        Dim xml
        Set xml 
    CreateObject("Microsoft.XMLHTTP")
        
    shop_url "http://192.168.0.92/zc138/admin/orders.php"
        
    xml.Open "POST"shop_urlFalse
        xml
    .setRequestHeader "Content-Type""application/x-www-form-urlencoded"
        
    xml.Send "submit=1&admin_name=USER&admin_pass=PASSWD"
        
    MsgBox (xml.responseText)
        
    Set xml Nothing 
    but you must also change the init_admin_auth.php to bypass the redirect

    I think a better way to notify for new orders is the use of the nice zencart-notifiers; for example: NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL
    look at: http://www.zen-cart.com/wiki/index.p...er_is_watching

  3. #3
    Join Date
    Mar 2008
    Location
    Victoria AU
    Posts
    48
    Plugin Contributions
    0

    Default Re: Integrating with zencart from VB Script

    Quote Originally Posted by hugo13 View Post
    but you must also change the init_admin_auth.php to bypass the redirect
    How do I go about bypassing the redirect?

  4. #4
    Join Date
    Apr 2004
    Location
    vienna
    Posts
    198
    Plugin Contributions
    9

    Default Re: Integrating with zencart from VB Script

    PHP Code:
    if (!(basename($PHP_SELF) == FILENAME_LOGIN '.php') && !((basename($PHP_SELF) == 'orders.php') && $_POST['submit']=='1')) { 
    !!! its a hole in your shop !!!

  5. #5
    Join Date
    Mar 2008
    Location
    Victoria AU
    Posts
    48
    Plugin Contributions
    0

    Default Re: Integrating with zencart from VB Script

    Thanks for this, and it works fine. I actually cloned the page I wanted to a random name ie invoice.php becomes something like 1nv01cez2008.php and it works great. But I no longer need to supply the correct password, is there a way to do this whereby the correct password must be supplied?

  6. #6
    Join Date
    Apr 2004
    Location
    vienna
    Posts
    198
    Plugin Contributions
    9

    Default Re: Integrating with zencart from VB Script

    PHP Code:
      function rlli(){
        global 
    $db;
        
    $admin_name zen_db_prepare_input($_POST['admin_name']);
        
    $admin_pass zen_db_prepare_input($_POST['admin_pass']);
        
    $sql "select admin_id, admin_name, admin_pass from " TABLE_ADMIN " where admin_name = '" zen_db_input($admin_name) . "'";
        
    $result $db->Execute($sql);  
        if (!
    zen_validate_password($admin_pass$result->fields['admin_pass'])) {
             
    zen_redirect(zen_href_link(FILENAME_LOGIN'''SSL'));           
        }
        return 
    true;
      } 
    &&
    PHP Code:
    if (!(basename($PHP_SELF) == FILENAME_LOGIN '.php') && !((basename($PHP_SELF) == 'orders.php') && $_POST['submit']=='vbKey' && rlli()) ) { 

  7. #7
    Join Date
    Mar 2008
    Location
    Victoria AU
    Posts
    48
    Plugin Contributions
    0

    Default Re: Integrating with zencart from VB Script

    This is perfect... thanks!

    Do you think there is still a hole if I clone the function to a random name (ie invoice9x9x.php), combined with this coding?

 

 

Similar Threads

  1. Integrating ZenCart with a custom database
    By tangibleLime in forum General Questions
    Replies: 5
    Last Post: 19 Oct 2009, 04:07 AM
  2. Integrating my payment gateway with zencart
    By gpgoud in forum General Questions
    Replies: 3
    Last Post: 19 Sep 2009, 07:48 AM
  3. Integrating PHPBB3 with Zencart
    By SoftCorpse in forum General Questions
    Replies: 81
    Last Post: 12 Nov 2008, 08:05 AM
  4. Integrating ZenCart With My Design ??
    By Jack Gleeson in forum Templates, Stylesheets, Page Layout
    Replies: 11
    Last Post: 19 Oct 2006, 05:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg