Wondering if I am going to get grunts and groans about this as I fear that it may not be good form to mix php and vbscript, but I am trying to piece to things together.
I am attempting(and learning all this as I go) to put up a php/mysql page that will help my users connect to servers listed via MS Terminal Server Client. The newest client that comes with XP and most likely 2003 allows for a command line switch to pass connection information too (ie such as an IP address).
I have found this VBScript on a thread in www.tek-tips.com thread posted by user Strahan and assisted by user PHV.
<script language=vbscript>
function ts_connect()
set sh = createobject("wscript.shell")
sh.run "%systemroot%\system32\mstsc.exe /v:" & data.ip.value
set sh = nothing
end function
</script>
<form name=data>
IP/System to connect to:<BR>
<input type=text name=ip size=15><BR><BR>
<input type=button value='Connect' onclick="vbscript:if data.ip.value = '' then msgbox('You need to specify a server!') else call ts_connect()"
This actually creates a box that asks for the IP address and when you click on a connect button it starts MS Terminal Server Client with the IP entered into the box.
I have already created a page that lists all the servers. When a user clicks on the server name it passes the server id to the next page called session_start.php.
Here is the link to the page(it's all internal, but just so that you can see what is being passed)
http://tsweb/tcweb/start_session.php?servername=1
Here is session_start.php
<?php
include("./header.php");
$connID = connect_to_techsupport();
$result = mysql_query(" SELECT ipaddress.IPAddress
FROM ipaddress, ippadress_server
WHERE ipaddress.ipaddress_id = ipaddress_server.ipaddress_id
AND ipaddress_server.server_id = {$_GET['servername']}");
echo "<script language=vbscript>
function ts_connect()
set sh = createobject(\"wscript.shell\")
sh.run \"%systemroot%\system32\mstsc.exe /v:\" & $result
set sh = nothing
end function
</script>
call ts_connect";
?>
I am going to also try make sure I have the VBScript right as I am not sure how to call the function by itself. I get no response from this page at all, not even any errors.
The query here is looking at 2 tables that I have.
Table ipaddress
ipaddress_id
IPNetwork (desctiption of what network the address is on)
IPAddress (The IP address of the box)
I use the table ipaddress_server to join the server name table to it's ipaddress.
Table ipaddress_server
ipaddress_id
server_id
The url is passing the server_id from the server name table. I know it is probably bad form to call it servername and once I get this part working I do intend to correct this.
I can post more info as needed. Please note that this is my first PHP page and I am a big NEWB.
Oh...BTW...The webserver is a Red Hat 9 server running Apache. I can post and version info that is needed.
Thanks for any and all help.....it really will be appreciated....thank you