Web Analytics Made Easy -
StatCounter Workstation Name - CodingForum

Announcement

Collapse
No announcement yet.

Workstation Name

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Workstation Name

    I am working on an internal site that needs to grab the workstation name in a form that can be passed.

    Is this possible?
    I have it set up that x.js runs and the data comes up in a popup.
    I have no idea how to pass that data. Maybe I'm going down the wrong path.

    Pls help

    the x.js

    var WshNetwork = WScript.CreateObject("WScript.Network");
    WScript.echo ("Computer Name = " + WshNetwork.ComputerName);

  • #2
    well, it depends. what do you want to do with this information?

    by the way, this ought to be somewhere in the javascript forum.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

    Comment


    • #3
      sorry wrong forum.


      I would like to get the info into a form that can be submitted into a sql database.

      thanks

      Comment


      • #4
        Actually, passing info would be in serverside, particularly MySQL forum or PHP

        Firstly, you are using WSH, (windows scripting host) which can pose a threat to most users, and might be switched off. I assume if you're getting computer name, then its over a corporate internet/intranet so i guess that's a little better

        TO do that, here's some code. It utilises PHP and a MySQL Database called info. THe code is fly-typed, so may contain a couple of errors!

        PHP Code:
        <?
        if(!$submit)
        {
        ?>
        <html>
        ..
        ..
        <form name="form" method="post" action="<?=$PHP_SELF?>">
        <input type="text" name="compname"> Computer Name
        <input type="submit" name="submit">
        </form>
        ..
        ..
        </html>
        <?
        }
        else
        {
        //submit to database
        //for this example we'l use database name "info" and table "user"

        //first we connect to database

        $connect mysql_connect('localhost','username','password');
        mysql_select_db("info",$connect);
        $result mysql_query("INSERT INTO user(compname) VALUES('$compname')");

        if(
        $result)
        {
        echo 
        "Submitted data. Thanks";
        }
        else
        {
        echo 
        "An error occured: ".mysql_error();
        }

        ?>
        Hope that sheds some light

        Jee
        Last edited by Jeewhizz; Jun 13, 2002, 12:51 PM.
        Jeewhizz - MySQL Moderator
        http://www.sitehq.co.uk
        PHP and MySQL Hosting

        Comment

        Working...
        X