Community discussions

MikroTik App
 
butteryak
newbie
Topic Author
Posts: 40
Joined: Fri Sep 12, 2008 1:16 am

Hotspot html changes

Fri Feb 12, 2010 7:30 am

Ok,
So I've been working on modifying the hotspot code to work for my situation. Basically the issue I was running into, was people closing their browser without logging off, thus the logoff popup dissapears, and if somone jumps in before the idle time is up, the previous user is still logged in.

:D I resolved this issue by modifying the code on the status popup to submit the "logoff" form, via a "onbeforeunload" with javascript. This worked fine, except, when the status page refreshes, it's seen as a window close and logs off the user.

:D I resolved that issue, by using frames for the popup, basically I split the status popup into two seperate html files one called statustable.html and the other statusform.html. And then calling them in status.html. status.html prints the two frames, and all is well.

This seems to work wonderfully for what I am doing.

:? Except for one thing I can't seem to figure out.

All the info shows up in the status window for the table, such as username,IP of user, time online. The thing that doesnt show is the bytes up/bytes down. it simply shows as 0/B and 0/B. and doesnt change even when the time seems to show increments. which is odd. I've been pouring over the code for a couple hours and cant' seem to see any particular errors. I find it odd that all the other information is showing except for bytes up/bytes down.

So perhaps I dont understand exactly how its supposed to work. perhaps for some reason the usage information is blocked from statustable.html and perhaps will only be passed to status.html.

Maybe somebody can give me some insite on what I should be looking at, or somethings to try to fix it. I would much appreciate it.

Other than that, it works really great. users hit the logoff button or close the browser without hitting "logoff" and they are logged off. seems to work well across all browsers, havnt seen any other glitches so far. I can live with it, but would realllly like to figure it out.

Thanks for any insights!!!

I"m using version 3.3
 
butteryak
newbie
Topic Author
Posts: 40
Joined: Fri Sep 12, 2008 1:16 am

Re: Hotspot html changes

Fri Feb 12, 2010 8:50 am

unless, of course there is a much easier way of doing what I am trying to do :)
 
butteryak
newbie
Topic Author
Posts: 40
Joined: Fri Sep 12, 2008 1:16 am

Re: Hotspot html changes

Sun Feb 14, 2010 1:42 am

figured it out.

I simply put the "statustable.html" in another folder, renamed it to status.html and it works.

Another bug that showed up, is if users time runs out. the bottem part of my status page (statusform.html) does not "refresh" and thus remains the "logoff" button, problem being, when the next user logs in, they are rejected, and have to enter login info twice(because the onbeforeunload is still there). I solved this by using some javascript in the top frame "table" to refresh into a simple logo after the person is timed out, and to open in the topmost window (using javascript, essentially a "break out of frame" script, which closes both frames, and creates one window again, thus closing the "form") this refreshes the popup to a simply company logo, which is automatically closed after 5 seconds, thus no more issue.

All works really well.

If anyone needs similar functionality, I would be glad to send you the html files.

B
 
surfergeek
newbie
Posts: 38
Joined: Thu Sep 03, 2009 9:34 pm

Re: Hotspot html changes

Sun Feb 14, 2010 7:12 am

Very slick work.
I'm having trouble simply getting back from the paypal site once a user purchases credit and should be able to log into hotspot with appropriate credits purchased.
I believe I've lost it in the transition from the login page to the usermanager. As, I've put a "purchase credit" button on the login page and can't figure how to authenticate either using mac addresses or?
I can easily give a call in user user name to associate with the appropriate profile.
Yet, I'd like to fully automate.
Long story, but, I"ve lost patience.
Suggestions?
Thanks,
Tim
 
butteryak
newbie
Topic Author
Posts: 40
Joined: Fri Sep 12, 2008 1:16 am

Re: Hotspot html changes

Sun Feb 14, 2010 9:49 am

Unfortunately, I do not have any experience with the user manager.......yet...

.I know it operates a bit differently than using the standard hospot user tables.
I have yet to see what sort of effect integrating the user manager has on what I have done. I think the user manager utilizes a different database than the standard database accessible via winbox, typically UM uses RADIUS authentication. As I'm still working with a "demo" key, I dont have access to RADIUS options as of yet, so usermanager is unusable for me. I wanted to see if I could make hotspot do what I needed it to do, before I commit financially. So mostly I've just been playing around, with the hotspot HTML, to see what it could do for me.

For the most part I may stick with simply creating prepaid tickets for people to purchase. Keep it simple.

Good luck to you. All I can say is stick with it. typically i find with some things I struggle with for days, is often a really silly easy fix. often i just need to walk away for a bit, and let it "fester" in my internal "background operations" and often the solution just sorta pops into my head.

B
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Hotspot html changes

Sun Feb 14, 2010 1:28 pm

@surfergeek: Have you considered opening the PayPal site in a different browser window? I would use "target=PayPal" in the link so the page goes to a different window, leaving the original login page intact.

