<?php

function dispAdminBlacklist () {


if ($_SESSION["user_right"] < $GLOBALS["EPTV"] )
{
	return("T'es ouf");
}

	get_time();


$result = getAllBlacklist();


$str = '
		
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
		<td bgcolor="#000000">
		<table width="100%" border="0" cellspacing="1" cellpadding="2">
			<tr>
			<td>
				<b>
				<font color="#ffffff">
				&nbsp a l l &nbsp b l a c k l i s t e d
				</font>
				</b> 
			';
				if ($_SESSION["user_right"] == $GLOBALS["ROOT"]) {
					$str .= '
						<FORM name="new_user" method="post" action="index.php?section=AdminHome&section_admin=AdminAddBlacklist">
						<INPUT class="button" TYPE="submit" NAME="action" VALUE="  NOUVEAU BOULET  "><BR> </TD>
						</FORM>
					';
				}
		$str .= '
			</td>
			</tr>
						
			<tr>
			<td bgcolor="#303030">
			<table cellpadding="0" cellspacing="0" width="100%">
				<tr>
				<td>
				<table width="100%" border="0" cellspacing="0" cellpadding="4">

				<TR>
				<td></td>
				<td><b>Login</b></td>
				<td><b>Pseudo</b></td>
				<td><b>Mail</b></td>
				<td><b>Try</b></td>
				</TR>

			<TR>
	';
			$cpt = 1;
			while ($blacklist = mysql_fetch_array($result)) {
 
				$element_id = $blacklist["blacklist_id"];

				$str .=	'
				<TD>
					<small><b>'.$cpt.'</b></small>
				</TD>
				<TD>

					'.$blacklist["blacklist_login"].'
		
				</TD>

				<TD>
					'.$blacklist["blacklist_pseudo"].'
				</TD>

				<TD>
					<small>
					'.$blacklist["blacklist_reason"].'
					</small>
				</TD>

				<TD>
					<small>
					'.$blacklist["blacklist_try"].'
					</small>
				</TD>
			';

				if ($_SESSION["user_right"] == $GLOBALS["ROOT"]) {
					$str .= '
						<TD width=10% align=right>
							<FORM name="update_member" method="post" action="index.php?section=AdminHome&section_admin=AdminModifBlacklist&element_id='.$element_id.'">
							<INPUT class="button" TYPE="submit" NAME="action" VALUE="  MODIFIER  "> 
							</FORM>
						</TD>
						<TD width=10% align=right>
							<FORM name="supp_member" method="post" action="index.php?section=AdminHome&section_admin=AdminDelBlacklist&element_id='.$element_id.'">
							<INPUT class="button" TYPE="submit" NAME="action" VALUE="  SUPPRIMER  ">
						</FORM>
						</TD>
					';
				}
		$str .= '
			</TR>';
			$cpt++;
			}

		$str .= '
				</table>
				</td>
				</tr>
			</table>
			</td>
			</tr>
		</table>
		</td>
		</tr>
	';


	/////// BEGIN SPACE ///////
	$str .= '<tr><td><BR></td></tr>';


	$str .= '
		<tr>
		<td bgcolor="#000000">
		<table width="100%" border="0" cellspacing="1" cellpadding="2">

			<tr>
			<td>
				<b>
				<font color="#ffffff">
				&nbsp a l l &nbsp s i t e &nbsp; f o r &nbsp; b l a c k l i s t e d
				</font>
				</b> 
			</td>
			</tr>
				
			<FORM name="new_news" method="post" action="index.php?section=AdminHome&section_admin=AdminAddBlacksite">
   			<TR>
  			<TD><INPUT class="button" TYPE="submit" NAME="action" VALUE="  NOUVELLE SITE POUR LA BLACKLIST  "><BR> </TD>
			</TR>
 			</FORM>
		
			<tr>
			<td bgcolor="#303030">
			<table cellpadding="0" cellspacing="0" width="100%">
				<tr>
				<td>
				<table width="100%" border="0" cellspacing="0" cellpadding="4">
				';

			$result = getAllBlacksite();

			while ($blacksite = mysql_fetch_array($result)) {
 
				$element_id = $blacksite["blacksite_id"];

				$str .=	'
					<TR>
					<TD>
						<A HREF='.$blacksite["blacksite_adress"].'>'.$blacksite["blacksite_adress"].'</A>	
					</TD>

				
					<TD width=10% align=right>
						<FORM name="update_member" method="post" action="index.php?section=AdminHome&section_admin=AdminModifBlacksite&element_id='.$element_id.'">
						<INPUT class="button" TYPE="submit" NAME="action" VALUE="  MODIFIER  "> 
						</FORM>
					</TD>
					<TD width=10% align=right>
						<FORM name="supp_member" method="post" action="index.php?section=AdminHome&section_admin=AdminDelBlacksite&element_id='.$element_id.'">
						<INPUT class="button" TYPE="submit" NAME="action" VALUE="  SUPPRIMER  ">
					</FORM>
					</TD>
					</TR>

				';
			}

			$str .= '
				</table>
				</td>
				</tr>
			</table>
			</td>
			</tr>
		</table>
		</td>
		</tr>



	</table>
	
	';


return $str;


}




