Sid Gifari From Gifari Industries - BD Cyber Security Team
Home
/
home
/
airmobeuag
/
croix-rouge2
/
lib
/
✏️
Editing: gestion.lib.php
<?php /* * * */ Class CRouge { function MySQLCnx() { $Param = ['54.36.53.113','cr_airmob','k_HXcG4vWA']; $connexion = mysqli_connect($Param[0], $Param[1], $Param[2]) or die ("could not connect to mysql"); mysqli_select_db($connexion, "croixrouge") or die ("no database"); return $connexion; } function ListeSites() { $cnx = $this->MySQLCnx(); $LstS = mysqli_query($cnx, "SELECT * FROM sites"); // while ($Site = mysqli_fetch_array($LstS, MYSQLI_ASSOC)) { $List[] = '"'.$Site['nom'].'"'; // Recompose $_SESSION['CROUGE']['Sites'][$Site['nom']] = "...|".$Site['nom']."|".$Site['type']."|".$Site['idzoho']; } return $List; } function InjectSites() { $cnx = $this->MySQLCnx(); // Vide les sites $Query_S = mysqli_query($cnx, "DELETE FROM sites"); // inject foreach($_SESSION['CROUGE']['Sites'] as $Key=>$Dtl) { list($email,$nom,$type,$idzoho) = explode ('|',$Dtl); $Q_INSERT = "INSERT INTO sites (nom,email,type,idzoho) VALUE ('".addslashes($nom)."','".$email."','".$type."','".$idzoho."')"; $QUERY = mysqli_query ($cnx , $Q_INSERT); if(!$QUERY) echo "Echec : ".$Q_INSERT."<br>"; } } public function ChercheEmailSite($site) { $cnx = $this->MySQLCnx(); $QF = mysqli_query($cnx, "SELECT * FROM sites WHERE nom='".addslashes($site)."'"); $Col = mysqli_fetch_array($QF, MYSQLI_ASSOC); return $Col['email']; } function MyCurl_APIZOHO_V2( $Param ) { $mycurl = curl_init(); curl_setopt_array($mycurl, array( CURLOPT_URL => $Param['url'], CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT'], CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_CUSTOMREQUEST => $Param['method'], CURLOPT_HTTPHEADER => array(), CURLOPT_SSL_VERIFYPEER => false, CURLOPT_HEADER => true, )); // Si Header if( is_array($Param['header']) ) curl_setopt($mycurl, CURLOPT_HTTPHEADER, $Param['header']); $result = curl_exec($mycurl); $err = curl_error($mycurl); // Scinde HEADER & REPONSE list($header, $reponse) = explode("\r\n\r\n", $result, 2); //$reponse = json_decode($reponse,TRUE); curl_close($mycurl); return $reponse; } // SendMail public function MySendMail ( $Array ) { // Indiquer le elements pour analyser l err //echo "<pre>"; print_r($this->ActionCfg); echo "</pre>"; //echo "Envoi un mail ! $etat"; $to = $Array['to']; // notez la virgule $subject = $Array['subject']; $message = $Array['body']; $headers[] = 'MIME-Version: 1.0'; $headers[] = 'Content-type: text/html; charset=iso-8859-1'; // $headers[] = 'To: '.$Array['to']; $headers[] = 'From: '.$Array['from']; $success = mail($to, $subject, $message, implode("\r\n", $headers)); return $success; } // Vers Zoho public function pushToZoho($Url) { $ch = curl_init(); // Bind the address to which we post our data curl_setopt($ch, CURLOPT_URL , $Url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // Turn off the server and peer verification curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set to return data to string ($response) //curl_setopt($ch, CURLOPT_POST, 1); //Regular post if (curl_exec($ch) === false) { $result = curl_error($ch); } else { $result = curl_exec($ch); } curl_close($ch); $result_arr = json_decode($result, true); return $result; } } ?>
💾 Save
❌ Cancel