Community discussions

MikroTik App
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

PHP MT Panel: PHP Based PPP Secrets Management System

Mon Sep 12, 2011 3:47 pm

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.
You do not have the required permissions to view the files attached to this post.
Last edited by mudasir on Thu Sep 15, 2011 11:14 am, edited 2 times in total.
Regards
Mudasir Mirza
http://www.diglinux.com
 
User avatar
aacable
Member
Member
Posts: 431
Joined: Wed Sep 17, 2008 11:58 am
Location: ISLAMIC Republic of PAKISTAN
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Tue Sep 13, 2011 8:28 am

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 :)

Thanks for sharing.
_____________
Regard's

Syed Jahanzaib
Web: http://aacable.wordpress.com
Email: aacable [at] hotmail.com
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24565
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Tue Sep 13, 2011 8:30 am

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
No answer to your question? How to write posts
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Tue Sep 13, 2011 9:23 am

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.
Regards
Mudasir Mirza
http://www.diglinux.com
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Tue Sep 13, 2011 9:29 am

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
Regards
Mudasir Mirza
http://www.diglinux.com
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Tue Sep 13, 2011 1:12 pm

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= ... vGlloKnGE=
Regards
Mudasir Mirza
http://www.diglinux.com
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24565
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Tue Sep 13, 2011 1:15 pm

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= ... vGlloKnGE=
you would have saved like 10 minutes of video time if you would just speak what you are typing there.
No answer to your question? How to write posts
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Tue Sep 13, 2011 1:19 pm

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.
Regards
Mudasir Mirza
http://www.diglinux.com
 
User avatar
aacable
Member
Member
Posts: 431
Joined: Wed Sep 17, 2008 11:58 am
Location: ISLAMIC Republic of PAKISTAN
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Wed Sep 14, 2011 9:19 am

Hi,
I have tested this. I did setup this panel for one of my clients.
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
Last edited by aacable on Wed Sep 14, 2011 10:25 am, edited 1 time in total.
_____________
Regard's

Syed Jahanzaib
Web: http://aacable.wordpress.com
Email: aacable [at] hotmail.com
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Wed Sep 14, 2011 9:24 am

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.
Regards
Mudasir Mirza
http://www.diglinux.com
 
User avatar
aacable
Member
Member
Posts: 431
Joined: Wed Sep 17, 2008 11:58 am
Location: ISLAMIC Republic of PAKISTAN
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Wed Sep 14, 2011 10:22 am

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
Last edited by aacable on Wed Sep 14, 2011 10:29 am, edited 1 time in total.
_____________
Regard's

Syed Jahanzaib
Web: http://aacable.wordpress.com
Email: aacable [at] hotmail.com
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Wed Sep 14, 2011 10:25 am

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.
Regards
Mudasir Mirza
http://www.diglinux.com
 
User avatar
aacable
Member
Member
Posts: 431
Joined: Wed Sep 17, 2008 11:58 am
Location: ISLAMIC Republic of PAKISTAN
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Wed Sep 14, 2011 10:31 am

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

Syed Jahanzaib
Web: http://aacable.wordpress.com
Email: aacable [at] hotmail.com
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Wed Sep 14, 2011 10:34 am

Which version of mikrotik are you using to test this.
Regards
Mudasir Mirza
http://www.diglinux.com
 
User avatar
aacable
Member
Member
Posts: 431
Joined: Wed Sep 17, 2008 11:58 am
Location: ISLAMIC Republic of PAKISTAN
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Wed Sep 14, 2011 10:41 am

Which version of mikrotik are you using to test this.
5.6
_____________
Regard's

Syed Jahanzaib
Web: http://aacable.wordpress.com
Email: aacable [at] hotmail.com
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Wed Sep 14, 2011 11:13 am

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".
Regards
Mudasir Mirza
http://www.diglinux.com
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6283
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Wed Sep 14, 2011 4:01 pm

what command exactly?
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Wed Sep 14, 2011 5:09 pm

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.
Regards
Mudasir Mirza
http://www.diglinux.com
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Thu Sep 15, 2011 1:47 am

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.
You do not have the required permissions to view the files attached to this post.
Regards
Mudasir Mirza
http://www.diglinux.com
 
User avatar
aacable
Member
Member
Posts: 431
Joined: Wed Sep 17, 2008 11:58 am
Location: ISLAMIC Republic of PAKISTAN
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Thu Sep 15, 2011 9:19 am

Adding profile options is working great. Now this panel is going in some Directions :D
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
_____________
Regard's

Syed Jahanzaib
Web: http://aacable.wordpress.com
Email: aacable [at] hotmail.com
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Thu Sep 15, 2011 11:07 am

Hi,

Thanks for pointing that out.

Attached in this post is the patch for that. The zip file only contains "functions.php", just replace current functions.php in folder "inc" nothing else needed be done.

I will try to add that Login authorization system as soon as I get time.

I have also updated the main MT Panel Zip attached in my first post with all the latest updates.
You do not have the required permissions to view the files attached to this post.
Regards
Mudasir Mirza
http://www.diglinux.com
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Fri Sep 16, 2011 12:35 pm

I think the app is not good enough...any ways...I thought that it might help few..
Regards
Mudasir Mirza
http://www.diglinux.com
 
Tiesto
just joined
Posts: 19
Joined: Fri Oct 14, 2011 1:18 pm
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Fri Oct 14, 2011 2:23 pm

Hi everybody.
Thanks for script which you create. But I have mikrotik version 2.9.6.
In script I cant create users.
I can create profile, its creating in MySQL and automatic creating in Mikrotik.
But, when I create user it also creating in MySQL, but NOT creating in Mikrotik.
When I create user in mikrotik in manual, it shows in script.
Helps me please, what is my problem.
I have Ubuntu Server 11.10 and Mikrotik 2.9.6
Thanks for all . . . )))
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Sat Nov 19, 2011 12:19 am

