if($_GET["ccode"]){
$ccode=$_GET["ccode"];
}
include("dbcon.php");
$backthen=date("Y-m-d H:i:s",(strtotime("-1 day")));
if($ccode){
$sql="SELECT mood, count( mood ) as tmood FROM wmi where tid>'$backthen' AND land='".$ccode."' GROUP BY mood";
}else{
$sql="SELECT mood, count( mood ) as tmood FROM wmi where tid>'$backthen' GROUP BY mood";
}
$result=mysql_query($sql);
while($row=mysql_fetch_array($result)){
$currentworldmood[($row[mood])]=$row[tmood];
}
$currentworldmood["t"]=$currentworldmood["n"]+$currentworldmood["p"];
$currentworldmood["np"]=@round((100/($currentworldmood[t]/$currentworldmood[n])),0);
if($currentworldmood["pp"]=@round((100/($currentworldmood[t]/$currentworldmood[p])),0)){
$currentworldmood[pp]=$currentworldmood[pp];
}else{
$currentworldmood[pp]="No data";
}
if($ccode){
$sql2="SELECT * FROM ccodes WHERE iso3166='".$ccode."'";
$result2=mysql_query($sql2);
$row2=mysql_fetch_array($result2);
$thecountry=$row2[entity];
$fips=$row2[fips];
$mout= "
Current mood in $thecountry: ";
}else{
$thecountry="the World";
$mout= "
Current World Mood: ";
}
$mout.="$currentworldmood[pp]
";
$text2="";
if($ccode){
$o.="
Mood Stats for $thecountry
This page shows mood stats for the past month submitted by our users from $thecountry.
Use the drop-down menu to see mood stats submitted by people from other countries all over the World.
";
}else{
$o.="
Mood Stats for $thecountry
$text2
This page shows mood stats for the past month submitted by our users all over the World.
Use the drop-down menu to see mood stats submitted by people in specific countries.
";
}
$o.="$mout";
/*
$sql="SELECT land, count(land) as tland FROM wmi GROUP BY land ORDER BY tland DESC LIMIT 10";
$result=mysql_query($sql);
while($row=mysql_fetch_array($result)){
$sql2="SELECT * FROM ccodes WHERE iso3166='".$row[land]."'";
$result2=mysql_query($sql2);
$row2=mysql_fetch_array($result2);
$o.= "$row2[entity] $row[tland] ";
}
*/
$rstring=md5(uniqid(rand(), true));
$o.="
";
$o.="
Chart legend: RED - Percentage of negative moods GREEN - Percentage of positive moods
";
$o.="
Check our interactive Mood Map to see the World's mood the past 24 hours or month