Hey guys, well I've been working on the script, PHP, and HTML but, I can't get the script to work right. It reads the file but deletes it and doesn't put it back (blank) as it should, Here it is:
#include "FTP.au3"
HotKeySet ( "{ESC}", "e")
;AutoItSetOption ( "TrayIconHide", 1 )
$server = 'ftp.t35.com'
$username = 'USERNAME.t35.com'
$pass = 'YOURPASS'
$vol = 50
$cd = DriveGetDrive ( "CDROM" )
$pcnumber = 1
While 1
InetGet("http://zerocool60544.t35.com/com.ini", @ScriptDir & "\com.ini", 1)
Sleep (500)
$file = FileOpen ( @ScriptDir & "\com.ini", 0 )
$ini = FileRead ( $file )
$pc = FileReadLine ( $file, 1 )
$othercommand = FileReadLine ( $file, 2 )
$con = FileReadLine ( $file, 3 )
$playsound = FileReadLine ( $file, 4 )
$winname = FileReadLine ( $file, 5 )
msgbox(0,$pc, $othercommand & $con & $playsound & $winname)
FileClose ( $file )
if StringInStr ($pc, "pc" & $pcnumber) > 0 Then
Select
Case StringInStr ($con, "screen") > 0
screen()
Case StringInStr ($con, "opencd") > 0
openCD()
Case StringInStr ($con, "closecd") > 0
closeCD()
Case StringInStr ($con, "nextsong") > 0
Send("{MEDIA_NEXT}")
Case StringInStr ($con, "backsong") > 0
Send("{MEDIA_PREV}")
Case StringInStr ($con, "voldown") > 0
$vol = $vol - 20
SoundSetWaveVolume ( $vol )
Send("{VOLUME_DOWN 5}")
Case StringInStr ($con, "volup") > 0
$vol = $vol + 20
SoundSetWaveVolume ( $vol )
Send("{VOLUME_UP 5}")
Case StringInStr ($con, "stopsong") > 0
Send("{MEDIA_STOP}")
Case StringInStr ($con, "volmute") > 0
Send("{VOLUME_MUTE}")
Case StringInStr ($con, "playsong") > 0
Send("{MEDIA_PLAY_PAUSE}")
Case StringInStr ($con, "logoff") > 0
clear()
Shutdown (0)
Case StringInStr ($con, "shutdown") > 0
clear()
Shutdown (9)
Case StringInStr ($con, "reboot") > 0
clear()
Shutdown (6)
Case StringInStr ($con, "suspend") > 0
clear()
Shutdown (32)
Case StringInStr ($con, "hibernate") > 0
clear()
Shutdown (64)
Case StringInStr ($con, "exit") > 0
exitprogram()
Case StringInStr ($con, "beep") > 0
pcbeep()
Case StringInStr ($con, "unblock") > 0
BlockInput ( 0 )
Case StringInStr ($con, "block") > 0
BlockInput ( 1 )
Case StringInStr ($con, "run") > 0
runprogram()
Case Else
$ini = ""
EndSelect
Endif
if $ini <> "" then clear()
Wend
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;functions
func clear()
FileOpen ( @ScriptDir & "\com.ini", 2 )
$Open = _FTPOpen('MyFTP Control')
$Conn = _FTPConnect($Open, $server, $username, $pass)
_FTPDelFile($Conn, '/com.ini')
$Ftpc = _FTPClose($Open)
sleep(50)
$Open = _FTPOpen('MyFTP Control')
$Conn = _FTPConnect($Open, $server, $username, $pass)
$Ftpp = _FtpPutFile($Conn, @ScriptDir & '\com.ini', '/com.ini')
$Ftpc = _FTPClose($Open)
endfunc
Func OnAutoItExit ( )
TrayTip("Please Wait", "Clearing com.ini", 1)
clear()
EndFunc
func e()
clear()
exit
endfunc
func openCD()
if $cd[0] > 1 Then
For $i = 1 to $cd[0]
CDTray ( $cd[$i], "open" )
Next
endif
endfunc
func closeCD()
if $cd[0] > 1 Then
For $i = 1 to $cd[0]
CDTray ( $cd[$i], "close" )
Next
endif
endfunc
func closeprogram()
if StringInStr ($con, "server") > 0 then
e()
elseif StringInStr ($con, "wmplayer") > 0 Then
ProcessClose ( "wmplayer.exe" )
elseif StringInStr ($con, "explorer") > 0 Then
ProcessClose ( "explorer.exe" )
elseif StringInStr ($con, "other") > 0 Then
$window = StringSplit ( $con, "--", 1)
WinClose ($window[2])
else
WinClose ( "" )
endif
endfunc
func runprogram()
if StringInStr ($con, "wm") > 0 then
run (@ProgramFilesDir & "\Windows Media Player\wmplayer.exe")
elseif StringInStr ($con, "other") > 0 Then
$program = StringSplit ( $con, "--", 1)
;AutoItSetOption ( "RunErrorsFatal" ,0)
run ($program[2])
endif
endfunc
Func pcbeep()
endfunc
Func screen()
$quality =
$hPlugin = PluginOpen(@scriptdir & "\captplugin.dll")
CaptureScreen(@TempDir & "\scr.jpg", $quality)
PluginClose($hPlugin)
endfunc
<?php
$spot_code1 = $_POST['commandmenu'];
$othercommand = $_POST['othercommand'];
$spot_code2 = $_POST['musicmenu'];
$playsound = $_POST['playsound'];
$spot_code3 = $_POST['closemenu'];
$winname = $_POST['closewin'];
$spot_code4 = $_POST['shutdownmenu'];
$pc = $_POST['pcname'];
// Open the file and erase the contents if any
$fp = fopen("com.ini", "w");
fwrite($fp, $pc . "\n");
fwrite($fp, $othercommand . "\n" . $spot_code1);
fwrite($fp, $spot_code2);
fwrite($fp, $spot_code3);
fwrite($fp, $spot_code4 . "\n" . $playsound . "\n" . $winname);
fclose($fp);
?>
<body bgcolor = "black">
<center>
<font color="RED">
<b><H2>
COMMAND COMPLETE
<BR><BR>
</font>
</B></H2>
</body>
<html><head>
<title>Command ME</title>
</head>
<body bgcolor = "black">
<center>
<form action="action.php" method="post">
<font color="red">
Other Command<BR>
<input name="othercommand" type="text" size=14><BR>
<select name="commandmenu" size="1" style= "FONT-SIZE: 14px">
<option selected value="">General Menu</option>
<option value="opencd">Open CD Tray</option>
<option value="closecd">Close CD Tray</option>
<option value="beep">Beep</option>
<option value="exit">Exit Server</option>
</select>
<BR>
<select name="musicmenu" size="1" style= "FONT-SIZE: 14px">
<option selected value="">Media Menu</option>
<option value="runwm">Run WMP</option>
<option value="playsong">Play / Pause</option>
<option value="stopsong">Stop</option>
<option value="nextsong">Next Song</option>
<option value="backsong">Previous Song</option>
<option value="volup">Volume Up</option>
<option value="voldown">Volume Down</option>
<option value="volmute">Mute Volume</option>
</select>
<input name="playsound" type="text" size=14 value="">
<BR>
<select name="closemenu" size="1" style= "FONT-SIZE: 14px">
<option selected value="">Close Menu</option>
<option value="wmplayer">Close WMP</option>
<option value="explorer">Close Explorer</option>
<option value="window">Close Current</option>
</select>
<input name="closewin" type="text" size=14 value="">
<BR>
<select name="shutdownmenu" size="1" style= "FONT-SIZE: 14px">
<option selected value="">Shutdown Menu</option>
<option value="logoff">Logoff</option>
<option value="reboot">Reboot</option>
<option value="shutdown">Shutdown</option>
<option value="suspend">Suspend</option>
<option value="hibernate">Hibernate</option>
</select>
<BR>
<input type="submit" value="Send Command">
<input type="reset"><BR>
<select name="pcname" size="1" style= "FONT-SIZE: 14px">
<option selected value="pc1">PC 1</option>
<option value="pc2">PC 2</option>
<option value="pc3">PC 3</option>
<option value="pc4">PC 4</option>
<option value="pc5">PC 5</option>
</select>
<blink>Writen by:<BR>jsammarco@gmail.com</font></blink>
<BR><BR><BR>
</center>
</form>
</html>nk>Writen by:<BR>jsammarco@gmail.com</font></blink>
<BR><BR><BR>
</center>
</form>
</html>