06-13-2002, 03:30 PM
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.
var WshNetwork = WScript.CreateObject("WScript.Network");
WScript.echo ("Computer Name = " + WshNetwork.ComputerName);
06-13-2002, 03:56 PM
well, it depends. what do you want to do with this information?
06-13-2002, 04:01 PM
sorry wrong forum.
I would like to get the info into a form that can be submitted into a sql database.
06-13-2002, 06:48 PM
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!
<form name="form" method="post" action="<?=$PHP_SELF?>">
<input type="text" name="compname"> Computer Name
<input type="submit" name="submit">
//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');
$result = mysql_query("INSERT INTO user(compname) VALUES('$compname')");
echo "Submitted data. Thanks";
echo "An error occured: ".mysql_error();
Hope that sheds some light