Leaderboard
Popular Content
Showing content with the highest reputation on 08/29/2012 in all areas
-
MySQL UDFs using libmysql.dll functions: most functions from MySQL API all are prefixed with an underscore: _MySql... e.g.: _MySQL_Real_Query( sometimes parameters are chaged - read function descriptions in include file MySQL.au3 If you do not need the power of these UDFs and you simple want to use basic SQL commands, then have a look at not included: MySQL_Connect - This function is deprecated. Use _MySQL_Real_Connect instead. MySQL_Create_DB - This function is deprecated. Use mysql_query() to issue an SQL CREATE DATABASE statement instead. MySQL_Drop_DB - This function is deprecated. Use mysql_query() to issue an SQL DROP DATABASE statement instead. MySQL_Escape_String - You should use _mysql_real_escape_string() instead! MySQL_Kill - This function is deprecated. Use mysql_real_query() to issue an SQL KILL statement instead mysql_library_end - Called by _MySQL_EndLibrary. mysql_library_init - Called by _MySQL_InitLibrary. I included a fallback-libmysql.dll: yoou can include libMySQLDLL.au3 and set $Use_EmbeddedDLL=True when calling _MySQL_InitLibrary an example for XAMPP / cdcol is also included in ZIP. #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.8.1 (beta) Author: Prog@ndy Script Function: MySQL-Plugin Demo Script #ce ---------------------------------------------------------------------------- #include <array.au3> #include "mysql.au3" ; MYSQL starten, DLL im PATH (enthält auch @ScriptDir), sont Pfad zur DLL angeben. DLL muss libmysql.dll heißen. _MySQL_InitLibrary() If @error Then Exit MsgBox(0, '', "could nit init MySQL") MsgBox(0, "DLL Version:",_MySQL_Get_Client_Version()&@CRLF& _MySQL_Get_Client_Info()) $MysqlConn = _MySQL_Init() ;Fehler Demo: MsgBox(0,"Error-demo","Error-Demo") $connected = _MySQL_Real_Connect($MysqlConn,"localhostdfdf","droot","","cdcol") If $connected = 0 Then $errno = _MySQL_errno($MysqlConn) MsgBox(0,"Error:",$errno & @LF & _MySQL_error($MysqlConn)) If $errno = $CR_UNKNOWN_HOST Then MsgBox(0,"Error:","$CR_UNKNOWN_HOST" & @LF & $CR_UNKNOWN_HOST) Endif ; XAMPP cdcol MsgBox(0, "XAMPP-Cdcol-demo", "XAMPP-Cdcol-demo") $connected = _MySQL_Real_Connect($MysqlConn, "localhost", "root", "", "cdcol") If $connected = 0 Then Exit MsgBox(16, 'Connection Error', _MySQL_Error($MysqlConn)) $query = "SELECT * FROM cds" $mysql_bool = _MySQL_Real_Query($MysqlConn, $query) If $mysql_bool = $MYSQL_SUCCESS Then MsgBox(0, '', "Query OK") Else $errno = _MySQL_errno($MysqlConn) MsgBox(0,"Error:",$errno & @LF & _MySQL_error($MysqlConn)) EndIf $res = _MySQL_Store_Result($MysqlConn) $fields = _MySQL_Num_Fields($res) $rows = _MySQL_Num_Rows($res) MsgBox(0, "", $rows & "-" & $fields) ; Access2 1 MsgBox(0, '', "Access method 1- manual") Dim $array[$rows][$fields] For $k = 1 To $rows $mysqlrow = _MySQL_Fetch_Row($res,$fields) $lenthsStruct = _MySQL_Fetch_Lengths($res) For $i = 1 To $fields $length = DllStructGetData($lenthsStruct, 1, $i) $fieldPtr = DllStructGetData($mysqlrow, 1, $i) $data = DllStructGetData(DllStructCreate("char[" & $length & "]", $fieldPtr), 1) $array[$k - 1][$i - 1] = $data Next Next _ArrayDisplay($array) ; Access 2 MsgBox(0, '', "Access method 2 - row for row") _MySQL_Data_Seek($res, 0) ; just reset the pointer to the beginning of the result set Do $row1 = _MySQL_Fetch_Row_StringArray($res) If @error Then ExitLoop _ArrayDisplay($row1) Until @error ; Access 3 MsgBox(0, '', "Access method 3 - read whole result in 2D-Array") $array = _MySQL_Fetch_Result_StringArray($res) _ArrayDisplay($array) ; fieldinfomation MsgBox(0, '', "Access fieldinformation") Dim $arFields[$fields][3] For $i = 0 To $fields - 1 $field = _MySQL_Fetch_Field_Direct($res, $i) $arFields[$i][0] = _MySQL_Field_ReadValue($field, "name") $arFields[$i][1] = _MySQL_Field_ReadValue($field, "table") $arFields[$i][2] = _MySQL_Field_ReadValue($field, "db") Next _ArrayDisplay($arFields) ; free result _MySQL_Free_Result($res) ; Close connection _MySQL_Close($MysqlConn) ; exit MYSQL _MySQL_EndLibrary() MySQL UDf Downloads: (including x86 and x64)</array.au3>1 point
-
web form
Mechaflash reacted to JLogan3o13 for a topic
Hi, mrjoli021. Can you please post the code you have thus far, or at least the URL you're trying to manipulate? It will be much easier to assist if we can see what you're trying to accomplish1 point -
[HELP] Detect Unwanted Process's
Kendall reacted to JLogan3o13 for a topic
I believe you meant "layman's terms"1 point -
1 point
-
simple AutoIT question..
lordofthestrings reacted to water for a topic
While/WEnd isn't a loop? Sure it is! It's the other way round. The script will never stop because there is no ExitLoop or Exit statement.1 point -
Very awesome UDF.Thanks a lot ProgAndy. Here is few tips for users: This is a user input: $ds='uid`=7 or sleep(100)-- and '; Your application is vulnerable if your input references to column name even if it's escaped. (because mysql_real_escape_string() simply escapes ' and \ plus some unicodes but not `.) $s=_mysql_real_escape_string($connected,$ds); $query = "SELECT * FROM userstbl where `" & $s & "`='blah'" Another scenario: Again vulnerable. $ds='sleep(10)--'; $s=_mysql_real_escape_string($connected,$ds); $query = "SELECT * FROM userstbl where uid=" & $s ConsoleWrite($query & @CRLF & @CRLF) Second example isn't vulnerable if you properly typecast in ex user input to integer (if you expect integer from user input of course) $ds=Int('sleep(10)--'); So always use: $s=_mysql_real_escape_string($connected,$ds); $query = "SELECT * FROM `userstbl` where `uid`='" & $s & "'" Style and if possible do not use user input as reference to column names.(In itself it's bad style) (if you do or you need to do that validate it using whitelisting ways: Check is user input exists in your array?) On other hand here we deal with client MYSQL SERVER.(Missing server side validation/sanitisation in this case.) It's not secure anymore if your client managed to modify your program or somehow managed Man in Middle attacks. You can't do anything in this case.It will look like something like: "Validating authentication using Javacscript on login page". If i'm wrong please correct me. Thanks.1 point
-
1 point
-
I have had times when NTFS formatted USB HDDs (not flash drives) have been stuck by explorer because of filesystem journals etc. In that case my handle script has always found those handles and can close them. The other part of my script from above uses sdparm to physically sync and spin down HDDs. I tend to do that and then just disconnect the USB rather than forcing closed filesystem handles. I suppose it's really about the same. But to answer your question, no, in recent memory I have not had a drive with no open handles refuse to be ejected.1 point
-
Caps Lock toggle w/o {CAPSLOCK toggle}
aush reacted to JLogan3o13 for a topic
If you're working with a string of characters, just read the string in and then use StringUpper. Ex: $var = InputBox("Type in anything you want", "") MsgBox(0, "", StringUpper($var))1 point -
Create a function, with a boolean param, where the boolean will conditionally break up the characters, and append a '+' (shift) in front of the chars prior to send or controlsend edit: or, you can use StringToASCIIArray, and logically change lower to upper, or upper to lower (add or subtract 32), then send with chr()...make sure to only do this on the range of alpha chars...also, if you want this outside of a scripted string, you probably wont get much help, 'cause that requires key logging1 point