function	dispAdminAddBlacklist() {

 $date = get_date();

 $str = '		
<table width="80%" border="0" cellspacing="0" cellpadding="0">
	<tr>
	<td bgcolor="#000000">
	<table width="100%" border="0" cellspacing="1" cellpadding="2">
		<tr>
		<td>
			<b>
			<font color="#ffffff">
			&nbsp a d d &nbsp b l a c k l i s t &nbsp t o &nbsp d a t a b a s e
			</font>
			</b> 
		</td>
		</tr>					
	<tr>
	<td bgcolor="#303030">
	<table cellpadding="0" cellspacing="0" width="100%">
		<tr>	
		    <form name="saisie" method="post" action="index.php?section=AdminHome&section_admin=AddBlacklist">
		    <TABLE CELLSPACING="0" CELLPADDING="10" BORDER="0">
   
			    <TR><TD> Login: </TD>
			    <TD> <INPUT TYPE="text" NAME="blacklist_get_login" VALUE="" SIZE="20" MAXLENGTH="20"> </TD>
			    </TR>
   	 
			    <TR><TD> Pseudo: </TD>
			    <TD> <INPUT TYPE="text" NAME="blacklist_get_pseudo" VALUE="" SIZE="20" MAXLENGTH="20"> </TD>
			    </TR>

			    <TR><TD> Mail: </TD>
			    <TD> <INPUT TYPE="text" NAME="blacklist_get_mail" VALUE="" SIZE="30" MAXLENGTH="30"> </TD>
			    </TR>

			    <TR><TD> Date d entree: </TD>
			    <TD> <INPUT TYPE="text" NAME="blacklist_get_date" VALUE="'.$date.'" SIZE="8" MAXLENGTH="10"> </TD>
			    </TR>

			    <TR><TD>Reason: </TD>
			    <TD>
			    <TEXTAREA rows="3" cols="38" name="blacklist_get_reason" ONFOCUS=""></textarea>
			    </TD>
			    </TR>

			    <TR>
				    <TD> </TD>
				    <TD> <INPUT class="button" TYPE="submit" NAME="action" VALUE="  INSCRIPTION  "> </TD>
			    </TR>
			    <TR>
			 	   <TD> </TD>
				   <TD> <INPUT class="button" TYPE="reset" NAME="action" VALUE=" RESET "> </TD>
			    </TR>
		    </TABLE>
		</FORM>
		</TR>
	</TABLE>
	</TD>
	</TR>
</TABLE>
';

return $str;

}


