Location: PHPKode > projects > Sound PHP Engine > s-p-e-0.3.0/s-p-e-0.3.0/data/eduser.php
<?php
// ===================================================== 
// 
// s-p-e - Content management system. 
// Copyright (C) 2004, 2005, 2010, 2011 Vladimir B. Tsarkov
// 
// This file is part of s-p-e. 
// 
// s-p-e is free software; you can redistribute it and/or modify 
// it under the terms of the GNU General Public License as published by 
// the Free Software Foundation, either version 3 of the License, or 
// (at your option) any later version. 
// 
// s-p-e is distributed in the hope that it will be useful, 
// but WITHOUT ANY WARRANTY; without even the implied warranty of 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
// GNU General Public License for more details. 
// 
// You should have received a copy of the GNU General Public License 
// along with s-p-e. If not, see <http://www.gnu.org/licenses/>.
//
// ------
//
//  You can contact me via e-mail: lipetsk-gnu-lug at bk period ru
//
//  eduser.php
//
//  Abstract: Outputs information about the reporters:
//  	      names, e-mails, bindings to sections.
//  
//  Revision History:
// 
//	1  2004-03-27 - 2005-07-02  vbt
//	2  2005-07-23  vbt
//	3  2010-06-24  vbt
//	4  2011-01-22  vbt
//
// =====================================================
header("Content-Type: text/html; charset=UTF-8");

include("configure/specfg.php"); 
include("../include/functions.php");

cache();

session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
session_start();

gc();

redirect(read(session_id()));

if(read(session_id()) == "editor")
{
	
	language($cfg["deflangadmin"]);
	
	connect($cfg["host"], $cfg["user"], $cfg["password"], $cfg["database"], $connector);
	
	if($login = auth($connector, session_id(), "editor", $cfg["prefix"]))
	{	
		echo "<html>
		<head>
		<title>".(_("User's Information"))."</title>
		<link rel='stylesheet' type='text/css' href='../skin/".($cfg["skin"])."/style.css'>
		</head>
		<body class='admin'>
		<table class='admin-table' border='1'>
			<tr>
			<td width='320' height='15'>
			    <font class='s-normal' id='w-bold'>".(_("Service"))."</font>
			</td>
			</tr>
		<tr>
		<td align='center'>
		    <p><a href='edcol.php'><font class='s-normal'>".(_("Editor's column"))."</font></a></p>
		    <p><a href='logout.php'><font class='s-normal'>".(_("Log out"))."</font></a></p>
		</td>
		</tr>
		</table>
		
		<table border='1' width='330' class='admin-table'>
		<tr>
		<td>
			<font class='s-normal' id='w-bold'>".(_("Reporters"))."</font>
		</td>
		</tr>";
		connect($cfg["host"], $cfg["user"], $cfg["password"], $cfg["database"], $connector);
		$result = mysql_query("select login, mail 
			from ".($cfg["prefix"])."security 
			where addk='user' order by date", $connector) 
			or die("error #102-1");
		while($row = mysql_fetch_array($result))
		{
			echo "<tr>
			<td>
			<table>
			<tr>
			<td>
				<font class='s-normal'>".(_("Login")).":</font>
			</td>
			<td>
				<font class='s-normal'>".$row["login"]."</font>
			</td>
			</tr>
			<tr>
			<td>
				<font class='s-normal'>".(_("E-mail")).":</font>
			</td>
			<td>
				<font class='s-normal'>".$row["mail"]."</font>
			</td>
			</tr>
			</table>";
		}
		if(mysql_num_rows($result) == 0)
		{
			echo "<tr>
			<td>
			<font class='s-normal'>".(_("No reporters"))."</font>
			</td>
			</tr>";
		}
		mysql_free_result($result);
		mysql_close($connector);
		echo "</table>";
				
		echo "<table border='1' class='admin-table' width='450'>
		<tr>
		<td>
			<font class='s-normal' id='w-bold'>".(_("Bindings"))."</font>
		</td>
		</tr>
		</table>
		
		<table border='1' width='450' class='admin-table'>";
		
		connect($cfg["host"], $cfg["user"], $cfg["password"], $cfg["database"], $connector);
		$result = mysql_query("select distinct login 
			from ".($cfg["prefix"])."lines 
			order by partnameid", $connector) 
			or die("error #102-2");
		$acount = 0;
		while($rowarray = mysql_fetch_array($result))
		{
			$qarray[$acount] = $rowarray["login"];
			$acount++;
		}
		mysql_free_result($result);
	
		for($i = 0; $i < sizeof($qarray); $i++)
		{	
		  $result = mysql_query("select ".($cfg["prefix"])."partition.partname, ".($cfg["prefix"])."partition.pnid
			from ".($cfg["prefix"])."lines, ".($cfg["prefix"])."partition 
			where login='$qarray[$i]' 
			and ".($cfg["prefix"])."partition.pnid=".($cfg["prefix"])."lines.partnameid", $connector) 
			or die("error #102-3");
		  $numresult = mysql_query("select count(*) 
			from ".($cfg["prefix"])."lines, ".($cfg["prefix"])."partition 
			where login='$qarray[$i]' 
			and ".($cfg["prefix"])."partition.num=".($cfg["prefix"])."lines.partnameid", $connector) 
			or die("error #102-4");
		  echo "<tr>
		  <td align='center'>
		     <font class='s-normal' id='w-bold'>$qarray[$i]</font>
		  </td>
		  <td>";
		  while($row = mysql_fetch_array($result))
		  {
			if(strlen($row["pnid"]) == 10)
			{
				$bindtype = "".(_("News"))."";
			}
			if(strlen($row["pnid"]) == 11)
			{
				$bindtype = "".(_("Articles"))."";
			}

			echo "<p>
			<font class='s-normal'>&raquo;&raquo;&nbsp;&nbsp;".$row["partname"]."&nbsp(".$bindtype.")</font>
			</p>";
			}
		  echo "</td>
		  </tr>";
		  mysql_free_result($result);
		}
		if($numresult == 0)
		{
			echo "<tr>
			<td>
			<font class='s-normal'>".(_("No bindings"))."</font>
			</td>
			</tr>";
		}
	
		mysql_close($connector);
		
		echo "</table>
		</body>
		</html>";
	} else {
		echo _("Access denied.");
	}
} else {
	echo _("Access denied.");
}
?>
Return current item: Sound PHP Engine