Tips and tutorials

How to pre-populate a new record with data passed through the url?

In some cases, you might have frequent data entries with some common values. This can be made faster and more efficient using specially formatted shortcut links.

How to completely hide the membership system, making every user an admin?

This scenario is useful mainly if you are the only user of the generated AppGini app, and don't want to have to sign in every now and then, and want to remove the 'visual clutter' of the admin link, sign out link, .. etc.

Warning The following code basically makes every user a super admin. So, NEVER use this in a public-facing or multi-user app!

Protect your app login page from brute force attacks using reCAPTCHA

The code in this tutorial was tested on AppGini 22.13 and 22.14

A common problem facing all websites is malicious 'bots', automated scripts designed to "efficiently" perform harmful actions to websites. These include posting spam in forums, signing up with fake accounts (usually to post spam), trying to hack legit accounts by making thousands of password guesses in login forms (also known as brute force attacks), .. etc.

How to automatically detect the country of a user?

Using the free API service provided by ipinfo.io, you can add code into hooks for detecting the country of the current user, given his IP address. Here is how this code looks like:

  $country = 'Unknown'; // default in case country can't be detected
  $ip = $_SERVER['REMOTE_ADDR'];
  $udata_json = @file_get_contents("https://ipinfo.io/{$ip}");
  if($udata_json){
    $udata = json_decode($udata_json, true);
    $country = $udata['country'];
  }
  // you can now use $country in your code ...

Here is a demonstration that shows your country!

Your country is Unknown

Country info retrieved from this service is ISO Alpha-2 abbreviation.

Using lookup fields in calculations


When customizing the before_insert, after_insert, before_update or after_update hooks to make a calculation, you might encounter a case where one or more fields in the formula you're calculating is a lookup field (foreign key). In this case, the value of $data['fieldname'] (where fieldname is the name of the concerned lookup field) is probably NOT the value you'd like to use for your calculation.

Step by step: hosting your AppGini application on Bluehost


Bluehost is a widely-used website hosting service that offers a friendly interface and good technical support at a reasonable price. Due to its popularity, we've wrote this detailed page describing step-by-step how to publish your AppGini-generated web application there.

Download free open source web applications


All the applications listed here are MIT-licensed free open source web applications generated by AppGini. You can easily customize them by editing the source code, or by editing the accompanying project files in AppGini (both the trial and full version of AppGini can be used).

Install AppGini on Ubuntu Linux

Mac users heads up! You can follow very similar steps to install AppGini on MacOS using PlayOnMac :)

Although AppGini officially runs on Windows PCs, you can still install it on your Linux or Mac by following the steps listed here.

How to obtain a Google Maps API key?

TLDR; To enable Google Maps support in your AppGini apps, you need to enable Maps Embed API and Maps Static API in your Google Cloud console, create an API key and copy it to AppGini.

Obtaining a Google API key can be quite challenging due to the complex, ever-changing interface of Google Cloud console. So, we are listing the specific steps in detail to get you started quickly.

Following are the steps to obtain a Google Maps API key (last updated October 22, 2019).

Creating an auto-updating balance field


In the Online Inventory Management application, the items table has a balance column (see the screenshot below) that keeps track of the current inventory balance for each item. It gets updated automatically whenever a transaction is made. Outgoing transactions decrease the item balance, while incoming transaction increase it.

Syndicate content