SteemTools - Change Current Recovery With PHP. Tutorial - Part 7

Repository

https://github.com/nawab69/steemtools

What Will I Learn?

  • You will learn About steem account recovery
  • You will learn How to make PHP web tool
  • You will learn How to make a PHP site which will change current recovery account
  • You will learn How to use API

Requirements

  • Knowledge on PHP, HTML, Bootstrap, API
  • Php server
  • Bootstrap CDN
  • SteemConnect

Difficulty

  • Intermediate

IMG_20190217_194436_908.JPG
Hello Steemians,

I am Nawab. Last week an accident happened to me. So I didn't write any tutorial one week. Now I want to continue my steemtools php tutorial series. In this ongoing series, I have taught you to make some useful tools based on steemit in php language.

Here is the previous series -

Now I will teach you creating steemit account recovery tools. This tool has five part.

  1. Check current recovery account
  2. Change recovery Account ⭕
  3. Check recovery Request
  4. Request account Recovery
  5. Recover Account
    Yesterday I have taught you the first part. Today, I will teach you the second part.

Change Recovery Account

It is a tool which can change your recovery account using steemconnect. Follow the steps to make change recovery account

First, create a file changerecovery.php in the home directory. Then write down the below codes.

  • Include header file : include() is a PHP function. The Include() function is used to put data of one PHP file into another PHP file. If errors occur then the include() function produces a warning but does not stop the execution of the script i.e. the script will continue to execute.

The header file is not so important. So use this function.

<?php
include ('include/header.php'); // Include header file
include ('include/nav.php'); //Include navigation bar file 
?>

Username and recovery account input form:
For changing steem recovery account with steemconnect, You must input 2 data. These are-

  • Your steemit username.
  • New recovery account username.
    So, create a bootstrap form with two input box and a submit button.

<form action="" method="post" >

     <div class="form-group">
         <div class="input-group mb-2 mr-sm-2"> 
             <div class="input-group-prepend">
                <div class="input-group-text">@</div> 
             </div>         
              <input type="text" class="form-control" name="user" placeholder="Username">
          </div>
      </div>

      <div class="form-group">
           <div class="input-group mb-2 mr-sm-2"> 
                 <div class="input-group-prepend"> 
                      <div class="input-group-text">@</div>
                  </div> 
                 <input type="text" class="form-control" name="to" placeholder="Recovery Account">
              </div>
         </div>


        <div class="form-group">
            <button align="center" name="submit" class="btn btn-primary mb-2">Submit</button> 
         </div>
</form>

Php functions :Now you have to write some php functions to run the tool. These are-

  • Get data from HTML form using the POST method. Then store them in different variables.
<?php
if($_POST)
{
$from = $_POST["user"];   // username
$to = $_POST["to"];     // recovery account

Here if($_POST){} means when someone post using HTML form, all the functions inside {} will run.

  • Generate steemconnect URL :
    For changing recovery account steemconnect need 3 input. These are -
  1. account_to_recover: Your steem username.
  2. new_recovery_account : New recovery account username.
  3. extensions: I don't know what is it. But its default value is []

Write this code to make a steemconnect URL

$ext = "[]";  // extension
$api = "https://app.steemconnect.com/sign/change_recovery_account?account_to_recover=$from&new_recovery_account=$to&extensions=$ext";   // steemconnect Api

  • Redirect to steemconnect: Finally, you have to redirect to steemconnect URL for confirming the transaction.
header("Location: $api");   // redirect to steemconnect
}
?>

Include footer : Include your footer file

<?php
include ('include/footer.php');
  //include footer
?>

Download The file from github

Test the tool

Open the file using a browser. You will see this.
IMG_20190218_120318_101.JPG
Now input your username and new recovery account. Then click on submit.
IMG_20190218_120350_535.JPG
The browser will redirect to steemconnect. Input your username & password. Then confirm.
IMG_20190218_120414_131.JPG

Curriculum

Proof Of work done

https://github.com/nawab69/steemtools
https://steemtools.cf/changerecovery

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center