create account

[Steemconnect + Php] Withdraw Vesting Routes Changing System build by PHP & STEEMCONNECT - part 3 by nawab69

View this thread on: hive.blogpeakd.comecency.com
· @nawab69 ·
$10.83
[Steemconnect + Php] Withdraw Vesting Routes Changing System build by PHP & STEEMCONNECT - part 3
### Repository

https://github.com/nawab69/steemtools

### What will you learn-

- You will learn how to use SteemConnect

- You will learn about Steemconnect
- You will learn how to check withdraw routes
- You will learn how to create a php application

### Requirements

- Web Hosting
- Text Editor
- knowledge on php,  JSON & html

### Difficulty

- Intermediate

### Description 

Hello everybody, I am Nawab. A full stack web developer in opensource community. Currently I am working on a project. My project is teaching everybody  about app development. I am not good in English Language. I am living in  UK from five years. Please forgive me if I write any grammatical errors.

In my previous tutorial you have learned how to check withdraw Routes using Php + SteemJs
  
Today I will teach you 2nd part of these tutorial. 

If someone want to power down his steem power to another steemit account, he/she should use this system. This is not visible to steemit.com .  You can use the system by SteemJS API & STEEMCONNECT.

- You can check your current withdraw vesting route by  SteemJS API
- You can change your current withdraw vesting route by STEEMCONNECT API



