function validate()
{
    global $INTERNAL, $GROUPS, $RESPONSE, $CONFIG, $LZLANG;
    if (DB_CONNECTION || SERVERSETUP) {
        if (isset($_POST[POST_INTERN_AUTHENTICATION_USERID]) && isset($_POST[POST_INTERN_AUTHENTICATION_PASSWORD])) {
            foreach ($INTERNAL as $sysId => $internuser) {
                if (strtolower($internuser->UserId) == strtolower($_POST[POST_INTERN_AUTHENTICATION_USERID])) {
                    if ($internuser->SaveLoginAttempt(md5($_POST[POST_INTERN_AUTHENTICATION_PASSWORD]))) {
                        if (LOGIN || SERVERSETUP) {
                            $internuser->LoadPassword();
                        }
                        if ($internuser->Password == md5($_POST[POST_INTERN_AUTHENTICATION_PASSWORD])) {
                            define("CALLER_SYSTEM_ID", $sysId);
                            $internuser->DeleteLoginAttempts();
                            $internuser->LoadPredefinedMessages($sysId, false);
                            if (isset($_POST[POST_INTERN_NEW_PASSWORD])) {
                                $INTERNAL[CALLER_SYSTEM_ID]->ChangePassword($_POST[POST_INTERN_NEW_PASSWORD]);
                            }
                            if (LOGIN && !SERVERSETUP) {
                                if ($internuser->LastActive > time() - $CONFIG["timeout_clients"] && !empty($internuser->LoginId) && $_POST[POST_INTERN_AUTHENTICATION_LOGINID] != $internuser->LoginId) {
                                    define("AUTH_RESULT", LOGIN_REPLY_ALREADY_ONLINE);
                                    break;
                                } else {
                                    if ($internuser->IsPasswordChangeNeeded()) {
                                        define("AUTH_RESULT", LOGIN_REPLY_CHANGE_PASS);
                                        break;
                                    }
                                }
                            } else {
                                if (!LOGIN && !SERVERSETUP && !empty($internuser->LastActive) && $internuser->LastActive < time() - $CONFIG["timeout_clients"]) {
                                    define("AUTH_RESULT", LOGIN_REPLY_BAD_COMBINATION);
                                    break;
                                } else {
                                    if (SERVERSETUP && $internuser->Level != USER_LEVEL_ADMIN) {
                                        define("AUTH_RESULT", LOGIN_REPLY_NOADMIN);
                                        break;
                                    }
                                }
                            }
                            define("VALIDATED", true);
                            if (!LOGOFF && isset($_POST[POST_INTERN_AUTHENTICATION_LOGINID])) {
                                $internuser->LoginId = $_POST[POST_INTERN_AUTHENTICATION_LOGINID];
                            } elseif (LOGOFF) {
                                $internuser->LoginId = null;
                            }
                            define("AUTH_RESULT", LOGIN_REPLY_SUCCEEDED);
                            break;
                        } else {
                            if ($internuser->LastActive < time() - $CONFIG["timeout_clients"]) {
                                $internuser->Destroy();
                            }
                            break;
                        }
                    }
                }
            }
        }
    } else {
        define("AUTH_RESULT", LOGIN_REPLY_DB);
    }
    if (defined("VALIDATED") && LOGIN) {
        $INTERNAL[CALLER_SYSTEM_ID]->IP = getIP();
        $INTERNAL[CALLER_SYSTEM_ID]->FirstActive = time();
        $INTERNAL[CALLER_SYSTEM_ID]->VisitorFileSizes = array();
        $INTERNAL[CALLER_SYSTEM_ID]->VisitorStaticReload = array();
        $RESPONSE->Login = $INTERNAL[CALLER_SYSTEM_ID]->GetLoginReply($GROUPS[$INTERNAL[CALLER_SYSTEM_ID]->Groups[0]]->IsExternal, getTimeDifference($_POST[POST_INTERN_CLIENT_TIME]));
    }
    if (!defined("AUTH_RESULT")) {
        define("AUTH_RESULT", LOGIN_REPLY_BAD_COMBINATION);
    }
}
Exemplo n.º 2
0
 $class = '';
 $from = strtotime($task['from_time']);
 $to = strtotime($task['to_time']);
 if (date('Y-m-d', $from) != $day) {
     //Some tasks may start the day before.
     $from = strtotime("{$day} 00:00:00");
     //Set the starting point as today midnight.
 }
 if ($task['to_time'] == '0000-00-00 00:00:00') {
     //Active Task.
     $class .= 'active ';
     $to = time();
 }
 $left = getTimePercentage($from);
 $width = time2percent(0, ($to - $from) / 60);
 list($hour_difference, $minute_difference) = getTimeDifference($from, $to);
 if ($minute_difference < 3 and $hour_difference == 0) {
     continue;
 }
 //Too small as task to list(or its a accidental click)
 $from_time = date('h:i a', $from);
 $to_time = date('h:i a', $to);
 if ($width < 4) {
     $class .= 'small ';
 }
 $todays_tasks[] = array('class' => $class, 'left' => $left, 'width' => $width, 'name' => $task['name'], 'from_time' => $from_time, 'to_time' => $to_time, 'hour_difference' => $hour_difference, 'minute_difference' => $minute_difference);
 // Find the total time taken for each task.
 $task_id = $task['id'];
 if (!isset($tasks_aggregate[$task_id])) {
     //Initalize the array if its not created before
     $tasks_aggregate[$task_id] = array('task_id' => $task_id, 'name' => $task['name'], 'total_hour' => 0, 'total_minute' => 0, 'duration_id' => $task['duration_id']);
Exemplo n.º 3
0
	{
		$dayStamp = mktime(0, 0, 0, $month, $day+$i, $year);
		$ss = $manager->getDaysSessions($uId, $dayStamp);
		$sessions = DcUnitConverter::convertSessions($ss, $distUnit, $timeUnit);
	
		$content = "";
		$dayDist = 0;
		$numSessions = count($sessions);
		for ($j=0; $j<$numSessions; $j++)
		{
			$session = $sessions[$j];
			$ts = strtotime($session->startTime);
			$dateFrmtd = date("g:ia", $ts);
			$sTime = $session->startTime;
			$eTime = $session->endTime;
			$diff = getTimeDifference($sTime, $eTime);
			$totalTime['hours'] += $diff['hours'];
			$totalTime['minutes'] += $diff['minutes'];
			$totalTime['seconds'] += $diff['seconds'];
			$totalVel += $session->averageVelocity;
			$totalDist += $session->distance;
			$dayDist += $session->distance;
		}		
		if ($numSessions > 0)
		{
			$content .= "<div class=\"monthDayDist\">";
			//$content .= $dateFrmtd.": <a href=\"viewSession.php?s=";
			$content .= "<br/><a href=\"day.php?u=".$uId."&t=";
			$content .= $dayStamp."\">".number_format($dayDist,2)."</a> ".$distUnit." in ";
			$content .= $numSessions . " sessions. </div>";
				
function validate($_basic = false)
{
    global $INTERNAL, $GROUPS, $RESPONSE, $CONFIG, $CM;
    if (!empty($CONFIG["gl_rhts"]) && getScheme() != SCHEME_HTTP_SECURE) {
        define("AUTH_RESULT", LOGIN_REPLY_HTTPS);
    } else {
        if (DB_CONNECTION || SERVERSETUP) {
            if (!empty($_POST[POST_INTERN_AUTHENTICATION_USERID]) && !empty($_POST[POST_INTERN_AUTHENTICATION_PASSWORD])) {
                foreach ($INTERNAL as $sysId => $operator) {
                    if (strtolower($operator->UserId) == strtolower($_POST[POST_INTERN_AUTHENTICATION_USERID])) {
                        if ($operator->ValidateLoginAttempt()) {
                            if (!empty($operator->Password) && ($operator->Password == md5($_POST[POST_INTERN_AUTHENTICATION_PASSWORD]) || sha1($operator->Password) == $_POST[POST_INTERN_AUTHENTICATION_PASSWORD])) {
                                define("CALLER_SYSTEM_ID", $sysId);
                                if ($_basic) {
                                    define("VALIDATED", true);
                                    return;
                                }
                                if (!empty($CM)) {
                                    $operator->LoadUnCacheables();
                                }
                                if (isset($_POST[POST_INTERN_NEW_PASSWORD])) {
                                    $INTERNAL[CALLER_SYSTEM_ID]->ChangePassword($_POST[POST_INTERN_NEW_PASSWORD], true, true);
                                    $RESPONSE->Authentications = "<val userid=\"" . base64_encode(CALLER_SYSTEM_ID) . "\" pass=\"" . base64_encode($_POST[POST_INTERN_NEW_PASSWORD]) . "\" />\r\n";
                                }
                                if (empty($_POST["p_db_no_req"]) && !DB_CONNECTION) {
                                    define("AUTH_RESULT", LOGIN_REPLY_DB);
                                    break;
                                }
                                if (!LOGIN && !SERVERSETUP) {
                                    if ($operator->Deactivated) {
                                        define("AUTH_RESULT", LOGIN_REPLY_ACCOUNT_DEACTIVATED);
                                        break;
                                    }
                                    if (!$operator->ClientWeb && $operator->LastActive < time() - $CONFIG["timeout_clients"] && $_POST[POST_INTERN_AUTHENTICATION_LOGINID] == $operator->LoginId) {
                                        define("AUTH_RESULT", LOGIN_REPLY_SESSION_TIMEOUT);
                                        break;
                                    }
                                    if ($operator->SignOffRequest || !empty($_POST["p_app_device_id"]) && $operator->AppDeviceId != "LOGIN" && $operator->AppDeviceId != $_POST["p_app_device_id"]) {
                                        $operator->SignOff(false);
                                        define("AUTH_RESULT", LOGIN_REPLY_SIGN_OFF_REQUEST);
                                        break;
                                    }
                                    if (!empty($operator->LoginId) && !empty($_POST[POST_INTERN_AUTHENTICATION_LOGINID]) && $_POST[POST_INTERN_AUTHENTICATION_LOGINID] != $operator->LoginId) {
                                        define("AUTH_RESULT", LOGIN_REPLY_BAD_COMBINATION);
                                        break;
                                    }
                                } else {
                                    if (LOGIN && !SERVERSETUP) {
                                        $operator->AppClient = !empty($_POST["p_app"]);
                                        $operator->ClientWeb = !empty($_POST["p_web"]);
                                        if (($operator->AppClient || $operator->ClientWeb) && $operator->GetPermission(45, PERMISSION_FULL) == PERMISSION_NONE) {
                                            define("AUTH_RESULT", LOGIN_REPLY_NO_MOBILE_ACCESS);
                                            break;
                                        } else {
                                            if ($operator->Deactivated) {
                                                define("AUTH_RESULT", LOGIN_REPLY_ACCOUNT_DEACTIVATED);
                                                break;
                                            } else {
                                                if ($operator->SignOffRequest) {
                                                    $operator->SignOff(false);
                                                    define("AUTH_RESULT", LOGIN_REPLY_SIGN_OFF_REQUEST);
                                                    break;
                                                } else {
                                                    if (empty($_POST[POST_INTERN_IGNORE_SIGNED_ON]) && $operator->LastActive > time() - $CONFIG["timeout_clients"] && !empty($operator->LoginId) && $_POST[POST_INTERN_AUTHENTICATION_LOGINID] != $operator->LoginId) {
                                                        define("AUTH_RESULT", LOGIN_REPLY_ALREADY_ONLINE);
                                                        break;
                                                    } else {
                                                        if ($operator->PasswordChangeRequest) {
                                                            define("AUTH_RESULT", LOGIN_REPLY_CHANGE_PASS);
                                                            break;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    } else {
                                        if (SERVERSETUP && $operator->Level != USER_LEVEL_ADMIN) {
                                            if (!(in_array($CONFIG["gl_host"], $operator->WebsitesUsers) && !empty($_POST[POST_INTERN_GET_MANAGEMENT])) && !(in_array($CONFIG["gl_host"], $operator->WebsitesConfig) && empty($_POST[POST_INTERN_GET_MANAGEMENT]))) {
                                                define("AUTH_RESULT", LOGIN_REPLY_NOADMIN);
                                                break;
                                            }
                                        }
                                    }
                                }
                                define("VALIDATED", true);
                                if (!LOGOFF && isset($_POST[POST_INTERN_AUTHENTICATION_LOGINID])) {
                                    $operator->LoginId = $_POST[POST_INTERN_AUTHENTICATION_LOGINID];
                                } elseif (LOGOFF) {
                                    $operator->LoginId = null;
                                }
                                define("AUTH_RESULT", LOGIN_REPLY_SUCCEEDED);
                                break;
                            } else {
                                $operator->DeleteLoginAttempts();
                                $operator->SaveLoginAttempt(md5($_POST[POST_INTERN_AUTHENTICATION_PASSWORD]));
                                break;
                            }
                        }
                    }
                }
            }
        } else {
            define("AUTH_RESULT", LOGIN_REPLY_DB);
        }
    }
    if (isValidated() && LOGIN) {
        $INTERNAL[CALLER_SYSTEM_ID]->IP = getIP();
        $INTERNAL[CALLER_SYSTEM_ID]->FirstActive = time();
        $INTERNAL[CALLER_SYSTEM_ID]->VisitorFileSizes = array();
        $INTERNAL[CALLER_SYSTEM_ID]->VisitorStaticReload = array();
        $isex = !empty($INTERNAL[CALLER_SYSTEM_ID]->Groups) && $GROUPS[$INTERNAL[CALLER_SYSTEM_ID]->Groups[0]]->IsExternal;
        $RESPONSE->Login = $INTERNAL[CALLER_SYSTEM_ID]->GetLoginReply($isex, getTimeDifference($_POST[POST_INTERN_CLIENT_TIME]));
    }
    if (!defined("AUTH_RESULT")) {
        define("AUTH_RESULT", LOGIN_REPLY_BAD_COMBINATION);
    }
}
Exemplo n.º 5
0
                    $color = "yellow";
                } else {
                    if ($itemmember['status'] == "I") {
                        $color = "red";
                    } else {
                        $color = "#55FF55";
                    }
                }
                $sdate = $itemmember['starttime'];
                $edate = $itemmember['endtime'];
                $weekday = date("w", strtotime($sdate));
                $key = $itemmember['memberid'] . "_" . $weekday;
                if (!in_array($key, $memberarray)) {
                    array_push($memberarray, $key);
                }
                array_push($json, array("id" => $itemmember['id'], "color" => $color, "textColor" => "black", "true_start_date" => "{$sdate}", "start_date" => substr($sdate, 0, 10) . " 00:00:00", "end_date" => substr($edate, 0, 10) . " 23:59:59", "text" => "<div class='entry'><span class='toleft'>" . ($sectionid == "clientid" ? $itemmember['fullname'] : $itemmember['name']) . "</span><span class='toright'>" . substr($sdate, 11, 5) . "-" . substr($edate, 11, 5) . " " . getTimeDifference(substr($sdate, 11), substr($edate, 11)) . "</span></div>", "section_id" => $itemmember[$sectionid]));
            }
        } else {
            logError($sql . " - " . mysql_error());
        }
    }
} else {
    logError($sql . " - " . mysql_error());
}
if ($_GET['mode'] == "S") {
    $date = $startdate;
    while (strtotime($date) < strtotime($enddate)) {
        $weekday = date("w", strtotime($date));
        $sql = "SELECT A.member_id \n\t\t\t\t\tFROM {$_SESSION['DB_PREFIX']}members A \n\t\t\t\t\tWHERE A.member_id != 1\n\t\t\t\t\tORDER BY member_id";
        $found = false;
        $result = mysql_query($sql);
Exemplo n.º 6
0
?>
</i></li>
    </ul>
    <ul class="individual">
        <li><a class="dissolve" href="#map">Karte</a></li>
        <li><a class="swap"href="fotos.php?name=<?php 
echo $org['NAME'];
?>
">Fotos</a></li>
    </ul>
    <ul class="rounded">
    <?php 
if ($_GET['id']) {
    $t = date("Y-m-d H:i:s");
    $mostRecent = end(explode("+", $org['DATE']));
    echo '<li>Der Meeresbewohner wurde das letzte mal ' . getTimeDifference($mostRecent, $t) . '</i> gefunden!</li>';
} else {
    echo '<li>Dieser Meeresbewohner wurde bereits ' . $org['COUNT'] . ' mal gefunden!</li>';
}
?>
 
        <li><?php 
echo $org['DESCRIPTION'];
?>
</li>
        <li class="forward"><a href="<?php 
echo $org['LINKS'];
?>
" target="_blank">mehr &uuml;ber <?php 
echo $org['NAME'];
?>
Exemplo n.º 7
0
?> 
<table width=100% cellpadding=5 cellspacing=1 bgcolor=white style="font-size:9pt">
<tr style="font-weight:800">
<td align=center width=40 height=32 background=bg_case_top.gif style="color:bba98e">ID</td>
<td align=center background=bg_case_top.gif width=400 style="color:bba98e">标题</td>
<td align=center background=bg_case_top.gif style="color:bba98e">日期时间</td>
<td align=center background=bg_case_top.gif style="color:bba98e">浏览次数</td>
</tr>
<?
do 
{
$i++;
$title=cut_str($r['title'],32,0,'gb2312');

$now=date("Y-m-d h:i:s");
$diff=getTimeDifference($now,$r['adddate']);
$strDateTime = explode(" ",$r['adddate']);
$strDate=explode("-",$strDateTime[0]);
?>
<tr bgcolor=ffffff  onmouseover="this.style.background='#fbf3e7'" onmouseout="this.style.background='#ffffff'">
<td align=center height=25 style="border-bottom:1px solid #dfd7ca"><?echo $r["articleid"];?></td>
<td style="border-bottom:1px solid #dfd7ca">
<a target=_blank href=<?if($r['urllink']==null){?>"showarticle.php?articleid=<?echo $r["articleid"];?>"<?}else{?><?echo $r["urllink"];?><?}?> title=<?echo $r["title"];?>><?echo $title;?></a></td>
<td align=center style="border-bottom:1px solid #dfd7ca"><?echo $r["adddate"];?></td>
<td align=center style="border-bottom:1px solid #dfd7ca">
<?echo $r["hits"];?>
</td>
</tr>
<?
}
while($r=mysql_fetch_array($res))
Exemplo n.º 8
0
<h1>Task '<?php 
echo $data['name'];
?>
'</h1>

<h2>Details</h2>

<table>
<tr><th>From</th><th>To</th><th>Duration</th><th colspan="2">Actions</th></tr>
<?php 
$counter = 0;
foreach ($task_details as $work) {
    $difference_sec = getTimeDifference($work['from_time'], $work['to_time'], 'seconds');
    $diff = seconds2hourmin($difference_sec, 'string');
    ?>
<tr class="<?php 
    echo $counter++ % 2 ? 'odd' : 'even';
    ?>
"><td><?php 
    echo date('d M Y, h:i a', $work['from_time']);
    ?>
</td>
<td><?php 
    echo date('h:i a', $work['to_time']);
    ?>
</td>
<td><?php 
    echo $diff;
    ?>
</td>
<td><a href="duration_edit.php?duration=<?php 
Exemplo n.º 9
0
    
    <?php 
for ($a = 1; $a < 6; $a++) {
    echo "<div id='animalInfo", $a, "'>\n";
    echo "<div class='toolbar'>\n";
    echo "<h1>[Animal Name Here]</h1>\n";
    echo "<a href='#recentUpdates' class='back'>zur&uuml;ck</a>\n";
    echo "</div>\n";
    echo "<ul>\n";
    echo "<li>\n";
    echo "<p>Infos zum Organimsus #", $a, "!<br>\n";
    echo "Name: ", $organismen[count($organismen) - $a]['name'], "<br>\n";
    echo "Lateinischer Name: ", $organismen[count($organismen) - $a]['latinName'], "<br>\n";
    echo "Beschreibung: ", $organismen[count($organismen) - $a]['description'], "<br>\n";
    $t = date("Y-m-d H:i:s");
    echo "Datum: ", $organismen[count($organismen) - $a]['date'], ", also ", getTimeDifference($organismen[count($organismen) - $a]['date'], $t), "<br>\n";
    echo "</p>\n";
    echo "</li>\n";
    echo "<li>\n";
    //echo "<a onclick='javascript:alert(",,");'>test</a>";
    echo "<a class='flip' href='#map' onclick='drawLocations();'>Alle Funde auf der Karte zeigen!</a>\n";
    echo "</li>\n";
    echo "</ul>\n";
    echo "</div>\n";
}
?>
    
    <div id="map">
    	<div class="toolbar">
    		<h1>Karte</h1>
    		<a href="#home" class="back">zur&uuml;ck</a>	
Exemplo n.º 10
0
                case 404:
                    echo "Invalid username ('" . $_GET['channel'] . "').";
                    break;
                case 422:
                    echo "Invalid Twitch username ('" . $_GET['channel'] . "').";
                    break;
                default:
                    echo "Unknown error code: " . $json['status'] . ": " . $json['error'] . ".";
                    break;
            }
        } else {
            //Determine is streamer is currently online
            if (isset($json['stream']['created_at']) == false) {
                echo "'" . $_GET['channel'] . "' is currently not online.";
            } else {
                echo getTimeDifference($json['stream']['created_at']);
            }
        }
    }
    //Close curl
    curl_close($ch);
} else {
    echo "Proper usage: uptime.php?channel={channel_name}";
}
//Function that gets difference between passed in time string (from API), and the current time, in hours, mintes, seconds
function getTimeDifference($dateStr)
{
    $date = strtotime($dateStr);
    $today = time();
    $diff = $today - $date;
    $ret = "";