function	dispAdminModifBlacklist() {

$element_id =$_GET['element_id'];

$result = getOneBlacklistById($element_id);

$str = '		
<table width="80%" border="0" cellspacing="0" cellpadding="0">
	<tr>
	<td bgcolor="#000000">
	<table width="100%" border="0" cellspacing="1" cellpadding="2">
		<tr>
		<td>
			<b>
			<font color="#ffffff">
			&nbsp m o d i f y &nbsp b l a c k l i s t e d
			</font>
			</b> 
		</td>
		</tr>					
	<tr>
	<td bgcolor="#303030">
	<table cellpadding="0" cellspacing="0" width="100%">
		<tr>	
	';

  if (mysql_num_rows($result)){
    $blacklist = mysql_fetch_array($result);    
  }

  $str .= '
    <form name="saisie" method="post" action="index.php?section=AdminHome&section_admin=ModifBlacklist&element_id='.$element_id.'">
	    <TABLE CELLSPACING="0" CELLPADDING="10" BORDER="0">
	   
 		   <TR><TD> Login du Boulet: </TD>
		    <TD> <INPUT TYPE="text" NAME="blacklist_get_login" VALUE="'.$blacklist["blacklist_login"].'" SIZE="50" MAXLENGTH="52"> </TD>
		    </TR>
    
		    <TR><TD> Pseudo: </TD>
		    <TD>

		    <INPUT TYPE="text" NAME="blacklist_get_pseudo" VALUE="'.$blacklist["blacklist_pseudo"].'" SIZE="50" MAXLENGTH="100"> 

		    </TD>
		    </TR>

		    <TR><TD> Mail: </TD>
		    <TD>
		    <INPUT TYPE="text" NAME="blacklist_get_mail" VALUE="'.$blacklist["blacklist_mail"].'" SIZE="50" MAXLENGTH="100"> 

		    </TD>
		    </TR>

    
		    <TR><TD> Depuis le: </TD>
		    <TD> <INPUT TYPE="text" NAME="blacklist_get_date" VALUE="'.$blacklist["blacklist_date"].'" SIZE="8" MAXLENGTH="10"> </TD>
		    </TR>

		    <TR><TD>Reason: </TD>
		    <TD>
		    <TEXTAREA rows="3" cols="38" name="blacklist_get_reason" ONFOCUS="">'.$blacklist["blacklist_reason"].'</textarea>
		    </TD>
		    </TR>
  
		    <TR><TD>Essais de Connexion: </TD>
		    <TD>
		    '.$blacklist["blacklist_try"].'
		    </TD>
		    </TR>

	    </TD>
	    </TR>

	    <TR>
	    <TD> </TD>
	    <TD> <INPUT class="button" TYPE="submit" NAME="action" VALUE="  UPDATE  "> </TD>
	    </TR>
	    <TR>
	    <TD> </TD>
	    <TD> <INPUT class="button" TYPE="reset" NAME="action" VALUE=" RESET "> </TD>
	    </TR>
 
    	</TABLE>
	</FORM>
	</TR>
   </TABLE>
   </TD>
   </TR>
</TABLE>
 
';

return $str;

}


function	dispAdminDelBlacklist() {

  $element_id =$_GET['element_id'];

  $result = getOneBlacklistById($element_id);

$str = '		
<table width="80%" border="0" cellspacing="0" cellpadding="0">
	<tr>
	<td bgcolor="#000000">
	<table width="100%" border="0" cellspacing="1" cellpadding="2">
		<tr>
		<td>
			<b>
			<font color="#ffffff">
			&nbsp d e l e t e &nbsp b l a c k l i s t e d
			</font>
			</b> 
		</td>
		</tr>					
	<tr>
	<td bgcolor="#303030">
	<table cellpadding="0" cellspacing="0" width="100%">
		<tr>	
	';

	  if (mysql_num_rows($result)){
	    $blacklist = mysql_fetch_array($result);    
	  }

	  $str .= '
	    <form name="saisie" method="post" action="index.php?section=AdminHome&section_admin=DelBlacklist&element_id='.$element_id.'">
	    <TABLE CELLSPACING="0" CELLPADDING="10" BORDER="0">
   
		    <TR><TD> Login du boulet: </TD>
		    <TD>'.$blacklist["blacklist_login"].'</TD>
		    </TR>
    
		    <TR>
		    <TD> Pseudo: </TD>
		    <TD>
       
		     ' .$blacklist["blacklist_pseudo"].'
      
		    </TD>
		    </TR>
    
		    <TR><TD> Mail: </TD>
		    <TD> '.$blacklist["blacklist_mail"].' </TD>
		    </TR>

		    <TR><TD>Date de blacklist: </TD>
		    <TD>
		    '.$blacklist["blacklist_date"].'   
		    </TD>
		    </TR>

		    <TR><TD>Raison: </TD>
		    <TD>
		    '.$blacklist["blacklist_reason"].'
		    </TD>
		    </TR>

		    <TR><TD>Essais de Connexion: </TD>
		    <TD>
		    '.$blacklist["blacklist_try"].'
		    </TD>
		    </TR>

		    <TR>
		    <TD> </TD>
		    <TD> <INPUT class="button" TYPE="submit" NAME="action" VALUE="  SUPPRIMER  "> </TD>
		    </TR>  
    	</TABLE>
	</FORM>
	</TR>
   </TABLE>
   </TD>
   </TR>
</TABLE>

';

return $str;

}