![](https://d1vof77qrk4l5q.cloudfront.net/img/674faad008fc5944ac0910f87b982ea69626aff4.jpg)


#### Tutorial

First create ``change.php`` file. Use any HTML & CSS template in your page to look better. I use basic bootstrap template.

First, Include the header and the navigation bar template file. 
```
<?php

/* Include header file */

include ('include/header.php');

/* Include navigation bar file */

include ('include/nav.php');
?>
```
If you want to change your withdraw route,  you have to input 4 data. These are-

- From Account 
- To Account
- Percentage
- Auto Vest

So  Create a Form with "post" methood.

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

</form>

```

Inside the form create 4 form input box.

| Sn No | Input        | Type   | Name    |
|:-----:|--------------|--------|---------|
| 1     | FROM ACCOUNT | text   | user    |
| 2     | TO ACCOUNT   | text   | to      |
| 3     | PERCRNTAGE   | range  | percent |
| 4     | AUTO VEST    | select | auto    |

##### FROM ACCOUNT
This input box  for input own username. Write down this code inside form tag.

```
<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" id="inlineFormInputGroupUsername2" placeholder="Username"> </div> </div>
```

##### TO ACCOUNT

This input box  for input own username. Write down this code after  "FROM ACCOUNT" input text 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" id="inlineFormInputGroupUsername2" placeholder="Withdraw To"> </div> </div>
```

##### PERCENTAGE

It is a range input type. It use for changing percentage of withdraw route.
Write down this code after  "TO ACCOUNT" input box.

```
<label for="customRange3">Percentage </label> <input name="percent" type="range" class="custom-range" min="0" max="10000" step="500" id="customRange3">
```

##### AUTO VEST
It is a select input type. It use for select any option from popup. I use here true & false option. Write down this code after "Percentage" Range input box.

```
<label class="my-1 mr-2" for="inlineFormCustomSelectPref">Auto Vest</label> <select name="auto" class="custom-select my-1 mr-sm-2" id="inlineFormCustomSelectPref"> <option selected>Choose...</option> <option value="true">True</option> <option value="false">False</option>  </select> 
```
Now the form building has completed. But it won't work. We need to create some php function to run this form.

#####  Submit button



#### Create Php function

```
<?php

if($_POST)

{

$from = $_POST["user"];   // store username from Form using post method

$to = $_POST["to"];     // store withdraw to username from Form using post method

$percent = $_POST["percent"];  // store percentage from Form using post method

$auto = $_POST["auto"]; //   store auto vest boolean from Form using post method
}
?>
```
Write this code after the form close tag. 
I used here "if" condition statement. If anyone post using the form, all the function inside the "{}" will run. I have created 4 variables, they will store input data from form.

Now write the bellow code,

```
$api = "https://steemconnect.com/sign/set_withdraw_vesting_route?from_account=$from&to_account=$to&percent=$percent&auto_vest=$auto";   // steemconnect Api for changing withdraw routes

header("Location: $api");   // redirect to steemconnect

```
Here we create a variable named "$api " and write the api.
For changing Withdraw Route,  STEEMCONNECT API is, ``https://steemconnect.com/sign/set_withdraw_vesting_route``. This API has four parameters.  These are -
- from_account
- to_account
- percent
- auto_vest

I have written their value in variables. 
When a user insert data in form and submit. These data will store in variables. These variables will use as different parameter's value.

Finally redirect users to STEEMCONNECT by this line  `` header("Location: $api"); ``

Now insert footer and save the file.

### How to work

First browse the file from server. This window will open.



![](https://d1vof77qrk4l5q.cloudfront.net/img/674faad008fc5944ac0910f87b982ea69626aff4.jpg)



Insert all data.  For example, I use 

> username = @nawab69  
   withdraw to = @utopian-io
   percentage = max(10000)
   auto vest = false


![](https://d1vof77qrk4l5q.cloudfront.net/img/a2c9a4f6cdb9b96d92ce7c4e2b20d12b12abfc92.jpg)


Then press the submit button.

Site will redirect to steemconnect. Check your input data. If its correct, press the submit button.


![](https://d1vof77qrk4l5q.cloudfront.net/img/1f3332c62ef3aa169ad61cebf8bba944358eb27e.jpg)


Steemconnect ask you  username & password. Fill them and Sign in. The withdraw vesting routes will change.



![](https://d1vof77qrk4l5q.cloudfront.net/img/07780acffef07c59075548bcf882349074f3776f.jpg)



Here is the full codes of my tutorial
```
<?php

/* Include header file */

include ('include/header.php');

/* Include navigation bar file */

include ('include/nav.php');

?>

<div class="container">
<br>
<br>

<div class="card"> 

<h5 class="card-header">Add / change Withdraw Vesting Route</h5>

<div class="card-body"> 
<center>

<!-- Form start Here -->

      <form action="" method="post" >
      
<!-- 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" id="inlineFormInputGroupUsername2" placeholder="Username"> </div> </div>
      
<!-- Withdraw To 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" id="inlineFormInputGroupUsername2" placeholder="Withdraw To"> </div> </div>
      
      
<!-- Parcentage Range Input box -->

<label for="customRange3">Percentage </label> <input name="percent" type="range" class="custom-range" min="0" max="10000" step="500" id="customRange3">

<!-- Auto Vesting Withdraw select box -->

<label class="my-1 mr-2" for="inlineFormCustomSelectPref">Auto Vest</label> <select name="auto" class="custom-select my-1 mr-sm-2" id="inlineFormCustomSelectPref"> <option selected>Choose...</option> <option value="true">True</option> <option value="false">False</option>  </select> 

<br>

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

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

<!-- End form -->
  

</div> </center></div>

<!-- Php function start Here -->

<?php

if($_POST)

{

$from = $_POST["user"];   // store username from Form using post method

$to = $_POST["to"];     // store withdraw to username from Form using post method

$percent = $_POST["percent"];  // store percentage from Form using post method

$auto = $_POST["auto"]; //   store auto vest boolian from Form using post method

$api = "https://steemconnect.com/sign/set_withdraw_vesting_route?from_account=$from&to_account=$to&percent=$percent&auto_vest=$auto";   // steemconnect Api for changing withdraw routes

header("Location: $api");   // redirect to steemconnect

}
?>

</div>
<nav class="navbar fixed-bottom navbar-dark bg-dark"> <p align="center" style="color:#fff;"> This tools created by <b>@nawab69 </b></p> </nav>

<?php

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

```

### Curriculum

[[ Php + SteemJs Api ] Steembased Web Application Building Tutorial - Part-1 (steem stats)](https://steemit.com/utopian-io/@nawab69/php-steemjs-api-steembased-web-application-building-tutorial-part-1-steem-stats)

[[Php + SteemJs API] Withdraw Routes Check Application building Tutorial - Part-2](https://steemit.com/utopian-io/@nawab69/steemjs-api-php-build-a-php-application-for-showing-withdraw-routes-part2-2xlbelgp)

### Prove of work done

https://github.com/nawab69/steemtools/blob/master/change.php

http://steemtools.html-5.me/change.php

Posted using [Partiko Android](https://steemit.com/@partiko-android)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 16 others
properties (23)
authornawab69
permlinksteemconnect-php-withdraw-vesting-routes-changing-system-build-by-php-steemconnect-part-3-nb1tlbp7
categoryutopian-io
json_metadata{"tags":["utopian-io","tutorials","development","steemit","partiko"],"image":["https://d1vof77qrk4l5q.cloudfront.net/img/674faad008fc5944ac0910f87b982ea69626aff4.jpg"],"app":"partiko"}
created2019-01-26 16:22:45
last_update2019-01-26 16:22:45
depth0
children5
last_payout2019-02-02 16:22:45
cashout_time1969-12-31 23:59:59
total_payout_value8.185 HBD
curator_payout_value2.648 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length9,615
author_reputation6,544,308,216,591
root_title"[Steemconnect + Php] Withdraw Vesting Routes Changing System build by PHP & STEEMCONNECT - part 3"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id78,972,143
net_rshares21,914,815,146,547
author_curate_reward""
vote details (80)
@portugalcoin ·
$11.04
Thank you for your contribution @nawab69.
After analyzing your tutorial we suggest the following points listed below:

- Nice work on the explanations of your code, although adding a bit more comments to the code can be helpful as well.

- In your code there are blank lines, which makes it harder to read the code.

![1.png](https://cdn.steemitimages.com/DQmTYpwULCXvyLDA72hc8r3fUdmvBoD4xEVnCumLcEQsjVk/1.png)

- Before publishing your tutorial check if everything was correct, in your contribution there is an image that was left to load due to the source of the image being wrong:

![2.png](https://cdn.steemitimages.com/DQmdN2ukbMbVwzXpmxf25yZwrhsTSCbMmM41QyrCCzBwXtq/2.png)

- Nice work on the explanations of your code, although adding a bit more comments to the code can be helpful as well.

- Indent your code. <a href="https://en.wikipedia.org/wiki/Indentation_style">Link</a>

- Improve the structure of your tutorial.

Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/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](https://review.utopian.io/result/8/3-2-3-1-3-2-3-3-).

---- 
Need help? Chat with us on [Discord](https://discord.gg/uTyJkNm).

[[utopian-moderator]](https://join.utopian.io/)
👍  , , , , , , , , , , , , , , , , , ,
properties (23)
authorportugalcoin
permlinkre-nawab69-steemconnect-php-withdraw-vesting-routes-changing-system-build-by-php-steemconnect-part-3-nb1tlbp7-20190126t170813126z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["nawab69"],"image":["https://cdn.steemitimages.com/DQmTYpwULCXvyLDA72hc8r3fUdmvBoD4xEVnCumLcEQsjVk/1.png","https://cdn.steemitimages.com/DQmdN2ukbMbVwzXpmxf25yZwrhsTSCbMmM41QyrCCzBwXtq/2.png"],"links":["https://en.wikipedia.org/wiki/Indentation_style","https://join.utopian.io/guidelines","https://review.utopian.io/result/8/3-2-3-1-3-2-3-3-","https://discord.gg/uTyJkNm","https://join.utopian.io/"],"app":"steemit/0.1"}
created2019-01-26 17:08:12
last_update2019-01-26 17:08:12
depth1
children1
last_payout2019-02-02 17:08:12
cashout_time1969-12-31 23:59:59
total_payout_value8.351 HBD
curator_payout_value2.684 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,380
author_reputation599,460,589,822,571
root_title"[Steemconnect + Php] Withdraw Vesting Routes Changing System build by PHP & STEEMCONNECT - part 3"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id78,974,313
net_rshares22,348,513,698,472
author_curate_reward""
vote details (19)
@utopian-io ·
Thank you for your review, @portugalcoin! Keep up the good work!
properties (22)
authorutopian-io
permlinkre-re-nawab69-steemconnect-php-withdraw-vesting-routes-changing-system-build-by-php-steemconnect-part-3-nb1tlbp7-20190126t170813126z-20190129t120541z
categoryutopian-io
json_metadata"{"app": "beem/0.20.17"}"
created2019-01-29 12:05:42
last_update2019-01-29 12:05:42
depth2
children0
last_payout2019-02-05 12:05:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length64
author_reputation152,955,367,999,756
root_title"[Steemconnect + Php] Withdraw Vesting Routes Changing System build by PHP & STEEMCONNECT - part 3"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id79,104,230
net_rshares0
@steem-ua ·
#### Hi @nawab69!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
**Feel free to join our [@steem-ua Discord server](https://discord.gg/KpBNYGz)**
properties (22)
authorsteem-ua
permlinkre-steemconnect-php-withdraw-vesting-routes-changing-system-build-by-php-steemconnect-part-3-nb1tlbp7-20190126t171007z
categoryutopian-io
json_metadata"{"app": "beem/0.20.14"}"
created2019-01-26 17:10:09
last_update2019-01-26 17:10:09
depth1
children0
last_payout2019-02-02 17:10:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length286
author_reputation23,214,230,978,060
root_title"[Steemconnect + Php] Withdraw Vesting Routes Changing System build by PHP & STEEMCONNECT - part 3"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id78,974,407
net_rshares0
@steemitboard ·
Congratulations @nawab69! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

<table><tr><td>https://steemitimages.com/60x70/http://steemitboard.com/@nawab69/posts.png?201901261735</td><td>You published more than 10 posts. Your next target is to reach 20 posts.</td></tr>
</table>

<sub>_[Click here to view your Board](https://steemitboard.com/@nawab69)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>


To support your work, I also upvoted your post!


> Support [SteemitBoard's project](https://steemit.com/@steemitboard)! **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-nawab69-20190126t191417000z
categoryutopian-io
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2019-01-26 19:14:15
last_update2019-01-26 19:14:15
depth1
children0
last_payout2019-02-02 19:14:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length790
author_reputation38,975,615,169,260
root_title"[Steemconnect + Php] Withdraw Vesting Routes Changing System build by PHP & STEEMCONNECT - part 3"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id78,980,306
net_rshares0
@utopian-io ·
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](https://chrome.google.com/webstore/detail/steemplus/mjbkjgcplmaneajhcbegoffkedeankaj?hl=en) or [Steeditor](https://steeditor.app)).

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

<a href='https://steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
properties (22)
authorutopian-io
permlinkre-steemconnect-php-withdraw-vesting-routes-changing-system-build-by-php-steemconnect-part-3-nb1tlbp7-20190127t133114z
categoryutopian-io
json_metadata"{"app": "beem/0.20.17"}"
created2019-01-27 13:31:15
last_update2019-01-27 13:31:15
depth1
children0
last_payout2019-02-03 13:31:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length589
author_reputation152,955,367,999,756
root_title"[Steemconnect + Php] Withdraw Vesting Routes Changing System build by PHP & STEEMCONNECT - part 3"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id79,012,314
net_rshares0