Page 1 of 3

Check Web

Posted: Sat Jan 26, 2019 5:12 pm
by franco
I am thinking of leasing my program monthly, And I need a way to check if client has paid.
Has anyone have ideas on this.
My thought is at start of my program go to somewhere to check if clients serial number is there.
I thought a small website with a table or text file. or ip with table or text file to import and check and then update
Any thoughts.
Thanks in advance ...... Franco

Re: Check Web

Posted: Sat Jan 26, 2019 5:31 pm
by mol
My program calls php program on the web which saves client ID while downloading updates
It's simple to change it to test license and give feedback, I think.

Re: Check Web

Posted: Sat Jan 26, 2019 5:42 pm
by franco
Mol, Thanks for response, where on the web is the php program, and what is in the program.

Re: Check Web

Posted: Sat Jan 26, 2019 7:01 pm
by mol
There is no access to it. I'll try to prepare some code

Re: Check Web

Posted: Sat Jan 26, 2019 7:54 pm
by mol
Hi!
This is my very simple sample as a first preview of my idea:
hhm application:

Code: Select all

/*
 * HMG - Harbour Win32 GUI library Demo
 *
 * Copyright 2002-2008 Roberto Lopez <mail.box.hmg@gmail.com>
 * http://www.hmgforum.com//
 * Activex Sample: Inspired by Freewin Activex inplementation by 
 * Oscar Joel Lira Lira (http://sourceforge.net/projects/freewin).
*/

#include "hmg.ch"

FUNCTION Main()

	DEFINE WINDOW Win1 ;
		AT 0,0 ;
		WIDTH 800 ;
		HEIGHT 500 ;
		TITLE 'ActiveX interaction with PHP on the server' ;
		MAIN 

		DEFINE MAIN MENU

			POPUP "Test"
				MENUITEM "Test ID" ACTION TestId()
			END POPUP 			

		END MENU

		@ 10 , 50 ACTIVEX PHP_Interaction ;
			WIDTH 700  ;
			HEIGHT 400  ;
			PROGID "shell.explorer.2"  

	END WINDOW

	Center Window Win1

	Activate Window Win1

RETURN NIL

*------------------------------------------------------------------------------*
Procedure TestID()
	local cID := ''
	local cAddress := "https://www.mol-systemy.com.pl/hmg/test_id.php?userid="
	
	cID := InputBox ('Test user ID (B, C, D, X will pass test):','Enter user ID','')

	If .Not. Empty ( cId )
		cAddress += cId
		Win1.PHP_Interaction.Object:Navigate(cAddress)
	EndIf

Return
and PHP code on the server:

Code: Select all

<?php
	$licence=array("B","C","D","X");
	$userid = $_GET['userid'];
	if (isSet($userid)) {
		if (in_array($userid, $licence)) {
			echo "Licence is active for user " . $userid;
		}
		else {
			echo "!!!! NO ACTIVE LICENCE FOR USER " . $userid;
		}
	}
	else {
		echo "You didn't pass required parameter!";
	}
?>

Re: Check Web

Posted: Sat Jan 26, 2019 9:05 pm
by franco
Thanks Mol, I do not have a website. I will have to get a website to use this idea, or is there another way to access the information.
This looks good. So in the php program would I have a list to check and update. How is data kept in php.

Re: Check Web

Posted: Sat Jan 26, 2019 9:15 pm
by mol
I can create account for you at my webserver. You can test it and work as long as you want :-)
In this sample, data is kept in php file, but, it can be stored in sql database.
I can create db on my server for you, it will be accessible by phpadmin.
It's only matter to create php app, I have very small experience with it.


Ps. Sorry for my bad english

Re: Check Web

Posted: Sun Jan 27, 2019 9:22 am
by serge_girard
If it can be stored in sql database then you can access it from your HMG app!

Serge

Re: Check Web

Posted: Sun Jan 27, 2019 12:44 pm
by mol
I can create mysql db for testing if you want

Re: Check Web

Posted: Sun Jan 27, 2019 1:36 pm
by dragancesu
@serge

if your hosting can, but commercial hosting close connection outside localhost,
in this case program must call some.php with parameters and give result

it's like mol sample