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

in #utopian-io5 years ago

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.
(html comment removed:  Form start Here )
<form action="" method="post" >
(html comment removed:  Username Input box )
     <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>
(html comment removed:  Recovery Account Input Box)
      <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>

(html comment removed:  Submit Button )
        <div class="form-group">
            <button align="center" name="submit" class="btn btn-primary mb-2">Submit</button> 
         </div>
</form>
(html comment removed:  End 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

Sort:  

Thank you for your contribution @nawab69.
After analyzing your tutorial we suggest the following points listed below:

  • Using the first person in the tutorials makes it difficult to understand the tutorials. We suggest using the third person in your text.

  • You need to explain more the steps you take in your tutorial. The tutorial is meant to explain, so the ideal is to explain as much as possible for the readers to realize well what you are teaching.

Looking forward to your upcoming tutorials.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Chat with us on Discord.

[utopian-moderator]

Thank you for your review, @portugalcoin! Keep up the good work!

Congratulations @nawab69! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You made more than 50 upvotes. Your next target is to reach 100 upvotes.

Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do not miss the last post from @steemitboard:

Valentine challenge - Love is in the air!

Support SteemitBoard's project! Vote for its witness and get one more award!

Hey, @nawab69!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!