Studio Gri Fare
-- epic emigration to Cyberland

Presentation Page About Armagan Tekdoner

Ending the Stateless State — PHP

<?php $ip = $_SERVER["HTTP_CLIENT_IP"]; ?>

redefined Server-side Scripting in 1994.

"Something was here a second ago but it disappeared when I refreshed the page," you say?

The response is "No man ever steps in the same river twice, for it's not the same river and he's not the same man," as Heraclitus put.

Geolocation and More: No Permission Required

The moment we request a web page, the host website is capable of collecting lots of information about us. Our physical location is just one them. This website has absolutely no interest in collecting data about any of its visitors; this section only displays how it is possible to gather a hell lot of info, even without requiring one single click or any sort of consent.
Nothing you see here is stored.

Hello friend from Ashburn / US
PHP thinks that your IP is: 18.97.9.174

Validations

WARNING: This study dates back to 2014 and is NOT usable today

Web is full of forms and we fill a hell lot of them while doing almost any online job.

When a website needs real credentials to process a request, it should make sure that no one enters unwanted/invalid characters in fields.

All input fields are prone to hacker attacks that generally take the form of malicious code injections. Input fields should be protected by what is referred to as validations to prevent the users from entering unwanted codes. For example, a field for the individual's name does not need to house 10,000 characters or any numbers. Validators, thanks to regular expressions, allow only the pre-defined types of entries. (It is also very important to beware of poorly constructed regular expressions which validate out the real credentials.)

A server-side validations exercise that does the validation after form submittal. Perhaps slow; but unlike JavaScript, PHP validations cannot be disabled.

This is an XHTML legacy form that can be customised by modifying plain text in the code files.

(The form above is being displayed in an iFrame, its original location is here. And its files that allow customisation have been made available here: DOWNLOAD)

Object-Oriented PHP

Here is a study using PHP classes. Codes are shown as well.

APIs: Servers Communicating with Servers

Many APIs certainly improve our lives.

However, I started to doubt whether creating original content still worths the effort, when John can easily display Bill's work on his page. Google has become the largest company on Earth only by displaying everything created on Earth, including the Earth itself; the only inventory the Facebook giant has, is made up of people who voluntarily make themselves its inventory; Amazon is the largest retailer with no stores; UBER has no taxis... This is hardly progress.

Anyway, here is an API for API's sake example: Google Blogger.

Name of the blog: Dummy Blog
Description of the blog: This is an experimentation blog.
Number of pages: 0
Number of posts: 3

Encoded and unformatted JSON data stored are:
{ "kind": "blogger#blog", "id": "405439155239204331", "name": "Dummy Blog", "description": "This is an experimentation blog.", "published": "2014-02-15T00:25:38-05:00", "updated": "2024-09-10T22:34:32-04:00", "url": "http://grifare.blogspot.com/", "selfLink": "https://www.googleapis.com/blogger/v3/blogs/405439155239204331", "posts": { "totalItems": 3, "selfLink": "https://www.googleapis.com/blogger/v3/blogs/405439155239204331/posts" }, "pages": { "totalItems": 0, "selfLink": "https://www.googleapis.com/blogger/v3/blogs/405439155239204331/pages" }, "locale": { "language": "en", "country": "GB", "variant": "" } }

The original location of the blog is at grifare.blogspot.ca

Display an external web page as if it is a part of this domain without using iframe

(See what the address bar reads when it opens)
The original location of the page is at Example Domain
Here is the code behind:


// displays the home page of example.com, as if it is a part of this domain

  // fopen — Opens file or URL
  $externalURL = fopen("https://example.com/", "rb");
  /* 
   * stream_get_contents — Reads remainder of a stream into a string
   * string stream_get_contents ( resource $handle [, int $maxlength = -1 [, int $offset = -1 ]] )
   * Identical to file_get_contents(), except that stream_get_contents() operates on an already open stream resource
   * and returns the remaining contents in a string, up to maxlength bytes and starting at the specified offset.
   */
  $externalURLContents = stream_get_contents($externalURL);

  print($externalURLContents);

JS and PHP Collaboration: Enjoy the Puzzle

Screenshot of the puzzle exercise
The above-linked APP lets you upload an image and converts it into a puzzle.