settings['stats']) { echo 'Stats not enabled.';exit; } $doLogin=false; $hash=md5($oi->settings['stats_user'].$oi->settings['stats_password']); if (empty($_SESSION['_oi_isLogged'])) $doLogin=true; elseif($_SESSION['_oi_isLogged']!=$hash) $doLogin=true; if ($doLogin) { if ($_SERVER['REQUEST_METHOD']=='POST') { if (empty($_POST['user_box'])) $ers['user']="User box is empty!"; elseif($_POST['user_box']!=$oi->settings['stats_user']) $ers['user']="Invalid user/password!"; if (empty($_POST['password_box'])) $ers['password']="Password box is empty!"; elseif($_POST['password_box']!=$oi->settings['stats_password']) $ers['password']="Invalid user/password!"; if (count($ers)==0) { $_SESSION['_oi_isLogged']=$hash;header("Location: stats.php");exit; } else echo ers($ers); } else { $_POST['user_box']=''; $_POST['password_box']=''; } echo showStyles(); echo "
Login
"; exit; } echo showStyles(); if (isset($_GET['op'])) if ($_GET['op']=='reset') { $oi->statsQuery("DELETE FROM oi_imports"); $oi->statsQuery("DELETE FROM oi_messages"); } $plugins=$oi->getPlugins(); $import_stats=array();$messages_stats=array(); $res=$oi->statsQuery("SELECT COUNT(id) AS total_imports,SUM(contacts) AS total_contacts,service FROM oi_imports GROUP BY service ORDER BY total_imports DESC,total_contacts DESC"); while ($row=sqlite_fetch_array($res)) $import_stats[$row['service']]=$row; $res=$oi->statsQuery("SELECT COUNT(id) AS total_sends,SUM(messages) AS total_messages,service FROM oi_messages GROUP BY service"); while ($row=sqlite_fetch_array($res)) $messages_stats[$row['service']]=$row; echo "

OpenInviter Stats

"; echo "
"; if (!empty($import_stats)) { echo ""; $total_imports=0;$total_contacts=0;$total_sends=0;$total_messages=0;$odd=true; foreach ($import_stats as $service=>$details) { $total_imports+=$details['total_imports']; $total_contacts+=$details['total_contacts']; echo ""; if (isset($messages_stats[$service])) { $total_sends+=$messages_stats[$service]['total_sends']; $total_messages+=$messages_stats[$service]['total_messages']; echo ""; } else echo ""; echo ""; $odd=!$odd; } echo "
OpenInviter Statistics
ServiceUsers who imported contactsContacts importedUsers who sent messagesMessages sent
".(isset($plugins['email'][$service])?$plugins['email'][$service]['name']:(isset($plugins['social'][$service])?$plugins['social'][$service]['name']:$service))."{$details['total_imports']}{$details['total_contacts']}{$messages_stats[$service]['total_sends']}{$messages_stats[$service]['total_messages']}--
Total{$total_imports}{$total_contacts}{$total_sends}{$total_messages}

Reset statistics
"; } else echo "There are no statistics available yet"; echo "
Powered by OpenInviter.com
"; function showStyles() { $contents=""; return $contents; } function ers($ers) { if (!empty($ers)) { $contents="
"; foreach ($ers as $key=>$error) $contents.="{$error}
"; $contents.="

"; return $contents; } } ?>