HI,

Dear to make it work with 2.9.6, I will have to re-write almost all the functions, as there are many things that got upgraded while moving from 2.9.X to 3.X and then moving from 3.X to 4.X...
So its better to upgrade.

If you want this to be ported, you will have to sponsor.
Regards
Mudasir Mirza
http://www.diglinux.com
 
MTM
just joined
Posts: 1
Joined: Tue Apr 17, 2012 1:58 pm

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Tue Apr 17, 2012 2:04 pm

Hi, :)
can i use WAMP server instead of LAMP,
because I'm using Windows 7?
 
Tiesto
just joined
Posts: 19
Joined: Fri Oct 14, 2011 1:18 pm
Contact:

PHP MT Panel: PHP Based PPP Secrets Management System

Thu Feb 28, 2013 9:49 am

Hi everybody! Hi Mudasir!
Mudasir, thanks for script. It is very good Mikrotik PPP scrtipt based on PHP. Use you script, I create my small billing system. I am added some functions. And I changed web interface form. And it is work very good. Thank you very much. I think it's a great project. Its first steps for something. Thanks.
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Thu Feb 28, 2013 10:31 am

Hi,

It will be great if you can share your work, so everyone can benifit from it.
I am glad that you like this system. I stopped working on this because I started working on something way cooler than this. Check out the link below

http://forum.mikrotik.com/viewtopic.php?f=2&t=69983

I am preparing a demo version which I will make public in couple of weeks.
Regards
Mudasir Mirza
http://www.diglinux.com
 
Tiesto
just joined
Posts: 19
Joined: Fri Oct 14, 2011 1:18 pm
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Fri Mar 01, 2013 10:01 am

OK, I will send email.
 
User avatar
samir494
Member Candidate
Member Candidate
Posts: 236
Joined: Thu Aug 06, 2009 11:27 am
Location: India

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Fri Mar 01, 2013 10:11 am

thumbs up buddy,

can is it possible to use with mikrotik usermangar ?
Mistry Samir
Unique and Different
India
9920670022

Give me more Karma
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Fri Mar 01, 2013 5:53 pm

HI,

Mikrotik UserManager and My system are both RADIUS based. You can use anyone of them at a time.
Regards
Mudasir Mirza
http://www.diglinux.com
 
mianfayyaz
just joined
Posts: 1
Joined: Wed Apr 30, 2014 2:36 am

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Wed Apr 30, 2014 2:48 am

can we use it with hotspot ?
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Wed Apr 30, 2014 9:48 am

Hi,

It is not designed to work with HotSpot. You can make changes in the functions to make it work for HotSpot.
Regards
Mudasir Mirza
http://www.diglinux.com
 
cbrewyet
just joined
Posts: 2
Joined: Wed Dec 09, 2015 6:47 pm

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Wed Dec 09, 2015 6:51 pm

Hi. Just stumbling upon this gem and I love what I see.

Will this work on ROS 6.33? I have it installed and configured but can't get it to connect to the MT. I keep seeing a "Login Failed" message flash on the page and I don't see any connection attemps in the log files of the MT. I've set up the conf.php file correctly and verified that I can ssh to it from a terminal on the machine that is running the site.
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Mon Dec 14, 2015 12:15 pm

Hi,

It's been years since I worked on this (and almost 3 years since I properly worked on any Mikrotik device). I am not sure if this can / will work on new version of Mikrotik RouterOS. The main reason I can think of is that it does not use API rather it uses simple (some not so simple) SSH commands.

It was just a part time project so I never gave it any serious considerations.

I can not say for sure why you are getting "Login failed" as now I don't have any way of helping you out.
Regards
Mudasir Mirza
http://www.diglinux.com
 
shkelqimkoka
just joined
Posts: 15
Joined: Thu Oct 05, 2017 7:32 am

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Fri Jul 27, 2018 7:35 pm

does this still works ?
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Mon Jul 30, 2018 5:43 am

This was posted almost 7 years back. I had no idea that even existed anymore.
Regards
Mudasir Mirza
http://www.diglinux.com
 
shkelqimkoka
just joined
Posts: 15
Joined: Thu Oct 05, 2017 7:32 am

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Mon Jul 30, 2018 10:26 am

This was posted almost 7 years back. I had no idea that even existed anymore.
yeah but its still useful, only needs some css and html
can you help me with something
I downloaded script and added it to xampp folder, edit the config and dbconnect but i have this error
"Notice: Cannot connect to . Error 0. Failed to parse address "" in C:\xampp\htdocs\mtpanel\inc\SSH2.php on line 649"
 
shkelqimkoka
just joined
Posts: 15
Joined: Thu Oct 05, 2017 7:32 am

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Mon Jul 30, 2018 6:29 pm

i figured out i had to authorize apache to create connections
anyone who's struggling making this script work and gets the same error find and change in your httpd
httpd_can_network_connect --> off
to
Windows Users using xampp or similar software
httpd_can_network_connect=1
Linux Users can use a tool called setsbool
setsebool -P httpd_can_network_connect=1
 
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
Joined: Tue Apr 29, 2008 3:38 am
Location: Karachi, Pakistan
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Mon Jul 30, 2018 6:32 pm

Thanks for the update on this.
Regards
Mudasir Mirza
http://www.diglinux.com
 
Tiesto
just joined
Posts: 19
Joined: Fri Oct 14, 2011 1:18 pm
Contact:

Re: PHP MT Panel: PHP Based PPP Secrets Management System

Fri Dec 27, 2019 12:25 am

Thanks for the update on this.
Last time you sade you working for new project for user radius. And you still working now?

Who is online

Users browsing this forum: luisfmolina and 50 guests