2011-07-08, 10:16 AM
(2011-07-08, 10:12 AM)Tom K. Wrote: To my knowledge vb.net handles unix timestamps fineit just depends on your system time.
What I mean is that there's no simple function to create the current timestamp

(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)
that just gives me 1/01/1970 ?
That's the epoch

<?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();
}
?>