Jump to content

Web-based AutoIt! - New with AuCGI!


theguy0000
 Share

Recommended Posts

#Include <Web.au3>
$file = _PostMultiPart("uploaded2")
If IsArray($file) Then
    FileWrite(@ScriptDir & "\uploaded\" & $file[0], $file[2])
    _StartWebApp()
    Echo("Goood")
Else
    _StartWebApp("Upload Example")
    Echo("<form action="&$_SCRIPT_NAME&" method=post name=uploaded ENCTYPE=multipart/form-data><input type=file name=uploaded2><input type=submit><form>")
EndIf

Do you know why this only excepts plain text files?

Link to comment
Share on other sites

Can some1 explain me how this works on apache,

i've added these lines:

<IfModule mime_module>

AddType application/x-httpd-au3 .au3

ScriptAlias /au3/ "c:/xampp/au3/"

Action application/x-httpd-au3 "c:/program files/autoit3/autoit3.exe"

</IfModule>

and edited this one:

<IfModule dir_module>

DirectoryIndex index.php index.php4 index.php3 index.cgi index.pl index.html index.htm index.shtml index.phtml index.au3

</IfModule>

It let me download the au3 files or it gives Error 400 when i goto my autoit page.

Am i doing something wrong?

Edited by Dellairion
Link to comment
Share on other sites

Can some1 explain me how this works on apache,

i've added these lines:

and edited this one:

It let me download the au3 files or it gives Error 400 when i goto my autoit page.

Am i doing something wrong?

I can't figure out how to make it work on apache either.

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

You can't put html in there....it has to be autoit... and <?au3 ?> tags don't exist.

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

You can't put html in there....it has to be autoit... and <?au3 ?> tags don't exist.

Maybe he thinks it is same as php that use <?php ?> :)

[u]My Projects[/u]:General:WinShell (Version 1.6)YouTube Video Downloader Core (Version 2.0)Periodic Table Of Chemical Elements (Version 1.0)Web-Based:Directory Listing Script Written In AutoIt3 (Version 1.9 RC1)UDFs:UnicodeURL UDFHTML Entity UDF[u]My Website:[/u]http://dhilip89.hopto.org/[u]Closed Sources:[/u]YouTube Video Downloader (Version 1.3)[quote]If 1 + 1 = 10, then 1 + 1 ≠ 2[/quote]

Link to comment
Share on other sites

How does the form thing works?

i have one file:

...
<form action="process_close.au3" method="post" name="form1" target="_self" id="form1">ID:
   <input name="field" type="text" id="field" maxlength="10" />
   <input type="submit" name="Submit" value="Close process" />
</form>
...

and in the target file:

...
<?au3 echo(_post("field")) ?>
...

But echo(_post("field")) returns ""

And is it possible to just have a button that calls an autoit script?

btw when i use the _PostMultipart() i get '0' too, this is what i used:

<form action="process_close.au3" method="post" enctype="multipart/form-data">
<input name="tfield" type="text" />
<input type="Submit" value="Close process" />
</form>

& target file:

<?au3 echo(_PostMultipart("tfield")) ?>
Edited by Dellairion
Link to comment
Share on other sites

*sigh*

you didn't make the form multipart in the first one. and there are NO SUCH THING AS <?au3 ?> TAGS.

The target script has to be PURE AUTOIT.

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

this-is-me: I cannot get your script to work. Every time I try it gives me this:

C:\Users\Ben\AppData\Local\Temp\webinclude.au3 (3) : ==> Error opening the file.: #include
Edited by AutoItKing
http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script]
Link to comment
Share on other sites

Maybe you forgot my script on the other page?

http://www.autoitscript.com/forum/index.ph...st&p=241460

This allows for <?au3 ?> tags.

Yes i used this script, it's much easier. You don't have to use the echo() command al the time.

Now i can edit my pages in dreamweaver and add scripts where needed with those tags just like php but for autoit.

Can some1 please tell me how to let it work on apache...

Edited by Dellairion
Link to comment
Share on other sites

Becaouse I need to post links i add a little function

----------------------------------------------------------------------------------------------------------
;link
; Description:      Sends file link to be displayed in the web browser.
; Parameter(s):     $sText           - The text to display.
;                   $sLink           - Link

