Check Web
Moderator: Rathinagiri
Re: Check Web
OK.. guys here is my thought. Every clients program has a unique serial number made up from characters of their name.
In the company table where the system gets it`s setup and invoice numbers and so on is this serial number.
the serial number is made up in chr codes so they can not be found in the exe program.
For lease programs I can add at first initial setup of program ( for example a chr(76) code at the end of their serial number.)
Also every day when the program is started it has a date field in the control file that updates to todays date so at first opening it could
also have a spot to check once a day our number somewhere outside on the web . I use dbf tables not sql.
Now we have a number to check every day at first opening. EG: number 71838332 (76) we add a L for lease in exe chr76.
We need the number and a date which could be last date paid or paid to whatever. This can be in a prn file dbf file, these are easiest to work from.
Now in my exe program I have to open that file and check numbers at the start.
I do not know php so where can I go from here. It is sure nice of Mol to offer his webserver for testing.
Thanks so much ...... Franco
In the company table where the system gets it`s setup and invoice numbers and so on is this serial number.
the serial number is made up in chr codes so they can not be found in the exe program.
For lease programs I can add at first initial setup of program ( for example a chr(76) code at the end of their serial number.)
Also every day when the program is started it has a date field in the control file that updates to todays date so at first opening it could
also have a spot to check once a day our number somewhere outside on the web . I use dbf tables not sql.
Now we have a number to check every day at first opening. EG: number 71838332 (76) we add a L for lease in exe chr76.
We need the number and a date which could be last date paid or paid to whatever. This can be in a prn file dbf file, these are easiest to work from.
Now in my exe program I have to open that file and check numbers at the start.
I do not know php so where can I go from here. It is sure nice of Mol to offer his webserver for testing.
Thanks so much ...... Franco
All The Best,
Franco
Canada
Franco
Canada
Re: Check Web
I have low knowledge of PHP (one web application for our motorcycle club finances ), but, I can prepare for you function to read data from mysql database.
You can add and manage records in this database via phpMyAdmin very easy, or I can create php file, which your application-manager will call to update db
You can add and manage records in this database via phpMyAdmin very easy, or I can create php file, which your application-manager will call to update db
Re: Check Web
Could we just use a .prn file which can be managed manually. We may only add one or two programs a month.
If we could open the file or append to a temp dbf to check. If id is not in the file warning or terminate.
If customer does not pay or will not pay manually take his number out.
If we could open the file or append to a temp dbf to check. If id is not in the file warning or terminate.
If customer does not pay or will not pay manually take his number out.
All The Best,
Franco
Canada
Franco
Canada
- dragancesu
- Posts: 921
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
Re: Check Web
@franco
better forget dbf or prn or any text file where use php
standard is mysql database
I thinking to create something like @mol do, and think must send more than one data, you must use some unique value, something uuid for windows, it's determine pc unique, and username (username is visible, uuid is unvisible for user)
better forget dbf or prn or any text file where use php
standard is mysql database
I thinking to create something like @mol do, and think must send more than one data, you must use some unique value, something uuid for windows, it's determine pc unique, and username (username is visible, uuid is unvisible for user)
Re: Check Web
If franco needs a simple solution based on a txt file, here it is:franco wrote: ↑Sun Jan 27, 2019 10:22 pm Could we just use a .prn file which can be managed manually. We may only add one or two programs a month.
If we could open the file or append to a temp dbf to check. If id is not in the file warning or terminate.
If customer does not pay or will not pay manually take his number out.
A simple PHP scrypt querying the file serial.id in terms of file content.
Code: Select all
<?php
if ($_GET["SerialID"]=="")
{
$SerialID="none";
}else{
$SerialID=$_GET["SerialID"];
}
$valid = false;
$file = "serial.id";
$ex=count($file);
$myFile = fopen($file,"r");
while(!feof($myFile))
{
$line = fgets($myFile);
if(substr($line,-1)==chr(10))
{
$line = substr($line,0,-1);
}
if(substr($line,-1)==chr(13)){
$line = substr($line,0,-1);
}
if($line==$SerialID)
{
$valid = True;
}
}
fclose($myFile);
IF ($valid)
{
echo("1");
}
ELSE
{
echo("0");
}
?>
You can upload your serial.id file using FTP to the public_html folder on the test host.
Re: Check Web
Thank you all, I will create code as of the start of my program and now show how I think Mol and Edk`s suggestions will work.
Forum Help........WOW ...... Franco
Forum Help........WOW ...... Franco
All The Best,
Franco
Canada
Franco
Canada
Re: Check Web
This is now working thanks to edk.
Maybe you show me how to update web txt file.
Now I have learned so much from this I will carry on to Mol`s idea as I understand it better now. ( Thanks Mol )
The reason I have not got into sql ideas is I have never been able to get any sql`s to work. Just my lack of knowledge.
This will work. I put in new frdemo.prg and use build.bat
This is in frdemo.hbp frdemo.hbc is empty must be compiled with build.bat
#harbour options:
-a
-m
-n
-v
-w3
#hbmk2 options:
-lurlmon
#sources:
frdemo.prg
******************************************************************************************
Thanks again ... Franco
Maybe you show me how to update web txt file.
Now I have learned so much from this I will carry on to Mol`s idea as I understand it better now. ( Thanks Mol )
The reason I have not got into sql ideas is I have never been able to get any sql`s to work. Just my lack of knowledge.
This will work. I put in new frdemo.prg and use build.bat
Code: Select all
************************************************************************
#include <hmg.ch>
#define CRLF Chr(13)+Chr(10)
Function Main()
// PUBLIC cserialID := control.dbf->serial which is open for my program
PUBLIC cserialID := inputbox('Enter Serial Number ** EG:1234567890') // For our demo
CheckValidSerial( cSerialID )
return nil // for now
FUNCTION CheckValidSerial( cSerialId ) // All of these functions could be in their own program.
IF !isInternet()
MsgExclamation("No Internet")
RETURN Nil
ENDIF
if ! CheckValidSerialID(cSerialID)
msgbox('Program Stops ')
return nil
else // for now
msgbox(' Program Valid And Continues') /// just for us now to show program continues
endif
RETURN Nil
***********************************************************************************
FUNCTION CheckValidSerialID( cSerialID )
Local Lic_httpURL, Lic_serial, Down_Result
Local fileLic := "ValidLic.txt", lValid := .F.
#pragma TEXTHIDDEN(1)
Lic_httpURL:="https://crunched-interface.000webhostapp.com/"
Lic_serial:= "?SerialID=" + cSerialID
#pragma TEXTHIDDEN(0)
Down_Result := DOWNLOADFILE( Lic_httpURL + Lic_serial, HB_CWD() + fileLic )
//file will be downloaded in current directory
If Down_Result <> 0
MsgStop ("Error while connecting to host")
RETURN lValid
ENDIF
IF FILE(fileLic)
lValid:=Memoread(fileLic)=='1'
DELETEFILE(fileLic)
ENDIF
RETURN lValid
************************************************************************************************
FUNCTION isInternet()
RETURN InternetCheckConnection( "https://www.google.com" )
*RETURN
************************************************************************************************
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
#include <wininet.h>
#define FLAG_ICC_FORCE_CONNECTION 0x00000001
HB_FUNC( INTERNETCHECKCONNECTION )
{
const char * cUrl = hb_parc( 1 );
hb_retl( (HB_BOOL) InternetCheckConnection( cUrl, FLAG_ICC_FORCE_CONNECTION, 0 ) );
}
#pragma ENDDUMP
#pragma BEGINDUMP
#include "SET_COMPILE_HMG_UNICODE.ch"
#include "HMG_UNICODE.h"
#include <Windows.h>
#include <urlmon.h>
#include "hbapi.h"
HB_FUNC( DOWNLOADFILE )
{
HRESULT hr;
hr = URLDownloadToFileW( NULL, HMG_parc( 1 ), HMG_parc( 2 ), 0, NULL );
hb_retnl( hr ) ;
}
#pragma ENDDUMP
********************************************
#harbour options:
-a
-m
-n
-v
-w3
#hbmk2 options:
-lurlmon
#sources:
frdemo.prg
******************************************************************************************
Thanks again ... Franco
All The Best,
Franco
Canada
Franco
Canada
Re: Check Web
Mol and Serge Do you think the sql way would be less confusing. The txt way Edk suggested above involves some areas I don`t understand
but works very well.
Mol if your offer still stands maybe you could guide me though the sql way. Remember I do not know how to make sql work.
Franco
but works very well.
Mol if your offer still stands maybe you could guide me though the sql way. Remember I do not know how to make sql work.
Franco
All The Best,
Franco
Canada
Franco
Canada
- dragancesu
- Posts: 921
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
Re: Check Web
Visit http://hmgforum.com/viewtopic.php?f=5&t ... z&start=10
and see my little manual for start with MySQL
As a programmer, you know that every solution that works is good
but in this case it is better to learn SQL and work with the MySQL database
I long ago wanted to do something similar, now I'll probably end up
and see my little manual for start with MySQL
As a programmer, you know that every solution that works is good
but in this case it is better to learn SQL and work with the MySQL database
I long ago wanted to do something similar, now I'll probably end up
- serge_girard
- Posts: 3165
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: Check Web
For the SQL-way (which I personally prefer) you will need a host + website ( not neccesarly with pages!).
For a friend of mine I 'bought' a domain + hosting: this gives you a MYSQL database + emailaccounts etc.
How to access etc. you can find above (see Dragan's response)
Serge
For a friend of mine I 'bought' a domain + hosting: this gives you a MYSQL database + emailaccounts etc.
How to access etc. you can find above (see Dragan's response)
Serge
There's nothing you can do that can't be done...