Fijate en el primer ejemplo que puse. La función echo() es la engancha la salida en pantalla del html en el cliente, ahí se mete todo según lo quieras sacar desde el servidor donde esta el script hasta el navegador.
El webauto.au3 se incluyo en el aha.au3 en algun caso. Es posible que falte algún jpg pero se añade el que se quiera.
Cada ejemplo es un archivo.au3 que estaría en el servidor que se accede como una página php.
Donde
http://www.emesn.com:8080/ es el servidor antiguo que sería donde esté la página en cada caso.
Un sencillo contador.au3 :
Código: Seleccionar todo
; Author: BASICOS UDFs for dinamic web *.aha
#include "d:\au4\htdocs\Aha.AU3"
_StartWebApp (stringreplace(@ScriptName,".au3","")) ; here is missing some kind of .css
$sql = _AhaConnect () ; now in aha.ini
;---------code
_AhapushCount (@ScriptName, "Wellcome to .AHA (Autoit Hyperlink Access) <b>%%%</b> Visits <br> ", 1)
;--------- thats all
Exit
Otro ejemplo.au3:
#include Aha.au3
$sql = _AhaConnect () ; usando librería aha guardas en un .ini los pass
$var = _Query($sql,"SELECT * FROM mytable WHERE user = 'pepe'")
echo("<table>")
While NOT $var.EOF
echo("<tr>")
echo($var.Fields("user_facturas").value & "," & $var.Fields("telefono").value )
$var.MoveNext
echo("</tr>")
WEnd
echo("</table>"
_MySQLEnd($sql)
La ruta d:\au4\htdocs\pages\html\ es donde se guardan los ficheros fuente (tipo index.php), y en d:\au4\htdocs\Aha.AU3 donde se guarda la librería. Configurar como se quiera.
traductor.au3
Código: Seleccionar todo
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.1.4 (beta)
Author: BASICOS
Script Function: index au3
#ce ----------------------------------------------------------------------------
#include "d:\au4\htdocs\Aha.AU3"
_StartWebApp (StringReplace(@ScriptName, ".au3", "")) ; here is missing some kind of .css
$sql = _AhaConnect () ; now in aha.ini
dim $aPos[3]
echo ("<b> With .AHA I use a SELECT to choose the language of this page: </b><br> ")
Select
Case StringLeft($_ACCEPT_LANGUAGE, 2) = "es" ; spanish
$aPos[1] = 1
$aPos[2]=2
Case StringLeft($_ACCEPT_LANGUAGE, 2) = "de" ; german
$aPos[1] = 1
$aPos[2]=3
Case StringLeft($_ACCEPT_LANGUAGE, 2) = "en" ; english
$aPos[1] = 1
$aPos[2]=1
Case Else
$aPos[1] = 1
$aPos[2]=4
EndSelect
$sTextWellcome = _AhaTranslate(" Your language is English "& Stringmid($_ACCEPT_LANGUAGE,4,2), _
"English::Espanol::Deutsch::Language unknown,,Your language is English::Su Idioma es Español::Ihre Sprache ist Deutsch::Help tell me your Language", $aPos)
$sWellcome = _aHaHtmlRead ("d:\au4\htdocs\pages\html\index.html", '<li><b><a href="downloadme.au3">', 'running</span></font></a></b></li>', 1, _
"Wellcome to Database Internet Access For Autoit - " & $stextwellcome & " %%%") ;english
echo ($sWellcome)
_AhapushCount (@ScriptName, "<br><b>Wellcome we got %%% Visits, Thanks</b>", 1)
echo (_aHaHtmlRead ("d:\au4\htdocs\pages\html\index.html", "<HTML>", "</HTML>", 0))
echo('<br><br><br><a href="http://www2.clustrmaps.com/counter/maps.php?url=http://www.emesn.com:8000" id="clustrMapsLink"><img src="http://www2.clustrmaps.com/counter/index2.php?url=http://www.emesn.com:8000" /></a><br><br>')
echoLink("<br><br>","http:::www.emesn.com:8000/telluserror.au3"," Visit our Error Page :) ","")
_ahaexit ()
Código: Seleccionar todo
; Author: BASICOS UDFs for dinamic web *.aha
OPT("trayIconDebug",1)
#include "d:\au4\htdocs\Aha.AU3"
_StartWebApp (StringReplace(@ScriptName, ".au3", "")) ; here is missing some kind of .css
$sql = _AhaConnect ("forum") ; now in aha.ini
;code ------------;$oPath=@scriptdir&"\au3download\"
_AhapushCount (@ScriptName, StringReplace($_Credits, "#cs <1", StringReplace(@ScriptName, ".au3", "")) & " <br> ", 1)
echo ("<b>Librería de funciones en Internet versión Beta - Echo en Autoit")
filemanthegets(_get ("ACTION"), _get ("file_id"))
;----------------------------postform search form newscript form
filemanaction()
echo("<br> <br> Añade tu función en esta librería, con un maximo 1,3 kb por Script, corto y bueno dos veces bueno :)"& _
" <br>Puede usar las opciones: Añade tu Función, Ver Código, Buscar, Pendientes: Actualiza, Borrar, Hacer Privada, Hacer Pública</b>")
echo("<br> <br> Please, Add your Snippet , maximum 1,3 kb Sent<br>Options available: Add your Udf, view code and search, to do: Update, Delete, Make private, Make Public</b>")
_AHAexit ("<br><br><b>", "http://www.emesn.com:8000", "_AhA Main site", "</b>")
Exit
Func filemanthegets($gAction, $gFileid)
If $gAction Then
$oVar1 = _AhaQuery($sql, "SELECT user,description,code,File,info from tds_fileman where COUNT_ID='" & $gFileid & "'")
Select
Case $gAction = "ViewCode"
If Not $oVar1.eof Then
;msgbox(0,"",_urldecode($oVar1.Fields ("description").value))
;msgbox(0,"",$oVar1.Fields ("description").value)
$stoecho1= ("<br>File:"&_AhaUrlDecode($oVar1.Fields ("File").value) & " <b>by Code Author: "& _AhaUrlDecode($oVar1.Fields ("User").value)& ":</b><br><table border=1><tr><td>" & _AhaUrldecode ($oVar1.Fields ("Info").value)&"</td></tr>") & _
("<tr><td>Description:" & _AhaUrldecode ($oVar1.Fields ("description").value) & "</td></tr><tr><td> <code>"& _
_AhaUrldecode ($oVar1.Fields ("code").value) & "</code></td></tr></table>")
;filewrite("c:\file.txt",$svaluetoecho1&$svaluetoecho2&_urldecode($svaluetoecho3))
echo ($stoecho1)
EndIf
Case $gAction = "Download"
Case $gAction = "Execute"
EndSelect
EndIf
EndFunc ;==>filemanthegets
Func filemanAction()
_AhaInitPost("search searchstring scriptmanager user pass file description info code private") ; collect posts and create vars preact puser ppass
$theSelect = "SELECT COUNT_ID,File,Views,Downloads,Reset_date,User,Description,Execute,Private from tds_fileman "
If $psearch = "search" Then
$array = StringSplit(_urldecode ($psearchstring), ' ');
$sfilter = 'WHERE ';
For $in In $array
;//$strbusqueda .= 'descrip LIKE "%'.$in.'%" AND ';
$sfilter = $sfilter & '(code LIKE "%' & $in & '%" OR description LIKE "%' & $in & '%" OR file LIKE "%' & $in & '%" OR user LIKE "%' & $in & '%") AND ';
Next
$sfilter = $sfilter & ' 1';
$theSelect = "SELECT COUNT_ID,File,Views,Downloads,Reset_date,User,Description,Execute,Beta from tds_fileman " & $sfilter
EndIf
echoPostForm("<p>", "", '><div align="center"><left><b>Buscar en las Funciones / Search in UDF</b><br>')
echoInput("", "hidden", "search", "search", ' >')
echoInput("Texto dentro del Codigo:", "text", "searchstring", "", ' size="30">')
echoSubmit("", "Submit", '></p></left></div></form>')
Select
Case ($pscriptmanager = "add_file")
If (($puser) And ($pcode) And ($pfile) And ($pdescription) And ($Ppass)) Then
FileWrite("filewrited.au3", _urldecode ($pcode))
_AhaQuery($sql, "INSERT into tds_fileman VALUES ( 0, '" & $pfile & "',0,0,SYSDATE(), '" & $puser & "', '" & $Ppass & "', '" & $pdescription & "', '" & $Pinfo & "','" & StringReplace($pcode, @CRLF, "%13")& "',0,0,'" & $Pprivate & "')");
echo ("<br><br><center><b>Script " & $pfile & " Added Succesfully</b></center>")
Else
echo ("<strong>either your user,password,code,filename,description field was left blank</strong>");
EndIf
EndSelect
$sTheTable = echoTable($theSelect, _
"BORDER=1><CAPTION><b>Uploaded Scripts</b></CAPTION>", _
'<center><A HREF="HTTP://WWW.EMESN.COM:8000/fileman.aha?ACTION=ViewCode&File_id=&&&#COUNT_ID&&&">Ver Código</a><br>' & _
'<A HREF="HTTP://WWW.EMESN.COM:8000/fileman.aha?ACTION=Download&File_id=&&&#COUNT_ID&&&">Bajar</a><br>' & _
'<A HREF="HTTP://WWW.EMESN.COM:8000/fileman.aha?ACTION=Execute&File_id=&&&#COUNT_ID&&&">Ejecute</a></center>' _
, ' ALIGN = "center" ', "", "</center>", 0)
Dim $aPos
$aPos = _ArrayCreate(0, 1, 2, 3, 4, 5, 6, 7, 8)
echo (_AhaTranslate($sTheTable, "File::Nombre del Script,,Views::+Views,,Reset_date::Uploaded", $aPos));"<th>" & $wcolumns[$i] & "</th>"
echoPostForm("<p>", "", '><div align="center"><center><b>Añade una función nueva con contraseña: - ADD A New Script with Password</b><br>')
echoInput("", "hidden", "scriptmanager", "add_file", ' >')
echoInput("Privado (solo se ve con tu pass):", "text", "private", "0", ' size="1"><br>')
echoInput("User :", "text", "user", "", ' size="30"><br>')
echoInput("Pass :", "PASSWORD", "pass", "", ' (For Updating) size="30"><br>')
echoInput("Nombre Fichero:", "text", "file", "", ' size="30"><br>')
echoInput("Descripcion:", "text", "description", "", ' size="30"><br>')
echoTextArea("info", "", "Info, How to:<br> %%%<br>", ' ROWS=2 COLS=70 ')
echoTextArea("code", "", "Codigo Code:<br><b> %%%</b>", ' size="10" ROWS=20 COLS=70 ')
echoSubmit("<BR>", "Submit", '></p></center></div></form>')
EndFunc ;==>filemanAction
Código: Seleccionar todo
; Author: BASICOS UDFs for dinamic web *.aha
#include "d:\au4\htdocs\Aha.AU3"
_StartWebApp (stringreplace(@ScriptName,".au3","")) ; here is missing some kind of .css
$sql = _AhaConnect () ; now in aha.ini
;code ------------
_AhapushCount ( @ScriptName, "Wellcome to .AHA (Autoit Hyperlink Access) <b>%%%</b> Visits <br> Job Search Beta", 1)
_AhaInitPost ("quecliente elnumero")
echo ("<center><IMG src='imgs/logoemesn.jpg'></center>")
;;/////////////start form
echoPostForm ("<p>", "client.au3", '><div align="center"><center><b>Look for a job part</b><br>')
echoInput ("Buscar el parte : ", "text", "quecliente", $pquecliente, ' size="10"><br>')
echoSubmit ("", "Find", '></p></center></div></form>')
echo ("<center>")
If _post ("elnumero") > 0 Then
_query ($sql, "UPDATE _partes SET entregado='Listo' WHERE numero=" & $pelnumero & ";")
;_UpdateRecord($sql, "_partes", "entregado", "Listo", "numero", number(_get("elnumero")) )
_msgbox ("Se deactivated el parte número " & $pelnumero)
EndIf
If $pquecliente Then
$filter = " cliente like '" & $pquecliente & "'"
Else
$filter = " entregado<>'Listo'"
EndIf
_MySQLEnd ($sql)
Exit
telluserror.au3:
Código: Seleccionar todo
; Author: BASICOS UDFs for dinamic web *.aha
#include "d:\au4\htdocs\Aha.AU3"
_StartWebApp (stringreplace(@ScriptName,".au3","")) ; here is missing some kind of .css
$sql = _AhaConnect () ; now in aha.ini
;---------code
_AhapushCount (@ScriptName, "Wellcome to .AHA (Autoit Hyperlink Access) <b>%%%</b> Visits <br> ", 1)
echo(_aHaHtmlRead("d:\au4\htdocs\pages\_"&stringreplace(@scriptname,"aha","au3"),"#cs <1","#ce <1",0))
_AhaInitPost ("choose user error name email") ; collect posts and create vars preact puser ppass
If ($Perror) Then
_AhaQuery ($sql, "INSERT into tds_error VALUES ( 0, SYSDATE(), '" & $Puser & "', '" & $Perror & "', '" & StringLeft($_ACCEPT_LANGUAGE, 2)&$pname & "', '" & $pemail & "', '" & $pchoose & "' )");
Else
;echo ("<strong>either your user or password field was left blank</strong>");
EndIf
echo("Have a nice day")
echoPostForm ("<p>", "telluserror.au3", '><div align="center"><center><b>ADD An error report</b><br>')
echoInput ("", "hidden", "choose", $_REMOTE_ADDR, ' >')
echoInput ("User :", "text", "user", "", ' size="30"><br>')
echoInput ("Where was error? :", "text", "error", "", ' size="40"><br>')
echoInput ("Your name:", "text", "name", "", ' size="30"><br>')
echoInput ("Email:", "text", "email", "", ' size="30"><br>')
echoSubmit ("", "Submit", '></p></center></div></form>')
echoimg("canarybird.jpg",' ALT="canary"',"<center>%%%</center>")
echoimg("canarybird.jpg",' ALT="canary"',"<center>%%%</center>")
echoimg("canarybird.jpg", 'ALT="canary" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid" height=98 width=98 ',"<br>%%% Canary bird<br><br><br>")
echoimg("autoit.jpg",' ALT="Autoit Programming"',"<center>%%%</center><br>")
echoLink("<br>","http://www.emesn.com:8000","Autoit Hyperlink Access Site","<br>")
echo("Have a nice day")
echo(_aHaHtmlRead("d:\au4\htdocs\pages\_"&stringreplace(@scriptname,"aha","au3"),"#cs <2","#ce <2",0))
_downloadme.au3 un listador de programas, un sistema para bajarlos y llevar la cuenta de lo que bajas
Código: Seleccionar todo
; Author: BASICOS UDFs for dinamic web *.aha
#include "d:\au4\htdocs\Aha.AU3"
_StartWebApp (StringReplace(@ScriptName, ".au3", "")) ; here is missing some kind of .css
$sql = _AhaConnect () ; now in aha.ini
;code ------------
;$oPath=@scriptdir&"\au3download\"
echo ("Available Aha Files:<br>")
downloadme("au3downloads", 1)
_AhapushCount ( @ScriptName, "<br><br>Wellcome to .AHA (Autoit Hyperlink Access) <b> Total %%%</b> hits to Download/Run<br> ", 1)
_AHAexit ("<br><br><b>", "http://www.emesn.com:8000", "_AhA Main site", "</b>")
Func downloadme($sPath, $protected)
;directory listing
$FileList = _FileListToArray($sPath)
If (Not IsArray($FileList)) And (@error = 1) Then
_MsgBox ("No Files\Folders Found.")
Exit
EndIf
echo("<table>")
For $i = 1 To $FileList[0]
echo("<tr><td>")
$fechastr=""
$fecha= FileGetTime($FileList[$i])
;if $fecha<>0 then $fechastr=$fecha[2]&"-"&$fecha[1]&"-"&$fecha[0]
;
echoLink (_Iif(StringInStr($FileList[$i], "au3"), " Runme", " Downloadme")& "..->", "downloadme.aha?file=" & $FileList[$i], $FileList[$i]," "& FileGetAttrib($FileList[$i])&".."&$fechastr &" ......"); only info no make a hit
echo("</td><td>")
_AhapushCount ( $FileList[$i] , "%%% Hits.<br>",2)
echo("</td></tr>")
Next
echo("</table>")
;file list
If _get ("file") Then
$file = $sPath & "\" & _get ("file")
If Not FileExists($file) Then
echo ("File " & $file & " does not exist<br> Try later Thanks")
Else
If $protected Then
echoLink ("<br><br><b>Click to " & _Iif(StringInStr(_get ("file"), "au3"), " Run ", " Download") & " now ", $file, $file, "</b>")
echo ("<br><br><br>Autoit Code: <br><br><br>")
_AhaEchoFile($file)
Else
echoLink ("<br><br><b>Click to " & _Iif(StringInStr(_get ("file"), "au3"), " Run ", " Download") & " now ", $file, $file, "</b>")
EndIf
_AhapushCount ( $file , "<br> Total %%% "&_Iif(StringInStr( ".au3.php.txt.html",stringright(_get ("file"),4)),"Reads","Trying to read encrypted data, sorry") & ".... ", _Iif(StringInStr(_get ("file"), "au3"), 2, 1))
EndIf
EndIf
EndFunc ;==>downloadme
Func _AhaEchoFile($file)
Dim $aRecords
If Not _FileReadToArray($file, $aRecords) Then
_MsgBox (" Error reading File, error:" & @error)
Return 0
EndIf
For $x = 1 To $aRecords[0]
echo (_Ahahtml2ascii ($aRecords[$x]) & "<br>")
Next
endfunc
Esto es una tabla que devuelve de una base de datos, comprobando un login básico control..au3:
Más avanzado cambia el echo por aaaXXX, usa cookies etc. muy operativo y depurado este código.
Código: Seleccionar todo
; Author: BASICOS UDFs for dinamic web *.aha
Global $gclean
#include "d:\au4\htdocs\Aha3.AU3"
aaaCreateAll("Control de códigos","","ssPass") ;"#FAFAFA",many vars separated by ; as var1;var2;var3;var4
aaaInitCookie("ssPass", "")
; CODE
if not $ssPass then
aaaB ("<BR><BR><BR><TABLE><TR><TD><p>")
aaaB (aaaPostForm ("", '><div align="center"><center><b>Contraseña de acceso </b><br>'))
aaaB (aaaInput ("hidden", "preact", "preact", ' >'))
aaaB ("Contraseña :" & aaaInput ("password", "ssPass", $ssPass, ' size="6"><br>') & aaaSubmit ("Submit", '></p></center></div></form>'))
aaaB ("</TD</TR></TABLE><center>")
Else
aaab(" Usuario ")
endif
;aaapushCount (@ScriptName, "Bienvenido al sistema web de gestión <b>%%%</b> Visitas <br> ", 1)
;aaaB(EnvGet("HTTP_COOKIE") & "<br><br><br>")
if $ssPass="juan" or stringupper($ssPass)="elpass" then
aaaB("<br>" & $ssAaa_Id&"<br>" )
$sql = aaaConnect ("netcafe", "", "", "conecta3.homelinux.com") ; now in aha.ini
$varquery = aaaQuery ($sql, "SELECT ID_USUARIO,saldo,nombre,apellidos,fecha,pc,fechacrea from usuario where ono='X'")
If Not $varquery.eof Then
If $gclean = 1 Then
;aaaB (aaaTemplateParse ("d:\au4\htdocs\pages\ciber\_" & StringReplace(@ScriptName, "aha", "au3"), "#cs 1?>", "#ce <1", 0, $sCollectedSplitVars = ";;"))
$inicialoutput = StringReplace(aaaBlockRead ("d:\au4\htdocs\pages\ciber\_" & StringReplace(@ScriptName, "aha", "au3"), "#cs 1?>", "#ce <1", 0), 'setReloadTime(90)', 'setReloadTime(90)')
Else
$inicialoutput = StringReplace(aaaBlockRead ("d:\au4\htdocs\pages\ciber\_" & StringReplace(@ScriptName, "aha", "au3"), "#cs 1?>", "#ce <1", 0), 'setReloadTime(90)', 'setReloadTime(90)')
EndIf
Else
$inicialoutput = "Vacio no hay nadie, reintente con la tecla F5"
EndIf
aaaB ($inicialoutput)
aaaB (" Conect@ Hora:" & _Now()&"<br>"&aaaLink("http://www.emesn.com:8080/","Subir Bajar",""))
aaaB (aaaTable ("SELECT ID_USUARIO,saldo,nombre,pc from usuario where ono='X' order by pc", "BORDER=1><CAPTION><b>Lista de Conectados en el ultimo minuto</b></CAPTION>", "", ' ALIGN = "center" ', "", "</center>"))
aaaB(_INetGetSource ("http://www.emesn.com/emesnwp/?page_id=2"))
If $gclean = 1 Then
;$varquerypcs = _Ahaquery ($sql, "SELECT ID_USUARIO,saldo,nombre,apellidos,fecha,pc,fechacrea from usuario where ono='X'")
aaaQuery ($sql, "UPDATE usuario set ONO=' ' where ONO='X'")
aaaB ("Cleaning ...Limpiando...")
EndIf
Else
aaaB("Repita contra.")
endif
aaaCommitAll()
exit
Un holamundo.au3
#include aha.au3
_StartWebApp ()
$Var="Hola Mundo!<br> Autoit aquí!<br><b> ;)</b><br> Son las .."& _now()
echo ($Var) ;
exit ; fin de la página
De aquí:
Salu22:)
Si sacas tu propio programa todavía tengo más ejemplos y ficheros, pero con los anteriores tienes bastantes para hacer tu propio prog
Si puedes publicar tus conclusiones estaría bien.