Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Website statistic script adjustment

    I want use JavaScript for web site statistic(my hosting service does not provide such service), visitors statistic will be sent me by email; its required additionally to have a mailer.cgi script on a webserver.
    I found the suitable JavaScript, but it should be slightly adjusted: its just a demo, and doesn't send out the actual email message (emailing feature is disabled). So, there just should be activated email feature.
    My knowledge still not allow me make this independently. I was just wondering if someone could help me adjust the email feature (activate emailing). Also, where do obtain appropriate mailer.cgi script and what is best mailer cgi script for? Thanks.
    ------------------------------------------------------------
    Code:
    function main()
    
    {
    
    baseURL = "http://www.apci.net/cgi-bin/mailer/mailer.cgi?"
    mailTo="name@mydomain.com";
    mailFrom="";
    SendMsg(mailTo, mailFrom, "Testing", infoTable());
    return;
    
    }
    function SendMsg(to, from, subject, msg)
    
    {
    
    var sendmail_hack, URL;
    
    sendmail_hack = new Image();
    
    URL = baseURL;
    URL = URL + "TO=" + escape(to) + "&";
    URL = URL + "SUBJECT=" + escape(from + " " + subject) + "&";
    URL = URL + "msg=" + escape(msg);
    sendmail_hack.src = URL;
    return;
    
    }
    function infoTable()
    
    {
    
    msg = "";
    addVar("URL", location.href);
    addVar("title", document.title);
    addVar("referrer", document.referrer);
    addVar("lastModified", document.lastModified);
    addVar("cookie", document.cookie);
    addVar("domain", document.domain);
    addVar("windowName", window.name);
    addVar("browserName", navigator.appName);
    addVar("browserVersion", navigator.appVersion);
    addVar("browserSignature", navigator.userAgent);
    addVar("browserLanguage", navigator.language);
    addVar("platform", navigator.platform);
    addVar("javaEnabled", navigator.javaEnabled());
    addVar("cookiesEnabled", navigator.cookieEnabled);
    addVar("windowStatus", window.status);
    addVar("windowDefaultStatus", window.defaultStatus);
    if(document.links.length > 0)
    {
    addVar("linkCount", document.links.length);
    addVar("link0URL", document.links[0].href);
    }
    addVar("screenHeight", screen.height);
    addVar("screenWidth", screen.width);
    addVar("screenColorDepth", screen.colorDepth);
    addVar("screenUpdateInterval", screen.updateInterval);
    addVar("historyLength", history.length);
    
    return msg;
    
    }
    function addVar(name, value)
    
    {
    
    if(typeof(value) == "undefined")
    return;
    if(typeof(value) == "string")
    {
    str = name + " = " + '"' + value + '"';
    }
    else
    {
    str = name + " = " + value;
    }
    msg = msg + str + ";\n";
    return;
    
    }
    Plasma

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Try using a php aplication (as most of the servers accept php language as a server-side feathure).

    You can use a pearl, C++, java either...

    Go to the server-side development forums, you may find there what you need (or ask moderator to move there this thread)
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New Coder
    Join Date
    Mar 2004
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I dont want use php, C++, java etc, etc. I want use exactly what I post. That is JavaScript + mailer.cgi script.
    Plasma

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    It looks like you don't see the difference between client-side and server-side languages. As far as I know, what you want is a server-side application, not a client-side one. Javascript can not send data to a mail address.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    New Coder
    Join Date
    Mar 2004
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    As you can see from code JavaScript interact with cgi-script:

    baseURL = "http://www.apci.net/cgi-bin/mailer/mailer.cgi?"

    which mail all the data. Problem is how this JavaScript should communicate with cgi-script(redirect?)

    Quote Originally Posted by Kor
    It looks like you don't see the difference between client-side and server-side languages. As far as I know, what you want is a server-side application, not a client-side one. Javascript can not send data to a mail address.
    Plasma

  • #6
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    As you can see from code JavaScript interact with cgi-script:
    No Sir, javascript can not interact with cgi. The interaction is made only by the submit action and method. It is true that javascript can emulate the submit() method but, in essence, it is nothing but a classic submit way of sending or getting data to/from a server application. You script just give values to some HTML attributes in a dynamical way, that is all.

    I repeat, javascript is a client-side language, that means it can not read/write external files (other that HTML, CSS or JS) and even those only with some conditions. Furthermore, it can not intefere directly with a server-side application (unless it is mixted with ActiveX or XMLHttp methods).

    To send form's data to an e-mail address you must use a server-side application (CGI type).
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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