PHP MT Panel: PHP Based PPP Secrets Management System

Hi everyone,

I have created a very simple but a very useful PHP Based PPP Secrets Management System.

Currently following features are present in these scripts, more will be added if I get time.

1. Creating New User ( PPP->Secret + MySQL ).
2. Searching User ( this is only from MySQL ).
3. Show a list of all users ( PPP -> Secret ).
4. Delete User ( PPP->Secret + MySQL ).
5. Enable User ( PPP->Secret ).
6. Disable User ( PPP-> Secret ).
7. Change User Password ( PPP->Secret + MySQL), while changing old password is required.
8. Live Monitor Online Users ( PPP->Active Connections ).
9. Show User Stats ( Show Online Users Stats from Queue->Simple ).
10. Monitor Specific Users Stats.

It has a very simple look, which you can edit by creating your own custom CSS.

A sample snapshot is attached and also I am creating a Wiki page for the installation guide of this panel at
http://wiki.mikrotik.com/wiki/Basic_php_ppp_scripts

Please provide your valuable feedback regarding this application.
You can also add feature request to this panel.

Don’t forget to add Karma.

Attached is the latest ZIP as of 15th September 2011.
MT Panel v1.3.zip (133 KB)
mtpanle-overview.jpg

Great work !

I am using Webmin custom commands to control Mikrotik functions via ssh.
but using php its a bit easier to customize things for support purpose :slight_smile:

Thanks for sharing.

Looks great! Please report you findings when somebody tests this.

I have moved the WIKI article to a more specific name:
http://wiki.mikrotik.com/wiki/PHP_based_PPP_manager

Hi,

I have tested this. I did setup this panel for one of my clients.

Now I am working on a complete RADIUS Manager which is 100% based on PHP+AJAX+CSS and has many more features than this Panel.

But to be honest, I will not be sharing that for FREE.

I will also submit a Video tutorial on how to perform a proper setup of this Panel.

Hi,

@aacable

I have also written an article on how to setup a WebMin based Mikrotik Panel with some of the scripts that provide basic functionality to perform PPP User Management using SSH.
The article is at following URL http://wiki.mikrotik.com/wiki/Useful_Bash_Scripts

Hi,

I have uploaded a video tutorial on http://www.tiktube.com. It is under the evaluation process, the video is a complete installation guide of the application.

http://www.tiktube.com/index.php?video=CFeF3iJobCGqllnFLLEyCrovGlloKnGE=

you would have saved like 10 minutes of video time if you would just speak what you are typing there.

Hi,

Will keep that in mind next time…
Thanks.

Also if you think that the app is nice…you can also make this post sticky.

Dear Mudasir,

There is a mistake in your guide. The DB name is not matched in the SQL fields.
e.g: “mtpanel” “mtpanle”
Please make a correction.

mysql#create database mtpanel;
mysql#grant all on mtpanel.* to 'mtpanel'@'localhost' identified by 'mtpanel';
mysql#flush privileges;
mysql#use mtpanle;

Also this line is not working.

mysql#\. /var/www/mtpanel/mtpanel.sql;

Workaround was following line.

mysql -u root -p123 --database mtpanel < mtpanel.sql

Hi,

Yes that is just a spelling mistake, nothing else.

About the SQL import method that I have used. In my video tutorial, I have clearly mentioned that I am using a different method then specified in Wiki Article, because a MySQL library is required for that import method to work “libmysqlclient16” to be specific.

You can just perform “apt-get install libmysqlclient16” and then perform the import method specified in article, it will work.

I tried to create user via this php panel, but it didn’t created the user in MT. When I manually added 128k profile name’128’ in MT profiles, and tried to add the use, it succeed.

So If Package profile is not manually created in Mikrotik, this PHP panel will not add user.
Its better if it automatically create Package in MT, if its not already there.

Also I am getting following error in some I hit few functions like

‘users status’

expected closing brace (line 2 column 1)
syntax error (line 1 column 31)

‘Live monitor Users’

expected closing brace (line 2 column 1)
syntax error (line 1 column 31)
syntax error (line 1 column 27)

interrupted

Yes.

As the topic of the post sepcifies “PHP Based PPP Secrets Management System”.

This can be added as a feature request. Not much work is needed to be done for this..

Creating a profile is not that difficult, but for that you will also have to create an IP Pool, so that’s why I left it.

Anyhow this panel is great and one can have good ideas. Good work and keep it up :slight_smile:
Please update your WIKI article and mention these things in it so others may not face un-expected issues.

Which version of mikrotik are you using to test this.

5.6

Something is really weird.
The same function when being executed from Mikrotik CLI is showing proper results, but the same thing when being executed from remote SSH is giving errors.

I am working on this and by tonight I will update and remove errors and will also add the “Adding Profile Feature”.

what command exactly?

Hi,

The function that is being called on “User Stats” menu is

function user_stats()
        {
$ssh_command = ':global user
:global fname
:global lname
:global traffic
:global up
:global down
:foreach i in=[/queue simple find] do={
:set user [/queue simple get $i name]
:for m from=([:len $user]) to=0 do={:if ([:pick $user $m] = "-") do={:set fname ([:pick $user ($m+1) [:len $user]])}}
:for n from=([:len $fname]) to=0 do={:if ([:pick $fname $n] = ">") do={:set lname ([:pick $fname 0 $n])}}
:set traffic [/queue simple get $user bytes]
:for x from=([:len $traffic] - 1) to=0 do={:if ([:pick $traffic $x] = "/") do={:set up {[:pick $traffic 0 $x] / 1048576 }}}
:for y from=([:len $traffic]) to=0 do={:if ([:pick $traffic $y] = "/") do={:set down {[:pick $traffic ($y+1) [:len $traffic ]] / 1048576 }}}
:put "$lname\_\_\_\t\t ($down MB  -  $up MB)"}';
echo "<pre>";
echo "User ID                Download  -  Upload";
echo "<br><br>";
ssh_run($ssh_command);
echo "</pre>";
}

Now when I create a script in mikrotik and run the above mikrotik code, it works and shows queues with upload and download.
But When the code is being executed through the PHP SSH library, it is showing error on 5.X series, but is working fine on 3.X.
A bit confusing as I have tried many times.

Hi,

This is the first update which includes some bug fixes and a new feature to create PPP Profile.
I have update the code to work with v5.X but now its not working for v3.X. So I will not be updating this code to work for v3.X as that is very old.

Also I have added the Feature to create “Profile”.

The Zip file contains following file.

  1. inc/functions.php
  2. create_profile.php
  3. index.php
  4. create_user.php
  5. profile.sql

Just place these files in respective folders. The SQL file needs to be imported in the database.

mysql -u 'SUPERUSER' -p --database 'DATABASE NAME' < profile.sql

Only the Stats feature is not working for v3.X, all other should work fine.

It would be great if someone can share their findings on this.
update-1.zip (5.49 KB)

Adding profile options is working great. Now this panel is going in some Directions :smiley:
How about adding some security to this php panel for authorized access only?

‘Live monitor specific user’ is not working. its giving the following error.

:global list "";:foreach i in [/ppp active find ] do={:if ([:find [/ppp active get $i name] "999"]=0) do={:set list ($list . "," . $i)}};:foreach i in={$list} do={/interface monitor-traffic $list}

interrupted