; Return Value(s):  On Success - 0
;                   On Failure - 0  and Set @error to 1 if unable to ConsoleWrite
; Author(s):        usmiv4o <usmiv4o@gmail.com>
;Example     link("http://usmiv4o.mine.nu/speechlab.rar", "speech lab 2.0")
;----------------------------------------------------------------------------------------------------------
Func link($sLink, $sText) ;<a href="http://usmiv4o.mine.nu/speechlab.rar"> speech lab 2.0</a>
    Local $error
    ;Local $tagsplit = StringSplit ($sTag, " ")
    If $sLink <> "" Then
        ConsoleWrite(" <a href=" & Chr(34) & $sLink & Chr(34) & "> " & $sText & " </a> " & @crlf)
    Else
        ConsoleWrite ($sText&"<br />" & @crlf)
    EndIf
    If @error then $error = 1
    SetError ($error)
    Return 0
EndFunc

I have nothing to be proud: I am Bulgarian :~But there is no better place than 127.0.0.1Tutorial for newbies

Link to comment
Share on other sites

One more useful environment variable again.

Global $_ACCEPT_ENCODING = EnvGet('HTTP_ACCEPT_ENCODING')

It just come out in my mind while I'm scripting my Directory Listing script. :)

[u]My Projects[/u]:General:WinShell (Version 1.6)YouTube Video Downloader Core (Version 2.0)Periodic Table Of Chemical Elements (Version 1.0)Web-Based:Directory Listing Script Written In AutoIt3 (Version 1.9 RC1)UDFs:UnicodeURL UDFHTML Entity UDF[u]My Website:[/u]http://dhilip89.hopto.org/[u]Closed Sources:[/u]YouTube Video Downloader (Version 1.3)[quote]If 1 + 1 = 10, then 1 + 1 ≠ 2[/quote]

Link to comment
Share on other sites

  • 2 months later...

Not sure if this will break it or not... When I run any of the scripts I have in sCITE they hang on the

ConsoleRead(EnvGet("CONTENT_LENGTH"))oÝ÷ ج·
'uêⶬ¥u·zÛ^­«­¢+Ù
½¹Í½±I¡¹ÙÐ ÅÕ½Ðí
=9Q9Q}19Q ÅÕ½Ð줰9½Ð9յȡ¹ÙÐ ÅÕ½Ðí
=9Q9Q}19Q ÅÕ½Ð줤¤
Is there any reason this would function differently than the first one?

Link to comment
Share on other sites

That would break it, and I believe I mentioned not to run these scripts in Scite because they will hang.

Anyway, without the ConsoleRead, _POST will completely not work. Just getting the content length doesn't help us, all of the POST data is stored in the console.

Here is a possible fix:

$PostContentLength = EnvGet ("CONTENT_LENGTH")
If $PostContentLength <> "" Then
    Global $_POST_raw = ConsoleRead ($PostContentLength)
EndIf

Note: this hasn't been tested but I see no reason why it shouldn't work, so I'm putting it in the first post.

Thanks for pointing that out.

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

I'm sorry, but anyone who needs the fix for it hanging, will just have to replace this:

$_POST_raw = ConsoleRead(EnvGet("CONTENT_LENGTH")oÝ÷ Úåw½Â+a¶¬jëh×6$PostContentLength = EnvGet ("CONTENT_LENGTH")
If $PostContentLength <> "" Then
    Global $_POST_raw = ConsoleRead ($PostContentLength)
EndIf

by themselves, because I can't even edit my first post to put the new code in without getting it all messed up... http://www.autoitscript.com/forum/index.ph...mp;#entry387616

edit: note that this isn't a necessary fix, its just if you keep accidentally trying to run web based scripts from Scite. Because right now if you do that, the script will hang, but with this fix it won't.

edit2: ugh, see, I edited that post and it all got messed up. Fixing...

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

Didn't know there was a fix for it. Unfortunately, now the script crashes if you refer to _Post() or $_POST_RAW because it isn't defined. Couldn't the one I used work because Not Number(EnvGet("CONTENT_LENGTH")) should evaluate to true and cause the function to just peek at the stream, putting "" in $_POST_RAW.

Also, just wondering if there were any other fixes in the previous posts. If there are, couldn't they be compiled on the first page? You could edit the 2nd post instead of editing the topic.

Edit: Shouldn't _PostMultipart() use the Content-Type header?

Content-Type: multipart/form-data; boundary=---------------------------7d7177f204cc

You could do a Global $_MULTIPART = StringInStr($_CONTENT_TYPE, "multipart/form-data") And True to tell if _Post() or _PostMultipart() should be used.

Seems 7d7177f204cc is some kind of hexadecimal timestamp.

Edited by gamerman2360
Link to comment
Share on other sites

as to youor fix:

Global $_POST_raw = ""
$PostContentLength = EnvGet ("CONTENT_LENGTH")
If $PostContentLength <> "" Then
    $_POST_raw = ConsoleRead ($PostContentLength)
EndIf

should fix it.

About the multipart thing, well, I'm not sure, but it seems to work fine the way it is...

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...