I am trying to get user like the url 'http://127.0.0.1/cake2/rd_cake/permanent_users/index.json'. the only problem with this URL is it retuns all the permanent user account. what i need is only the spesific user. how can i do that? is there any URL to do that and please also give me and example how to do the request. because i have tried the URL 'http://10.253.0.2/cake2/rd_cake/permanent_users/view_basic_info.json' but not returning any result.
thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, i havent tried it. could you give me an example what is the parameter to sent to that url?.
I Tried To access that url and give me error conection refused.
Last edit: nicko surya pratama 2019-06-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, i havent tried it. could you give me an example what is the parameter to sent to that url?
I Tried To access that url and give me error conection refused.
Last edit: nicko surya pratama 2019-06-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Nana.
To get the users stats is quite easy. You can grab the data in the background using jquery for instance and update the stats on a stats page how you like. I have wrote some code for this and will post below. To send an email alert based on data useage would involve some programming to read the field in the table that holds the data used and trigger an email based on the threshold that you set. You could setup a cron to check the usage at intervals, send an email when data usage exceeded and update a field that the email was sent.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Nana.
To get the users stats is quite easy. You can grab the data in the
background using jquery for instance and update the stats on a stats page
how you like. I have wrote some code for this and will post below. To send
an email alert based on data useage would involve some programming to read
the field in the table that holds the data used and trigger an email based
on the threshold that you set. You could setup a cron to check the usage at
intervals, send an email when data usage exceeded and update a field that
the email was sent.
This webpage can be used as a 'stats' page. It looks at the session usage shown on the Dynamic Login Pages in the background and allows a custom stats display.
It's little crude and needs improvements but you get the idea.
<?phpfunctiondb_conn(){$host='localhost';$user='';$password='';$database='';$pdoOptions=array(PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION,PDO::ATTR_EMULATE_PREPARES=>false);//Connectreturn$conn=newPDO("mysql:host=$host;dbname=$database",$user,$password,$pdoOptions);}functionfilterVar($data)// Sanitise POST & GET variables{$data=filter_var(filter_var($data,FILTER_SANITIZE_MAGIC_QUOTES),FILTER_SANITIZE_STRING);$data=stripslashes($data);return$data;}functiongetNas($nasid){$stmt=db_conn()->prepare("SELECT nas.nas_unique, nas.nas_location FROM nas WHERE nas.nas_unique = :nasid AND nas.nas_live = '1'");$stmt->bindValue(':nasid',filterVar($nasid));$stmt->execute();$row=$stmt->fetch();return$row;}functiongetLocation($locid)// location id from nas{$stmt=db_conn()->prepare("SELECT locations.loc_about, locations.loc_unique, locations.loc_user, locations.loc_name FROM locations WHERE locations.loc_id = :locid");$stmt->bindValue(':locid',filterVar($locid));$stmt->execute();$row=$stmt->fetch();return$row;}$nas=filterVar($_GET['nas']);$login_url="http://YOUR-URL-HERE/cake3/rd_cake/dynamic-details/chilli-browser-detect/?";$login_url.="voucher=TESTVOUCHER";foreach($_GETas$key=>$value){$login_url.="&".filterVar($key)."=".filterVar($value);}?><!DOCTYPEhtml><htmlclass="loading"lang="en"data-textdirection="ltr"><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge"><metaname="viewport"content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui"><title>UserLogin-guestWiFi</title><linkhref="http://fonts.googleapis.com/icon?family=Material+Icons"rel="stylesheet"><linkrel="stylesheet"href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"></head><bodyclass="horizontal-layout page-header-light horizontal-menu 1-column login-bg blank-page blank-page"data-open="click"data-menu="horizontal-menu"data-col="1-column"><divclass="row"><divclass="col s12"><divclass="container"><divid="login-page"class="row"><divclass="col s12 m6 l4 z-depth-4 card-panel border-radius-6 login-card bg-opacity-8"><formclass="login-form"><divclass="row"><divclass="input-field col s12"><h6class="flow-text">GuestWiFi</h6><noscript>YoudonothaveJavascriptenabled.Thispagewillnotwork!</noscript><?phpif($_GET['nas']==""){// if a hotspot?><h5class="red-text flow-text">NotaHotspot</h5><?php}?><h5class="flow-text"><?phpechogetLocation(getNas($nas)['nas_location'])['loc_name'];?></h5><spanclass="flow-text"><?phpechogetLocation(getNas($nas)['nas_location'])['loc_about'];?></span></div></div><divid="loginbox"><divclass="row margin"><divclass="input-field col s12"><iclass="material-icons prefix pt-2">confirmation_number</i><inputid="voucher"type="text"><labelfor="voucher"class="center-align">Voucher</label></div></div><divclass="row"><divclass="input-field col s12"><aid="login"class="btn waves-effect waves-light border-round gradient-45deg-purple-deep-orange col s12">Login</a><br><br><divclass="progress hide"><divclass="indeterminate"></div></div></div></div></div><divid="sessionbox"class="center hide"><h5><iclass="material-icons medium">lock</i> <b>You are logged in</b></h5><spanclass="flow-text">Session:</span> GUEST</span><br><spanclass="flow-text">DataIn:</span> <span id="datain" class="flow-text"></span><br><spanclass="flow-text">DataOut:</span> <span id="dataout" class="flow-text"></span><br><aid="logout"href="http://logout"class="btn waves-effect waves-light border-round gradient-45deg-purple-deep-orange col s12">Logout</a><spanclass="flow-text black-text">Keepthissessioninfowindowopen</span><ahref="https://google.co.uk"target="_blank"class="btn waves-effect waves-light border-round gradient-45deg-purple-deep-orange col s12">Opennewwindow</a><br></div><iframeid="loginframe"src=""style="width:0;height:0;border:0; border:none;"></iframe></form></div></div></div></div></div><scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script><script>loginstatus();$("#login").click(function(){M.toast({html:'Logging in'});$('#login').addClass('disabled');$('#loginframe').attr('src','<?php echo $login_url; ?>');$('.progress').removeClass('hide');$('.progress').show();setTimeout(function(){loginstatus();},4000);setTimeout(function(){$('#login').removeClass('disabled');$('.progress').hide();},5000);});functionloginstatus() {$.ajax({type:'POST',url:'http://NAS-IP-HERE:3990/json/status',dataType:'jsonp'}).done(function(data){console.log(data['clientState']);//console.log(data['session']['userName']);if(data['clientState']==0){$('#loginbox').show();$('#sessionbox').hide();}else{$('#loginbox').hide();$('.progress').hide();$('#sessionbox').removeClass('hide');$('#sessionbox').show();$('#vouchercode').text(data['session']['userName']);$('#datain').text(formatBytes(data['accounting']['inputOctets']));$('#dataout').text(formatBytes(data['accounting']['outputOctets']));}}).fail(function(){console.log("Network Error!");});};functionformatBytes(bytes,decimals=2){if(bytes===0)return'0 Bytes';constk=1024;constdm=decimals<0?0 : decimals;constsizes=['Bytes','KB','MB','GB','TB','PB','EB','ZB','YB'];consti=Math.floor(Math.log(bytes)/Math.log(k));returnparseFloat((bytes/Math.pow(k,i)).toFixed(dm))+' '+sizes[i];}setInterval(loginstatus,20000);$("#logout").click(function(){M.toast({html:'Logging out'});$('#loginframe').attr('src','');$('#login').removeClass('disabled');console.log("Log out");});</script></body></html>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello Davies,
I'm still not able to allow the users to see their data usage and session. Do I have to copy the script above and import into my systems?
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
I created a php file in the login / rd_client folder and pasted this content with the database data
but I have not had any success
How should I place this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to get user like the url 'http://127.0.0.1/cake2/rd_cake/permanent_users/index.json'. the only problem with this URL is it retuns all the permanent user account. what i need is only the spesific user. how can i do that? is there any URL to do that and please also give me and example how to do the request. because i have tried the URL 'http://10.253.0.2/cake2/rd_cake/permanent_users/view_basic_info.json' but not returning any result.
thanks
Hi. Have you tried http://10.253.0.2:3990/json/status
That will give you the session stats that your looking for..
No, i havent tried it. could you give me an example what is the parameter to sent to that url?.
I Tried To access that url and give me error conection refused.
Last edit: nicko surya pratama 2019-06-14
No, i havent tried it. could you give me an example what is the parameter to sent to that url?
I Tried To access that url and give me error conection refused.
Last edit: nicko surya pratama 2019-06-14
I might be misunderstanding. Are you trying to view user stats when logged into the portal?
Last edit: Stephen Davies 2019-06-14
no. i want to see the user password. so if i forget my login password i can see it by sending my username to radiusdesk API. i use this url http://127.0.0.1/cake2/rd_cake/permanent_users/view_password.json but no luck.
Hello Stephen, How do I create url for the user to check is stats or alert him by email when the data is almost finished
Hi Nana.
To get the users stats is quite easy. You can grab the data in the background using jquery for instance and update the stats on a stats page how you like. I have wrote some code for this and will post below. To send an email alert based on data useage would involve some programming to read the field in the table that holds the data used and trigger an email based on the threshold that you set. You could setup a cron to check the usage at intervals, send an email when data usage exceeded and update a field that the email was sent.
Many thanks. I will look into it and get back to you.
Thanks
On Tue, 9 Jul 2019 at 15:49, Stephen Davies bargee@users.sourceforge.net
wrote:
This webpage can be used as a 'stats' page. It looks at the session usage shown on the Dynamic Login Pages in the background and allows a custom stats display.
It's little crude and needs improvements but you get the idea.
Hello Davies,
I'm still not able to allow the users to see their data usage and session. Do I have to copy the script above and import into my systems?
Thanks.
Hi
I created a php file in the login / rd_client folder and pasted this content with the database data
but I have not had any success
How should I place this?