I don't know how you set up your PayPal account, but the last post in this thread may be helpful.
http://forum.mikrotik.com/viewtopic.php?f=2&t=39084
 
surfergeek
newbie
Posts: 38
Joined: Thu Sep 03, 2009 9:34 pm

Re: Hotspot html changes

Mon Feb 15, 2010 9:44 am

Thanks guys,
All I want is to have the ability to let users buy time without intervention.
Butteryak, I'd like to have the ability to have users get online with or without contact.
SurferTim, Thanks for your insight. Your right, suggesting opening the paypal site from a different page.
I simply pasted the "purchase credit" button on my login page without considering the user manager.
I can easily create the link to "userman", but without creating a profile in "hotspot" how do I enable a dynamic abilty for users to just buy credits and become authenticated.
I know this might be a vague question.
So I don't expect a concise answer.
I wish there were possibly some typical "example scenario's " such as this to learn from on the WIKI.

I'm checking out the link you posted.
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Hotspot html changes

Mon Feb 15, 2010 12:49 pm

I think you need to send the users to the User Manager interface before sending them to PayPal. I must go through my RADIUS server webpages in order to include all the necessary account info so that Authorize.Net, or in your case PayPal, will know it is my merchant account, and which user gets credited with the purchase. Then Authorize.Net (or PayPal) will do all it needs to do after the purchase, including the call-back to the RADIUS server (User Manager is RADIUS). Otherwise, the time purchased will not get credited to the account automatically.

The wiki covers a lot of this:
http://wiki.mikrotik.com/wiki/User_Manager
 
surfergeek
newbie
Posts: 38
Joined: Thu Sep 03, 2009 9:34 pm

Re: Hotspot html changes

Mon Feb 15, 2010 11:07 pm

I think you need to send the users to the User Manager interface before sending them to PayPal. I must go through my RADIUS server webpages in order to include all the necessary account info so that Authorize.Net, or in your case PayPal, will know it is my merchant account, and which user gets credited with the purchase. Then Authorize.Net (or PayPal) will do all it needs to do after the purchase, including the call-back to the RADIUS server (User Manager is RADIUS). Otherwise, the time purchased will not get credited to the account automatically.

The wiki covers a lot of this:
http://wiki.mikrotik.com/wiki/User_Manager
Yes, I guess I had that understanding (need to go to usermanager previous to paypal). But did'nt state that clearly to you. Which is where the button links to.
"https://myhotspotpublicdomain.com/user.

When they get there. They have a blank username and password.

So, I guess the question is:
Should I give them a username and password in advance on the login page? Then they can change it after they login and buy credits?
Or can they be passed through without a username?

So, from my login page they have 2 choices.
1. Use "trial mode" good for an hour.
2. Purchase credit button
3. login

The 2nd option goes to: https://mypublicdomain.com/user

The 3rd option gets them online if they know the username and password. I have in "user" in Hotspot.

So, at this point, if they choose #2. They get to the "userman" page. They can buy credits from there and are then correctly sent to PayPal. Apparrantly paypal does not update usermanager.
Or i've got the wrong user configuration previous to this point which screws up the usermanager update from PayPal.
Hope I've explained the dilemna clearly.
If I could send you info to help, I'd appreciate it.
Thanks again.
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Hotspot html changes

Tue Feb 16, 2010 12:39 pm

My experience with User Manager indicates you must enter your users and passwords before they can buy time. That is why I don't use User Manager. My RADIUS server software creates the user account automatically as well.

ADD: I don't use PayPal either, but I have checked out the interface just in case. As I recall, you must set up the call-back function manually in the PayPal merchant account setup. And I think it only applies to business accounts unless their policy has changed.
 
surfergeek
newbie
Posts: 38
Joined: Thu Sep 03, 2009 9:34 pm

Re: Hotspot html changes

Wed Feb 17, 2010 7:00 am

My experience with User Manager indicates you must enter your users and passwords before they can buy time. That is why I don't use User Manager. My RADIUS server software creates the user account automatically as well.

ADD: I don't use PayPal either, but I have checked out the interface just in case. As I recall, you must set up the call-back function manually in the PayPal merchant account setup. And I think it only applies to business accounts unless their policy has changed.
Thanks for the help.
You don't need a business account with PayPal to make payments through this system.
It's too bad, but this User-Manager just isn't quite all there.
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26376
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: Hotspot html changes

Wed Feb 17, 2010 9:11 am

You can test the latest user manager beta, available in the UM section of this forum. It's developing very fast these last months.
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Hotspot html changes

Wed Feb 17, 2010 12:38 pm

Thanks, normis. I just checked out the wiki, and it shows your customers can create their own accounts now. That is new to me.

I just went to PayPal to check that out too. It looks like you still need a business account to integrate the call-back feature on your RADIUS server. Or am I wrong on that?
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26376
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: Hotspot html changes

Wed Feb 17, 2010 12:42 pm

Who is online

Users browsing this forum: Daguerdal, frog14, Google [Bot], GoogleOther [Bot], haung05, raiser, Rohllik28, Semrush [Bot] and 83 guests