//////////////////////////////////////////////////
//////////  All Sites For Blacklisted ////////////
//////////////////////////////////////////////////


function	dispAdminAddBlacksite() {

	/////// BEGIN TABLE UP ///////
	$str = dispTableBegin("a d d &nbsp; s i t e", "80", 1);
	$str .= '
		<tr>
		<td>
		    <FORM name="saisie" method="post" action="index.php?section=AdminHome&section_admin=AddBlacksite&blacksite_id='.blacksite_id.'">
		    <TABLE CELLSPACING="0" CELLPADDING="10" BORDER="0">
   
			    <TR><TD> Adresse du Site: </TD>
			    <TD> <INPUT TYPE="text" NAME="blacksite_get_adress" VALUE="" SIZE="50" MAXLENGTH="150"> </TD>
			    </TR>

			    <TR>
				    <TD> </TD>
				    <TD> <INPUT class="button" TYPE="submit" NAME="action" VALUE="  ADD  "> </TD>
			    </TR>
			    <TR>
			 	   <TD> </TD>
				   <TD> <INPUT class="button" TYPE="reset" NAME="action" VALUE=" RESET "> </TD>
			    </TR>
		    </TABLE>
		    </FORM>
		</td>
		</tr>
	';

	$str .= dispTableEnd();

return $str;

}


function	dispAdminModifBlacksite() {

	$element_id =$_GET['element_id'];

	$result = getOneBlacksiteById($element_id);

	/////// BEGIN TABLE UP ///////
	$str = dispTableBegin("m o d i f &nbsp; s i t e", "80", 1);
	$str .= '
		<tr>
		<td>
		<table width="100%" border="0" cellspacing="2" cellpadding="2">	
	';
	  if (mysql_num_rows($result)){
	    $blacksite = mysql_fetch_array($result); 
   
		$str .= '
			<FORM name="saisie" method="post" action="index.php?section=AdminHome&section_admin=ModifBlacksite&element_id='.$element_id.'">
			    <TR><TD> Adresse du Site a modifier: </TD>
			    <TD> <INPUT TYPE="text" NAME="blacksite_get_adress" VALUE="'.$blacksite["blacksite_adress"].'" SIZE="50" MAXLENGTH="150"> </TD>
			    </TR>

			    <TR>
			    <TD> </TD>
			    <TD> <INPUT class="button" TYPE="submit" NAME="action" VALUE="  UPDATE  "> </TD>
			    </TR>
			    <TR>
			    <TD> </TD>
			    <TD> <INPUT class="button" TYPE="reset" NAME="action" VALUE=" RESET "> </TD>
			    </TR>
			</FORM>
		';
	  }

	$str .= '
		</table>
		</td>
		</tr>
	';

	$str .= dispTableEnd();

return $str;

}


function	dispAdminDelBlacksite() {

	$element_id =$_GET['element_id'];

	$result = getOneBlacksiteById($element_id);

	$str = dispTableBegin("d e l e t e &nbsp; s i t e", "80", 1);
	$str .= '
		<tr>
		<td>
		<table width="100%" border="0" cellspacing="2" cellpadding="2">	
	';

	  if (mysql_num_rows($result)){
	    $blacksite = mysql_fetch_array($result);    

		$str .= '
			<FORM name="saisie" method="post" action="index.php?section=AdminHome&section_admin=DelBlacksite&element_id='.$element_id.'">
				<TR><TD> Site a effacer: </TD>
				<TD><A HREF='.$blacksite["blacksite_adress"].'>'.$blacksite["blacksite_adress"].'</A></TD>
				</TR>
				<TR>
				<TD> </TD>
				<TD> <INPUT class="button" TYPE="submit" NAME="action" VALUE="  SUPPRIMER  "> </TD>
				</TR>  
			</FORM>
		';
	  }

	$str .= '
		</table>
		</td>
		</tr>
	';

	$str .= dispTableEnd();

return $str;

}

?>