Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Group php script
#37
(2011-07-08, 10:12 AM)Tom K. Wrote: To my knowledge vb.net handles unix timestamps fine Smile it just depends on your system time.

What I mean is that there's no simple function to create the current timestamp Wink There's also the epoch difference between unix and windows.

(2011-07-08, 10:14 AM)SergeMorel Wrote:
(2011-07-08, 10:06 AM)Tom K. Wrote: Serge, to convert the timestamp use this:


Dim joindate As Double = 'INSERT TIMESTAMP HERE
‘Setup a new DateTime starting at Jan 1st 1970.
Dim joindateFormatted As New DateTime(1970, 1, 1)
‘
‘Then just add the Unix value to the DateTime variable as seconds.
joindateFormatted = joindateFormatted.AddSeconds(joindate)

Smile

that just gives me 1/01/1970 ?

That's the epoch Wink I'm converting the timestamps to dates for you in the below script:


<?php
header ("Content-Type:text/xml"); 
define("IN_MYBB", 1);
require_once "./global.php";
require_once "./inc/functions_time.php";

if($mybb->input['username'])
{
	$user = $db->simple_select("users", "*", "username='".$mybb->input['username']."'");
	$user = $db->fetch_array($user);
	$usergroupcache = $cache->read("usergroups");
	
	$doc = new DOMDocument();
	$doc->formatOutput = true;

	$u = $doc->createElement("user");
	$doc->appendChild($u);
	
	$uid = $doc->createElement("uid");
	$uid->appendChild($doc->createTextNode($user['uid']));
	
	$name = $doc->createElement("username");
	$name->appendChild($doc->createTextNode($user['username']));
	
	$usertitle = $doc->createElement("usertitle");
	$usertitle->appendChild($doc->createTextNode($user['usertitle']));
	
	$postcount = $doc->createElement("postcount");
	$postcount->appendChild($doc->createTextNode($user['postnum']));
	
	$usergroup = $doc->createElement("usergroup");
	$usergroup->appendChild($doc->createTextNode($usergroupcache[$user['usergroup']]['title']));
	
	$joindate = $doc->createElement("joindate");
	$joindate->appendChild($doc->createTextNode(my_date($mybb->settings['dateformat'], $user['regdate'])));
	
	$numthreads = $db->simple_select("threads", "COUNT(tid) as count", "uid = ".$user['uid']);
	$numthreads = $db->fetch_field($numthreads, "count");
	$postedthreads = $doc->createElement("totalthreads");
	$postedthreads->appendChild($doc->createTextNode($numthreads));
	
	$referred = $doc->createElement("referred");
	$referred->appendChild($doc->createTextNode($user['referrals']));
	
	$timesearch = TIME_NOW - $mybb->settings['wolcutoffmins']*60;
	$query = $db->simple_select("sessions", "location,nopermission", "uid='".$user['uid']."' AND time>'".$timesearch."'", array('order_by' => 'time', 'order_dir' => 'DESC', 'limit' => 1));
	$session = $db->fetch_array($query);
	
	if ($db->num_rows($query) == 0)
	{
		$onlinestatustext = "Offline";
	}
	else
	{
		require_once MYBB_ROOT."inc/functions_online.php";
		$lang->load("online");
		$location = fetch_wol_activity($session['location'], $session['nopermission']);
		$location = build_friendly_wol_location($location);
		$onlinestatustext = "Online - ".strip_tags($location);
	}
	
	$status = $doc->createElement("onlinestatus");
	$status->appendChild($doc->createTextNode($onlinestatustext));
	
	$lastvisit = $doc->createElement("lastvisit");
	$lastvisit->appendChild($doc->createTextNode(my_date($mybb->settings['dateformat'], $user['lastvisit'])));
	
	$u->appendChild($uid);
	$u->appendChild($name);
	$u->appendChild($usertitle);
	$u->appendChild($postcount);
	$u->appendChild($usergroup);
	$u->appendChild($joindate);
	$u->appendChild($postedthreads);
	$u->appendChild($referred);
	$u->appendChild($status);
	$u->appendChild($lastvisit);
	
	echo $doc->saveXML();
}
?>


Messages In This Thread
Group php script - by SergeMorel - 2011-07-06, 09:12 AM
RE: Group php script - by kavin - 2011-07-06, 10:15 AM
RE: Group php script - by SergeMorel - 2011-07-06, 11:02 AM
RE: Group php script - by SergeMorel - 2011-07-07, 11:26 AM
RE: Group php script - by Nelson Noa - 2011-07-07, 07:00 PM
RE: Group php script - by Bit 'n Bang - 2011-07-07, 07:23 PM
RE: Group php script - by SergeMorel - 2011-07-07, 08:55 PM
RE: Group php script - by Nathan Malcolm - 2011-07-07, 09:19 PM
RE: Group php script - by Paul H. - 2011-07-07, 09:23 PM
RE: Group php script - by SergeMorel - 2011-07-07, 09:32 PM
RE: Group php script - by Tom K. - 2011-07-07, 09:34 PM
RE: Group php script - by SergeMorel - 2011-07-07, 09:41 PM
RE: Group php script - by Tom K. - 2011-07-07, 10:02 PM
RE: Group php script - by Euan T - 2011-07-08, 07:10 AM
RE: Group php script - by Tom K. - 2011-07-08, 07:19 AM
RE: Group php script - by SergeMorel - 2011-07-08, 07:58 AM
RE: Group php script - by Euan T - 2011-07-08, 08:17 AM
RE: Group php script - by SergeMorel - 2011-07-08, 08:23 AM
RE: Group php script - by Euan T - 2011-07-08, 08:28 AM
RE: Group php script - by SergeMorel - 2011-07-08, 08:33 AM
RE: Group php script - by Euan T - 2011-07-08, 08:42 AM
RE: Group php script - by SergeMorel - 2011-07-08, 08:44 AM
RE: Group php script - by Euan T - 2011-07-08, 09:12 AM
RE: Group php script - by SergeMorel - 2011-07-08, 09:20 AM
RE: Group php script - by Euan T - 2011-07-08, 09:25 AM
RE: Group php script - by SergeMorel - 2011-07-08, 09:33 AM
RE: Group php script - by Euan T - 2011-07-08, 09:38 AM
RE: Group php script - by SergeMorel - 2011-07-08, 09:42 AM
RE: Group php script - by Euan T - 2011-07-08, 09:44 AM
RE: Group php script - by SergeMorel - 2011-07-08, 09:46 AM
RE: Group php script - by Euan T - 2011-07-08, 09:47 AM
RE: Group php script - by SergeMorel - 2011-07-08, 09:57 AM
RE: Group php script - by Tom K. - 2011-07-08, 10:06 AM
RE: Group php script - by SergeMorel - 2011-07-08, 10:14 AM
RE: Group php script - by Euan T - 2011-07-08, 10:16 AM
RE: Group php script - by Euan T - 2011-07-08, 10:07 AM
RE: Group php script - by Tom K. - 2011-07-08, 10:12 AM
RE: Group php script - by Tom K. - 2011-07-08, 10:18 AM
RE: Group php script - by SergeMorel - 2011-07-08, 10:22 AM
RE: Group php script - by Euan T - 2011-07-08, 10:25 AM
RE: Group php script - by SergeMorel - 2011-07-08, 10:28 AM
RE: Group php script - by Tom K. - 2011-07-08, 10:31 AM
RE: Group php script - by SergeMorel - 2011-07-08, 10:34 AM
RE: Group php script - by Tom K. - 2011-07-08, 10:56 AM
RE: Group php script - by SergeMorel - 2011-07-08, 11:28 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)