Unified Lanshop Owners Portal

Banner
Welcome, Guest
Username Password: Remember me

Php coding, need help :(
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Php coding, need help :(

Php coding, need help :( 1 year, 5 months ago #272829

radius_database = /sr/local/etc/raddb/users  //this is the record of all radius users 
cp_database = /var/db/captiveportal.db        //this is the record of logged-on clients

radius_user = count(radius_database)
cp_users = count(cp_database)

for i = 1 to len(radius_user)
	if radius_user[i][expiration] = today
		for ii = 1 to len(cp_users)
			if radius_user[i][username]=cp_users[ii][username]
				captiveportal_disconnect_client(cp_users[ii][userid])
			endif
		next ii
	endif
next i

close databases


note: captiveportal_disconnect_client calls a text argument and function is built-in into the system.

paki help naman po sa pagtranslate nito sa php code.

salamat po in advance.
  • cruzades
  • OFFLINE
  • Platinum Boarder
  • Posts: 3864

Re:Php coding, need help :( 1 year, 5 months ago #272838

cruzades wrote:
radius_database = /sr/local/etc/raddb/users  //this is the record of all radius users 
cp_database = /var/db/captiveportal.db        //this is the record of logged-on clients

radius_user = count(radius_database)
cp_users = count(cp_database)

for i = 1 to len(radius_user)
	if radius_user[i][expiration] = today
		for ii = 1 to len(cp_users)
			if radius_user[i][username]=cp_users[ii][username]
				captiveportal_disconnect_client(cp_users[ii][userid])
			endif
		next ii
	endif
next i

close databases


note: captiveportal_disconnect_client calls a text argument and function is built-in into the system.

paki help naman po sa pagtranslate nito sa php code.

salamat po in advance.


nosebleed ako master ang lupit mo ha ^_^

Re:Php coding, need help :( 1 year, 5 months ago #272841

Ano po radius server gamit mo?
  • Fuzzler
  • OFFLINE
  • Expert Boarder
  • Posts: 799

Re:Php coding, need help :( 1 year, 5 months ago #272842

@arch

pseudo code lang sir yan.

I can do it in VB, and xBase, kaya lang hindi sya adviceable sa *nix eh (pfsense in this matter), kaya need ko i-translate yan sa php (works with pfsense), very novie kasi ako sa php eh :(

anyway, ang objective ng code eh, to run as Cron job every 0000hrs para ma-auto disconnect yung mga wifi-clients ko (e.g. 1day-client).
  • cruzades
  • OFFLINE
  • Platinum Boarder
  • Posts: 3864

Re:Php coding, need help :( 1 year, 5 months ago #272843

Fuzzler wrote:
Ano po radius server gamit mo?


freeRadius sir, package ng pfsense.

I can optionally use the 'local database' kung hindi pwede sa radius database.
  • cruzades
  • OFFLINE
  • Platinum Boarder
  • Posts: 3864

Re:Php coding, need help :( 1 year, 5 months ago #272847

Sa pfsense po:

Hard timeout - Force a disconnect of all clients after the defined number of minutes.
  • Fuzzler
  • OFFLINE
  • Expert Boarder
  • Posts: 799

Re:Php coding, need help :( 1 year, 5 months ago #272850

Fuzzler wrote:
Sa pfsense po:

Hard timeout - Force a disconnect of all clients after the defined number of minutes.


I think this is not good for adik users, baka mairita lang sila. :(

ginamit ko na ito minsan, ayun.. everytime na lalabas ung captive portal page ko.. text agad sa akin.. "kuya.. captib na nanaman" :(
  • cruzades
  • OFFLINE
  • Platinum Boarder
  • Posts: 3864
Last Edit: 1 year, 5 months ago by cruzades.

Re:Php coding, need help :( 1 year, 5 months ago #272860

pahabol ko nga pala..

eto yung file structures


//format
//for users
//username User-Password == "password", Simultaneous-Use +=1, Expiration := "Mmm dd yyyy"

//for captiveportal.db
//accesstime,userid,ipaddress,macaddress,username ...


users_1 = explode(users,",")
users_2 = explode(users_1,":=")
date_of_expiration = users_2[x][1]

captiveporatal.db[x][1] = userid

now yung loop of comparition will be;

loop at the users database then check the Expiration compares with the current date
if date_of_expiration >= today //any function to extract today date into "Mmm dd yyyy" format will do.
then disconnect the client
  • cruzades
  • OFFLINE
  • Platinum Boarder
  • Posts: 3864
Last Edit: 1 year, 5 months ago by cruzades.
  • Page:
  • 1
Time to create page: 0.44 seconds

Sponsors


Get Your 10% Discount
Sign up for our exclusive monthly offers and get an instant 10% discount! REGISTER for this promo.

Printer Repairs Shop
Cubao Area and Sta Mesa. Short Lead Time. Guaranteed Work.

Wholesale Ink Supplies
Added Income. Best in market price. Continuous Ink System, Ink Refills, Photopapers.