madsiddiqui 0 Posted September 4, 2011 I have this code, it decodes an encoded message. But what if want to encode the decoded message? Please help. I wan't this to be encode message and autoitscript this? how to convert codes? Index.php <?php include("inc.php"); $realname = $HTTP_POST_FILES['userfile']['name']; if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) { copy($HTTP_POST_FILES['userfile']['tmp_name'], "/$realname"); echo "Upload Filename: " . $HTTP_POST_FILES['userfile']['name']; $xx=encodeNow("/$realname"); } else { echo "Upload not complete"; } ?> <html> <form action="index.php" method=post enctype="multipart/form-data"> File: <input type=file name="userfile"> <input type=submit><br> </form> <pre> <? echo $xx; ?> </pre> </html> [/PHP] Inc.php [PHP] <?php $decode = array( "20" => "4", "21" => "5", "22" => "6", "23" => "7", "24" => "0", "25" => "1", "26" => "2", "27" => "3", "28" => "<", "29" => "=", "2a" => ">", "2b" => "?", "2c" => "8", "2d" => "9", "2e" => ":", "2f" => ";", "30" => "$", "31" => "%", "32" => "&", "33" => '"', "35" => "!", "36" => "'", "37" => "#", "38" => "", "39" => "-", "3a" => ".", "3b" => "/", "3c" => "(", "3d" => ")", "3e" => "*", "3f" => "+", "40" => "T", "41" => "U", "42" => "V", "43" => "W", "44" => "P", "45" => "Q", "46" => "R", "47" => "S", "48" => "\\", "49" => "]", "4a" => "^", "4b" => "_", "4c" => "X", "4d" => "Y", "4e" => "Z", "4f" => "[", "50" => "D", "51" => "E", "52" => "F", "53" => "G", "54" => "@", "55" => "A", "56" => "B", "57" => "C", "58" => "L", "59" => "M", "5a" => "N", "5b" => "O", "5c" => "H", "5d" => "I", "5e" => "J", "5f" => "K", "60" => "t", "61" => "u", "62" => "v", "63" => "w", "64" => "p", "65" => "q", "66" => "r", "67" => "s", "68" => "|", "69" => "}", "6c" => "x", "6d" => "y", "6e" => "z", "6f" => "{", "70" => "d", "71" => "e", "72" => "f", "73" => "g", "75" => "a", "76" => "b", "77" => "c", "78" => "l", "79" => "m", "7a" => "n", "7b" => "o", "7c" => "h", "7d" => "i", "7e" => "j", "7f" => "k", "a0" => "x", "a1" => "x", "a2" => "x", "a3" => "x", "a4" => "x", "a5" => "x", "a6" => "x", "a7" => "x", "a8" => "x", "a9" => "x", "aa" => "x", "ab" => "x", "ac" => "x", "ad" => "x", "ae" => "x", "af" => "x", "b0" => "x", "b1" => "x", "b2" => "x", "b3" => "x", "b5" => "x", "b6" => "x", "b7" => "x", "b8" => "x", "b9" => "x", "ba" => "x", "bb" => "x", "bc" => "x", "bd" => "x", "be" => "x", "bf" => "x", "c0" => "x", "c1" => "x", "c4" => "x", "c5" => "x", "c6" => "x", "c7" => "x", "d1" => "x", "d3" => "x", "d4" => "x", "d5" => "x", "d6" => "x", "d7" => "x", "d8" => "x", "d9" => "x", "da" => "x", "db" => "", "dc" => "x", "dd" => "x", "de" => "x", "df" => "x", "e0" => "x", "e1" => "x", "e2" => "x", "e3" => "x", "e4" => "x", "e5" => "x", "e6" => "x", "e7" => "x", "ec" => "x", "ed" => "x", "f0" => "x", "f3" => "x", "f4" => "x", "f5" => "x", "f6" => "x", "f7" => "x", "f8" => "x", "fc" => "x", "fd" => "x", "fe" => "x", "ff" => "x", "1e" => "\n", "1d" => "\t" ); function decodeNow($file) { global $decode; $text = file_get_contents($file, true); $max = strlen($text); for ($i=0; $i<$max; $i++) { $ii=bin2hex($text[$i]); if (empty($decode["$ii"]) && $decode["$ii"]!=0) { $out.="x"; } else $out.=$decode["$ii"]; //echo "$i = $ii<br>"; } return $out; } function encodeNow($file) { global $encode; $text = file_get_contents($file, true); $max = strlen($text); for ($i=0; $i<$max; $i++) { $ii=hex2bin($text[$i]); if (empty($encode["$ii"]) && $encode["$ii"]!=0) { $out.="x"; } else $out.=$encode["$ii"]; //echo "$i = $ii<br>"; } return $out; } ?> [/PHP] Share this post Link to post Share on other sites
guinness 1,521 Posted September 4, 2011 You're going to need FileRead(), StringLen() amongst other things, but perhaps looking for _URLEncode & _URLDecode in search will provide more results. I would also recommend looking at WinHTTP.au3 which you can find via search. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Share this post Link to post Share on other sites
Zedna 282 Posted September 4, 2011 (edited) I have this code, it decodes an encoded message.But what if want to encode the decoded message? Please help. I wan't this to be encode message and autoitscript this? how to convert codes? This forum doesn't work this way!Start translating it yourself and post code you have and where are you stuck.Then we can help you fix your code...Don't expect somebody will write it for you from scratch. Edited September 4, 2011 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Share this post Link to post Share on other sites