function __construct($kptime = 0)
 	{
 		if(empty($kptime)) $this->M_KeepTime = 3600 * 24 * 15;
 		else $this->M_KeepTime = $kptime;
 		$this->M_ID = $this->GetNum(GetCookie("DedeUserID"));
 		$this->M_LoginTime = GetCookie("DedeLoginTime");
 		if(empty($this->M_LoginTime)) $this->M_LoginTime = time();
 		if(empty($this->M_ID))
 		{
 			$this->ResetUser();
 		}else
 		{
 		  $this->M_ID = ereg_replace("[^0-9]","",$this->M_ID);

 		  //读取用户缓存信息
 		  $row =  GetUserInfos($this->M_ID);

 		  //如果不存在就更新缓存
 		  if(!is_array($row) && $this->M_ID>0) $row = $this->FushCache();

 		  //存在用户信息
 		  if(is_array($row))
 		  {
 		     $this->M_LoginID = $row['userid'];
 		     $this->M_UserPwd = $row['pwd'];
 		     $this->M_Type = $row['membertype'];
 		     $this->M_utype = $row['type'];
 		     $this->M_Money = $row['money'];
 		     $this->M_UserName = $row['uname'];
 		     $this->M_UpTime = $row['uptime'];
 		     $this->M_ExpTime = $row['exptime'];
 		     $this->M_Scores = $row['scores'];
 		     $this->M_Honor = $row['honor'];
 		     $this->M_Newpm = $row['newpm'];
 		     $this->M_UserIcon = $row['spaceimage'];
 		     $this->M_HasDay = 0;
 		     if($this->M_UpTime>0)
 		     {
 		    	 $nowtime = time();
 		    	 $mhasDay = $this->M_ExpTime - ceil(($nowtime - $this->M_UpTime)/3600/24) + 1;
 		    	 $this->M_HasDay = $mhasDay;
 		     }
 		   }else
 		   {
 		  	 $this->ResetUser();
 		   }
 	  }
  }
 }
 $AttStatus = mysql_result($SQL_Result, $i, "attstatus");
 $freigabe = mysql_result($SQL_Result, $i, "freigabe");
 if ($freigabe == 0) {
     $attcolor = "DDDDDD";
 } else {
     if ($testdate >= $attdate2 or $AttStatus != 0) {
         $attcolor = $ATTSTATUSHTML[$AttStatus];
     } else {
         $attcolor = "DDDDDD";
     }
 }
 $output = OnMouseFlotte($rg, $rp, $Benutzer['punkte'], "");
 echo '<TR>';
 echo '<TD bgcolor="#' . $attcolor . '"><b>';
 $output2 = InfoText("Ziel wurde erfasst durch Spieler:<br><b>" . GetUserInfos(mysql_result($SQL_Result, $i, "id")) . " von " . GetAllianzName(mysql_result($SQL_Result, $i, "id")));
 echo '<a href="./main.php?modul=showgalascans&xgala=' . $rg . '&xplanet=' . $rp . '" ' . $output2 . '>';
 echo $rg . ":" . $rp . " " . gnuser($rg, $rp);
 echo '</a>';
 echo " <font color=#0000FF>";
 echo "<a href=\"./main.php?modul=showgalascans&xgala=" . $rg . "&xplanet=" . $rp . "\"" . ($Benutzer['help'] ? " onmouseover=\"return overlib('" . $output . "');\" onmouseout=\"return nd();\"" : "") . ">";
 echo GetScans2($SQL_DBConn, $rg, $rp) . "</a></B></font><br>";
 echo 'Exxen M: ' . $me . "<br>Exxen K: " . $ke . "<br>";
 echo 'Pkt: ' . ZahlZuText(intval($pts / 1000)) . "K<br>";
 echo 'Def: ' . $d . '<br>Ships: ' . $s . "<br>";
 echo '</TD>';
 // Planung
 echo '<TD bgcolor="#' . $attcolor . '">';
 echo '<b><center>';
 echo $attdate2;
 echo "<br>" . substr(mysql_result($SQL_Result, $i, "attzeit"), 0, 5) . "<BR>";
Esempio n. 3
0
    // When adding a user, user name, password and full name must be given
    if ($_POST["username"] == "") {
        $result = "You must give a user name when adding a user";
    } elseif ($_POST["md5_hash"] == "") {
        $result = "You must set the password when adding a user";
    } elseif ($_POST["full_name"] == "") {
        $result = "You must give a Full Name when adding a user";
    } elseif ($_POST["email"] == "") {
        $result = "You must give an E-Mail when adding a user";
    } elseif (!array_key_exists("is_admin", $_POST) && !array_key_exists("projects", $_POST)) {
        $result = "Non admin users must have at least one project assigned";
    } else {
        // We check here that the given username doesn't already exist in the database.
        // We could let AddUser give us an error code in return, but the error message
        // wouldn't be very human readable.
        if (GetUserInfos($_POST["username"]) != array()) {
            $result = "The indicated username already exists in the database. Please choose another one.";
        } else {
            $result = AddUser($_POST["username"], $_POST["md5_hash"], $_POST["full_name"], $_POST["email"], array_key_exists("can_upload", $_POST) ? "Y" : "N", array_key_exists("is_power", $_POST) ? "Y" : "N", array_key_exists("is_admin", $_POST) ? "Y" : "N", array_key_exists("projects", $_POST) ? $_POST["projects"] : array());
        }
    }
    if ($result == "") {
        $msg = "Add successful";
    } else {
        $msg = "Error while adding: " . $result;
    }
} elseif ($action == "modify") {
    // Rules:
    // - There must always be one admin in the system
    // - A user cannot revoke his own admin status
    // - The full name must always be indicated
Esempio n. 4
0
function GetLoggedUserId()
{
    StartAccessToDB();
    $LoggedUserName = GetLoggedUserName();
    if ($LoggedUserName == "") {
        $result = -1;
    } else {
        $userInfos = GetUserInfos($LoggedUserName);
        if (is_array($userInfos)) {
            $result = $userInfos["Id"];
        } else {
            $result = -1;
        }
    }
    EndAccessToDB();
    return $result;
}