Jump to content


uniGUI Subscriber
  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Ron

  1. I've made an example project, hope it helps. The basic idea is to send a special link, which expires, and pick it up as the app loads. emailconf.zip
  2. In httpd.conf you need the isapi and mime modules, as well as mime setup for dll files.
  3. Whatever data you need after login, you can store in the mainmodule as variables. So in the LoginForm, you just set those variables before closing the form, and then check those variables again as the mainform opens, doing whatever you want to do. 1. Declare the var in mainModule. 2. Set the var in loginForm, before close 3. Read the var in mainForm, at onShow or later
  4. To display text blobs I typically do a substr of the blob field in the sql call. select substr(textblobfield, 1, 500) as textfield from mytable;
  5. You should do all the user credentials checking in the login form, so when you close the login form the user is considered authorized and logged in. SO there are two ways out of the login form, and you determine that before you leave the form: modalResult:=mrOK - user is logged in modalResult:=mrCancel - user failed authorization
  6. Sounds like a proxy issue, as firefox does not import IE's settings, as Chrome does. Try removing all VPN installations.
  7. Why quote the ID, as it is probably an integer? If this works: EmployeeTable.CommandText:='select * from employee WHERE ID=8180'; then this works: EmployeeTable.CommandText:='select * from employee WHERE ID='+ cUserName;
  8. function TCompObject.SendSMSMessage(number, msg:string):boolean; const cUSER_AGENT = 'Mozilla/4.0 (MSIE 6.0; Windows NT 5.1)'; var authtoken, url, SID, StatusText: string; aResponse: TStringStream; aParams:TStringList; mHTTP:TidHTTP; LHandler: TIdSSLIOHandlerSocketOpenSSL; fullCallbackURL, ResponseText:string; begin result:=false; fullCallbackURL:='http://www.mydomain.com/'+callbackURL; try mHTTP:=TIdHTTP.Create(nil); mHTTP.Request.BasicAuthentication:=true; mHTTP.Request.Username:=accountsid; mHTTP.Request.Password:=accountpw; url := Format('https://%s/%s/Accounts/%s/Messages/', [apiurl, apiversion, accountsid]); aParams := TStringList.Create ; try LHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil); aParams.add('From='+alfanumID); aParams.add('To='+number); aParams.add('Body='+msg); aParams.add('StatusCallback='+fullCallbackURL); aResponse := TStringStream.Create; try mHTTP.IOHandler:=LHandler; mHTTP.ReadTimeout:=15000; mHTTP.Post(url, aParams, aResponse); finally ResponseText := aResponse.DataString; LHandler.Free; end; finally aParams.Free; aResponse.Free; mHTTP.Free; end; except on E:Exception do logMsg('SendSMSMessage Exception: '+ E.Message) end; //get SID and status SID:=getSID(ResponseText); statusText:=getStat(ResponseText); if pos('queued', ResponseText)<>0 then begin Result:=true; logMsg('SMS Message sent to: '+number+', msg: '+msg); end else Syslog('MainModule: SMS Sending Error - response: '+responseText); end; I use Twilio.com, and they have a REST service where you POST the message, using basicauth and SSL.
  9. Unless a redirect loads a new instance of the MainModule, and the parameter value is reset and lost. But if you save the value to the db, with the remote IP, you can look it up as the new instance loads without parameters, and select which part of the app to use.
  10. Ron

    SSL options

    I also have an earlier version of 1.0.2, from 2015. openssl-1.0.2-x64_86-win64.zip
  11. Ron

    SSL options

    This is what I use, think it came from Shining Light Productions. openssl-1.0.2j-x64_86-win64.zip
  12. This should ideally be solved on the client side, i.e. with Javascript, so you don't get any server calls. The graph data is already in the client, so there is no need to fetch anything from the server.
  13. If you want to close port 80 totally, you can do it on the server's firewall. If not, you can redirect port 80 calls to the SSL port if you run the app as a DLL, e.g for apache: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L] I'm sure you can do the same thing for IIS.
  14. If all you have are the hours, 02 will always be less than 22 - so you need more data than just the hours. When crossing into a new day, you need to differentiate between dates, so you need some date reference for each point in time. Whatever the reference is, a datetime comparison will work as long as the last datetime is defined as being x hours after the first.
  15. uses System.Net.HttpClientComponent, function getHTML(URL:string):string; var aResponse: TStringStream; http: TNetHTTPClient; begin result:=''; try http:=TNetHTTPClient.Create; aResponse := TStringStream.Create; try http.Get(url, aResponse); result:= aResponse.DataString; finally aResponse.Free; http.free; end; except on E:Exception do showMessage('Get htmlfile error: '+ E.Message); end; end; Using TNetHTTPClient makes it a lot easier to connect to different webservers that have strict requirements when it comes to SSL setup, than when using Indy.
  16. Ron

    Reponsive WebApp?

    I guess that should be possible. Anyone got some suggestions?
  17. Ron

    Reponsive WebApp?

    I found a copy, get it at https://filebin.net/zwnhmstdhrj7zm95
  18. I am sorry to hear about your struggle to find a solution. People generally do not have such issues, is my impression. I have installed apache manually on several machines and have never had any problems that were not solved rather quickly on this ISAPI solution by configuration. As the manual suggests, only a few configurations in the httpd.conf are needed, and whether you run 32 or 64 bits version should be irrelevant. I personally prefer the apache solution because it is so easy to setup, with just a few quick modifications. I have made an example project, with windows binaries of Apache 2.4 from ApacheLounge, in the attached file. 1) Unzip Apache24.zip to C:\Apache24 2) Go to \bin subdir and run httpd. 3) Open http://localhost:81/test in browser, to load test.dll project in \test subdir. The only mods to the httpd.conf that I did was 1) For the mime section: AddHandler isapi-handler .dll 2) <Directory "C:/apache24/test"> Options FollowSymLinks ExecCGI AllowOverride None DirectoryIndex test.dll Require all granted </Directory> Alias /test "C:/apache24/test" 3) Set port to 81, to not conflict with your WAMP server, if you have it running. The ISAPI module was already activated in the httpd.conf. It took me about ten minutes to make this example project. You can also download Apache binaries directly from https://www.apachelounge.com/download/VC15/ and just use my modified httpd.conf file and compile the test.dll yourself from the project. https://home.apache.org/~steffenal/VC15/binaries/httpd-2.4.46-win32-VC15.zip Apache24.zip test.zip
  19. In that video he moves the documentroot and adds index.dll as default file. Of course it works, but it is not the preferred way, as you have to rename your apps to index.dll. The manual way should work fine, and you can also there add the app as the index file without renaming it, and it leaves the documentroot for other files you might want to serve, e.g. PHP files for quick backend access. But I am happy that you found a solution, and things will get a lot easier as you continue experimenting
  20. It should not be an issue with the server, so there should be no reason to replace apache. If the apache server is setup correctly and is able to serve any html page, it should work fine with Unigui, and if not you have a config issue. Also, I do not use the WAMP packages, but download the apache windows binaries and install it manually - not much work at all. Basically you just download, unzip and run one single line to install the httpd as a windows service, and that's it.
  21. You should edit httpd.conf and not httpd-vhosts.conf as you have listed. Also make sure you reference the DLL file and not EXE as you seem to have done in the browser. What you have in your Directory setup seems to be correct, except for the space between "/" and the alias name, in the alias declaration. And you may add the line "DirectoryIndex swdweb.dll" as default file to load if you want to avoid having to specify the filename: Alias /SWDweb "C:/SWDweb" <Directory "C:/SWDweb"> Options Indexes FollowSymLinks ExecCGI AllowOverride None Require all granted DirectoryIndex swdweb.dll </Directory>
  22. //insert into myfiletable values(0, :date, :filename, :file); with SaveFileQuery do begin paramByName('date').AsDateTime:=now; paramByName('filename').AsInteger:=uniFileUpload1.fileName; try blob := TMemoryStream.Create; blob.Seek(0, soFromBeginning); try blob.loadFromFile(myFileName); //if you have the file on disc myFastReport.SaveToStream(blob, true, true, false); //if you need to save a PDF report finally end; finally paramByName('file').LoadFromStream(blob, ftBlob); //if you use any of the above options paramByName('file').LoadFromStream(uniFileUpload1.stream, ftBlob); //if you have not saved the file yet ExecSQL; blob.Free end; end;
  23. If you are making an http request from the client (which you do when you use JS, as all JS runs in the browser client) then you can only communicate with the local computer through CORS, and the local webserver must be configured to accept such requests. If you want to communicate to the outside world, you have to do it from the server side, and that is straightforward using e.g. idHTTP and doing a simple http get request. Example of JS call to local webserver using CORS UniSession.AddJS('$.get("'+uniMainModule.corsPort+'?event='+inttostr(EventID)+'&op='+uniMainModule.operator+'", function( data ){' + ' ajaxRequest(TransactionForm.form, ["cashRegisterEvent"], { response : data }); '+ ' }); '); Apache set up for CORS in httpd.conf <VirtualHost *:80> DocumentRoot "c:\program files (x86)\cashreg\apache22\htdocs" Header set Access-Control-Allow-Origin "*" </VirtualHost> IndyHTTPServer set up for CORS if sameText('', ARequestInfo.RemoteIP) and (ARequestInfo.CommandType=hcGet) and (length(aRequestInfo.Params.text)>0) then begin AResponseInfo.CustomHeaders.AddValue('Access-Control-Allow-Origin', '*'); EventIDStr:=aRequestInfo.Params[0];
  24. Ron

    Delphi and Linux

    andy - I only have a couple of the regular Spooky2 generators, never tried the Scalar thing
  25. Ron

    Delphi and Linux

    I created a couple of apps in Lazarus some years ago, it actually works. http://microhertz.org/
  • Create New...