Apr 08 2018
Apr 08, 2018 Categorised in:

In this article I want to share an experience I had with one of my current projects I am working on. The project consists of a website with Surf Reports, live cameras and other tools for surfers. A very interesting project. I may come up with a case study later but for now I want to talk about one of the features I built for them and this is the Weather Alerts.

So, whenever there is any weather alert in the area then on the sidebar is pupping up a small red block like in the example below:

This was done using the National Weather Service API. I built a simple plugin for WP which calls this API and gets the data in a JSON format and then decode it using a native PHP function, json_decode.

Weather Alerts API documentation.

Aug 16 2017
Aug 16, 2017 Categorised in:

Are you curious about how you could hide your PHP file extension in URL? Let’s say you have an URL like this:

http://yourwebsite.com/user.php?user_id=4

In this URL you can see the PHP user.php file and the user_id variable. There is a way to hide them and modify your URL like this:

http://yourwebsite.com/profile/4

This is just an example but there are multiple ways you can change it. You can write anything you want in your URL.

Aug 06 2017
Aug 06, 2017 Categorised in:

Good day, dear programmers! Today’s tutorial is about PHP recursive functions. We will use the recursion to get the category tree from the database and show it on a web page as in the example below:

According to elated.com, recursion occurs when something contains, or uses, a similar version of itself. That similar version then contains or uses another similar version of itself, and so on. Sometimes this process can go on forever, such as when you hold 2 mirrors directly opposite each other, creating an infinite series of reflections. More often, though, the number of repetitions, or "depth" of the recursion, is limited by some sort of end condition. 

Jul 28 2017
Jul 28, 2017 Categorised in:

Hello! Welcome to another tutorial! Today we will build a Wordpress plugin. 

This plugin will remove the Wordpress News meta box from the dashboard. There is a video tutorial for this article. You can find it here.

To get started let's go to our plugins directory which is located in wp-content/plugins/.

In this folder we will create another folder and we will name it my-plugin. Open it and create a php file my-plugin.php and let’s paste there the following code:

<?php
/*
Plugin Name: My first plugin
PLugin URI: http://ruvictor.com
Description: This plugin will remove the meta box!
Author: Victor Rusu
Author URI: http://ruvictor.com
Version: 1
*/

So, you my say: “This is just a PHP comment”. Yes, it is a PHP comment but it is very important because Wordpress reads it. All the information from this PHP comment will appear on your dashboard where you have all your installed plugins.

Jul 02 2017
Jul 02, 2017 Categorised in:

From the previous tutorial we already have our files and functions we need for a login form. In this tutorial we will use the same code and we will add some more functions and files to set up a Cookie and filter the information entered by users.

If you didn’t watch the previous tutorial you can find it on YouTube.

Our config.php file stays the same as in the previous tutorial:

<?php
class Connection extends PDO
{
    public function __construct()
    {
        parent::__construct("mysql:host=localhost;dbname=tutorial", 'root', '',
		array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
        $this->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $this->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
    }
}
?>

 

Jun 26 2017
Jun 26, 2017 Categorised in:

Hello, everybody! Today we will talk about Login Forms for a website using PHP and AJAX. We will build a filter to secure the information from our form. Before we start, I want to let you know that this tutorial requires basic knowledge of HTML, CSS, PHP and JavaScript.

The first step will be to create a table in MySQL which will contain 4 columns: id, nickname, password and session. Here you have the SQL code to create a user table:

CREATE TABLE users (
    id int,
    nickname varchar(50),
    password varchar(100),
    session varchar(255),
    PRIMARY KEY (id)
);

If you use XAMPP you can find your phpMyAdmin using this link: http://localhost/phpmyadmin

Insert a new user using this SQL code:

INSERT INTO users (id, nickname, password)
VALUES (1, 'admin', 'admin123');

 

Page 1 of 1