Moderators Kyle Posted August 22, 2011 Moderators Report Posted August 22, 2011 Hey Everyone, I wanted to let you guys know that I'm working on little nice module. Basically, what this module does that whenever you login, the date and time, your IP Address, and your client will be recorded. Here's a shot, you'll understand it. So, if you are viewing Pilot ID 1, then you will see Pilot 1's Login history. Same, You are viewing Pilot ID 2, then you will see Pilot 2's login history. This is niffy stuff! , it's working so damn well and highly useful, whenever you can get all IP Logs and ban your pilots. Here's how it works, In the Login, to Process Login, I have added a DataClass to grab the info when they login. But I'm working on a different way so it won't get overwritten in updates. However, it's almost custom and you would lose everything in the update. Don't worry, I'll try my best to get it working, and it won't get overwritten in updates. Also, I'll try my best to integrate a pagination so you wouldn't get a long long list of login. Lastly, I have to ask to anyone who keeps asking me when this will be released, I'll delay if you keep asking when it will be released. Give me time to do testing and making sure it works. If you have any questions about it, or any requests, let me know! I'll be putting this module to test on a live server later. I want to fill this niffy module in! 2 Quote
Jeff Posted August 22, 2011 Report Posted August 22, 2011 I like the way that you were able to get it set in the View Pilot (Admin Center), as I am constantly in there anyways. Jus ty a couple of questions for you Kyle. Is there a way to find out what page they most frequently visit, and how often they go there? I have a lot of pages, and I'd like to know if I need to keep some of them or just remove the pages if they aren't visiting them. Quote
Moderators Kyle Posted August 22, 2011 Author Moderators Report Posted August 22, 2011 I like the way that you were able to get it set in the View Pilot (Admin Center), as I am constantly in there anyways. Jus ty a couple of questions for you Kyle. Is there a way to find out what page they most frequently visit, and how often they go there? I have a lot of pages, and I'd like to know if I need to keep some of them or just remove the pages if they aren't visiting them. I would say you would need something like Page Visit Activity, Maybe on my next module I can look into it, later this year. I want to work on this module first and build it till it's good enough. Quote
Tom Posted August 22, 2011 Report Posted August 22, 2011 I like the way that you were able to get it set in the View Pilot (Admin Center), as I am constantly in there anyways. Jus ty a couple of questions for you Kyle. Is there a way to find out what page they most frequently visit, and how often they go there? I have a lot of pages, and I'd like to know if I need to keep some of them or just remove the pages if they aren't visiting them. You can use Google Analytics for that Quote
James142 Posted August 22, 2011 Report Posted August 22, 2011 This looks cool, can't wait for it to be released Quote
Moderators Kyle Posted August 22, 2011 Author Moderators Report Posted August 22, 2011 Update... Login History is Sorted by latest date first. Next, will be looking into getting the JSON Table into it, like you see in the schedules and pilot list. So you don't want a long list of history. God Knows that pilots log in everyday! Quote
Moderators Kyle Posted August 22, 2011 Author Moderators Report Posted August 22, 2011 Update, just got the JSON table all in! Now time to code the table in the module. It needs to grab the row info, from the module php file. I'll get into it, tonight. Sounds fun! 1 Quote
Moderators joeri Posted August 22, 2011 Moderators Report Posted August 22, 2011 Kyle when will you release na just joking looks nice maby 1 change i would sugest lose the (json) behind the text Quote
Moderators Kyle Posted August 22, 2011 Author Moderators Report Posted August 22, 2011 Kyle when will you release na just joking looks nice maby 1 change i would sugest lose the (json) behind the text Thanks, Yeah I will remove it till I can get the tables and rows working later tonight. Quote
MBrown Posted August 22, 2011 Report Posted August 22, 2011 Thanks, Yeah I will remove it till I can get the tables and rows working later tonight. Looks Really nice! Good job! Quote
Moderators mark1million Posted August 22, 2011 Moderators Report Posted August 22, 2011 Nice one, in another VA we can limit the initial display to the last 10 logins, can your module be called to the public pilot profile, the reason i ask is because i currently list some goodies in that tpl to admins only and this would sit nicely in there i think. Quote
Guest lorathon Posted August 23, 2011 Report Posted August 23, 2011 I have something similar to this. But I dont care about the browser what I cared about was pilots logging in with the same IP address. We have had problem pilots that come back with new names or have multiple accounts. The way I wrote it I can check the IP address against multiple logins. Quote
Moderators Kyle Posted August 23, 2011 Author Moderators Report Posted August 23, 2011 I have something similar to this. But I dont care about the browser what I cared about was pilots logging in with the same IP address. We have had problem pilots that come back with new names or have multiple accounts. The way I wrote it I can check the IP address against multiple logins. It just annoying when pilots join with different names or emails. It's always good to have an IP Address Tool to get these lying fools. Nice one, in another VA we can limit the initial display to the last 10 logins, can your module be called to the public pilot profile, the reason i ask is because i currently list some goodies in that tpl to admins only and this would sit nicely in there i think. Mark, I can take a look into it after I polish up the IP Login Module. You would have to add a Data.class, and get the IP by pilotid where you are looking at the profile, plus, some Admin Link serucity too. All, Update! I had to do some changes around. Since when you update phpVMS, you would lose this module. So I have changed and put the coding into a new module, however, for the PilotAdmin, I have removed the tab thing. So, I have created a one page that will use JSON to list all the login. Heck, JSON been a hard thing to work with, but I had fun learning it! I know, there are false and numbers, but I'm almost there. I have to add something that can grab by pilot id to get pilot ID with code and pilot names. It'll be easier for you guys to keep this in all one and you can search by IP, Name, Code. ETC. Quote
Moderators Kyle Posted August 23, 2011 Author Moderators Report Posted August 23, 2011 Need help here. So what I am trying to do, like JSON. The SQL query needs to be connected to the pilot tables. $sql = 'SELECT p.*, p.pilotid, p.firstname, p.lastname, FROM ' . TABLE_PREFIX . 'pilotlogins p LEFT JOIN ' . TABLE_PREFIX . 'pilots AS p ON p.pilotid = p.pilotid '; Does anyone know what I am doing wrong? Any help would be great! Thanks! Quote
Guest lorathon Posted August 23, 2011 Report Posted August 23, 2011 Try this. You can't use "p" twice. What is the pilotlogins table? Is that custom or part of a BETA? $sql = 'SELECT l.*, p.pilotid, p.firstname, p.lastname, FROM '.TABLE_PREFIX.'pilotlogins l LEFT JOIN '.TABLE_PREFIX.'pilots AS p ON p.pilotid = l.pilotid '; Quote
Moderators Kyle Posted August 23, 2011 Author Moderators Report Posted August 23, 2011 Try this. You can't use "p" twice. What is the pilotlogins table? Is that custom or part of a BETA? $sql = 'SELECT l.*, p.pilotid, p.firstname, p.lastname, FROM '.TABLE_PREFIX.'pilotlogins l LEFT JOIN '.TABLE_PREFIX.'pilots AS p ON p.pilotid = l.pilotid '; it's custom part, It's in phpvms_pilotlogins. And the code you gave me, it doesn't show all the logins. But I had it like this, and it works. $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'pilotlogins'; But with the JSON table and in the module file, I wanted to pull the data into Pilot Code, ID and their names.. I seen that you would have to join the tables to the pilots, so it can get it's data for pilot's first name, last name, and their pilot id. It's like the schedules JSON, like it gets the Aircraft info by id, ETC. Quote
Guest lorathon Posted August 23, 2011 Report Posted August 23, 2011 without see the structure of your custom table I am just shooring in the dark. Why the custom table? phpVMS_sessions has the session logs already. To query from the phpvms_sessions would be... $sql = 'SELECT s.*, p.* FROM '.TABLE_PREFIX.'sessions s LEFT JOIN '.TABLE_PREFIX.'pilots p ON p.pilotid = s.pilotid '; $ret = DB::get_results($sql); This will get the sessions rows joined with the pilot info (all of it) You will have to call the PilotData::getPilotCode($code, $pilotid) to get the properly formatted pilot code (PVA0002) If you have the pilotid column in your table then it would be $sql = 'SELECT l.*, p.* FROM '.TABLE_PREFIX.'pilotlogins l LEFT JOIN '.TABLE_PREFIX.'pilots p ON p.pilotid = l.pilotid '; $ret = DB::get_results($sql); This will get the pilotlogins rows joined with the pilot info (all of it) Quote
Moderators Kyle Posted August 24, 2011 Author Moderators Report Posted August 24, 2011 You will have to call the PilotData::getPilotCode($code, $pilotid) to get the properly formatted pilot code (PVA0002) If you have the pilotid column in your table then it would be $sql = 'SELECT l.*, p.* FROM '.TABLE_PREFIX.'pilotlogins l LEFT JOIN '.TABLE_PREFIX.'pilots p ON p.pilotid = l.pilotid '; $ret = DB::get_results($sql); This will get the pilotlogins rows joined with the pilot info (all of it) Yep! It works now. So, I have to name the prefix, and join the tables. But on the other side, I been looking though the pilotData.class to find a way to get the pilots name in by pilot id, I tried many ways to display the pilot's name, something like... $pilotname = PilotData::getPilotData($row->pilotid, $firstname, $lastname); But, it returned "ojectObject", somehow, I must be doing something wrong to parse the pilot's name by pilotid. And thanks for your help as well! Quote
Guest lorathon Posted August 24, 2011 Report Posted August 24, 2011 $sql = 'SELECT l.*, p.* FROM '.TABLE_PREFIX.'pilotlogins l LEFT JOIN '.TABLE_PREFIX.'pilots p ON p.pilotid = l.pilotid '; $ret = DB::get_results($sql); foreach($ret as $row) { $pilotcode = PilotData::getPilotCode($row->code, $row->pilotid); echo $pilotcode.' '.$row->firstname.' '.$row->lastname.'<br/>'; } Run this. It should give you a list of the pilot codes and firstname lastname (PVA0002 Jeffrey Kobus). Everything you need is in the results of the query. Quote
Moderators Kyle Posted August 24, 2011 Author Moderators Report Posted August 24, 2011 Little confused here, I putted the code you gave in my PilotLoginsData.class and it didn't give me all of the pilot logins. This is what my current sql query to get all of the login. $sql = 'SELECT l.*, p.* FROM '.TABLE_PREFIX.'pilotlogins l LEFT JOIN '.TABLE_PREFIX.'pilots p ON p.pilotid = l.pilotid '; $sql .= DB::build_where($params); if (strlen($order_by) > 0) { $sql .= ' ORDER BY ' . $order_by; } if (strlen($count) != 0) { $sql .= ' LIMIT ' . $count; } if (strlen($start) != 0) { $sql .= ' OFFSET ' . $start; } $ret = DB::get_results($sql); return $ret; Where should I be putting that code you gave me? Quote
Guest lorathon Posted August 24, 2011 Report Posted August 24, 2011 The code was just to show how to use the query results to retrieve the pilot code. If you are using json you will need to use this to add the pilot info to the json. Not the foreach but the PilotData::getPilotCode($code, $pilotid) function. If you send me the files I can finish it for you. Or post the json loop. Quote
Moderators Kyle Posted August 24, 2011 Author Moderators Report Posted August 24, 2011 The code was just to show how to use the query results to retrieve the pilot code. If you are using json you will need to use this to add the pilot info to the json. Not the foreach but the PilotData::getPilotCode($code, $pilotid) function. If you send me the files I can finish it for you. Or post the json loop. For the json loop, I believe this is what you need? # Add each row to the above array foreach ($pilotlogins as $row) { $pilotid = PilotData::getPilotCode($row->code, $row->pilotid); $tmp = array( 'id' => $row->id, 'cell' => array( # Each column, in order $row->id, $pilotid, $pilotname, $row->datestamp, $row->ip, $row->client, ), ); $json['rows'][] = $tmp; } Quote
Guest lorathon Posted August 24, 2011 Report Posted August 24, 2011 # Add each row to the above array foreach ($pilotlogins as $row) { $pilotid = PilotData::getPilotCode($row->code, $row->pilotid); $pilotname = $row->firstname.' '.$row->lastname; $tmp = array( 'id' => $row->id, 'cell' => array( # Each column, in order $row->id, $pilotid, $pilotname, $row->datestamp, $row->ip, $row->client, ), ); $json['rows'][] = $tmp; } If the $pilotlogins is filled correctly the above should add the pilot name as "FIRSTNAME LASTNAME". Quote
Moderators Kyle Posted August 24, 2011 Author Moderators Report Posted August 24, 2011 Now, it's working, I learned something new to deal with JSON tables! You have been a very big help here! Thanks for all of your help! All reps given in the posts. Quote
Moderators mark1million Posted August 24, 2011 Moderators Report Posted August 24, 2011 Do we have a release imminent then? Quote
Moderators Kyle Posted August 24, 2011 Author Moderators Report Posted August 24, 2011 Do we have a release imminent then? Soon, As we speak. I'm just finishing up with the JSON table, and then I have to gather the stuff around it, and then add one more data class that you requested to show in profile, then I want to give it a run on a live server to make sure it's working. I should have it out later tonight, or early time in phpVMS's timezone. 1 Quote
Administrators simpilot Posted August 29, 2011 Administrators Report Posted August 29, 2011 Nice work guys! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.