Sid Gifari From Gifari Industries - BD Cyber Security Team
Home
/
home
/
airmobeuag
/
2020
/
commande_v2
/
admin_sdfmlkoirukxcvuerg
/
✏️
Editing: index.php
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.0/css/all.css" integrity="sha384-aOkxzJ5uQz7WBObEZcHvV5JvRW3TUc2rNPA7pe3AwnsUohiw1Vj2Rgx2KSOkF5+h" crossorigin="anonymous"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> <link href="css/animate.css?<?php echo time(); ?>" rel="stylesheet"> <?php /* * Dashboard * * https://airmob.net/commande_v2/admin_sdfmlkoirukxcvuerg/index.php * * */ error_reporting(E_ALL); ini_set("display_errors", 0); include_once("../lib/gestion.lib.php"); $MyCde = new ClassCdeV2(); // Affiche ACTIVES par default if(!$_REQUEST['fact_on'] && !$_REQUEST['fact_off']) { $_REQUEST['fact_on'] = date('Y'); } // pour API V2 define("APIZOHO", [ "IdOrg" => "650182655", // Id organization "IdCli" => "1000.KL48ACSNU2NS34520ESYY3FWZUBS0E", // Id client "Secret" => "3b4a8173e9dbd396aaeb2603db7560f5ff9a323bb6", // Secret ] ); if($_REQUEST['ope']) { // STOP la facture dasn tout les cas $Desactiv = $MyCde->UpdateCmd("UPDATE zoho_factures SET stop='".date('Y-m-d H:i:s')."' WHERE idunique='".$_REQUEST['idu']."'"); if($Desactiv<>'OK') { $Msg ="Echec de désactivation : ".$Desactiv; } else { //echo "<h1>=>".$Desactiv."</h1>"; if( $_REQUEST['idr'] ) { $refresh_token = "1000.22c19beee7288032a8fef7398c164f5d.337b11b1cc5478129acacb05623673b9"; // Si l acces token change il faut changer ce code $Url = "https://accounts.zoho.com/oauth/v2/token?refresh_token=$refresh_token&client_id=" . APIZOHO['IdCli'] . "&client_secret=" . APIZOHO['Secret'] . "&grant_type=refresh_token"; $Param = ['url' => $Url, 'method' => 'POST']; $Result = $MyCde->MyCurl_APIZOHO_V2($Param); $Result = json_decode($Result, TRUE); $Token = "Zoho-oauthtoken " . $Result['access_token']; $_SESSION['CDEV2']['FACTURES']['TOKEN'] = $Token; //$_REQUEST['idu'] = "838708000011959139"; $JsonFactR = ['JSONString' => '{"recurring_invoice_id": "' . $_REQUEST['idu'] . '"}']; $Url = 'https://books.zoho.com/api/v3/recurringinvoices/' . $_REQUEST['idr'] . '/status/stop?organization_id=' . APIZOHO['IdOrg']; $ParamF = ['url' => $Url, 'method' => 'POST', 'header' => ["Authorization: $Token", "contentType: application/x-www-form-urlencoded;charset=UTF-8"], 'body' => $JsonFactR]; $ResultF = $MyCde->MyCurl_APIZOHO_V2($ParamF); $FactP = json_decode($ResultF, TRUE); // Array /* echo "$Url<pre>"; print_r($FactP); echo "</pre>"; */ $MsgZ = $FactP['data']['message']; } $Msg ="Désactivation : OK\n".$MsgZ; } $emailweb = 'luc@bvcs.fr'; $Msg = utf8_decode($Msg); mail("$emailweb",utf8_decode("[CDE V2] Action Désactivation"),"Idunique : ".$_REQUEST['idu']."\n".$Msg,"From: $emailweb\nX-Mailer: $emailweb\nReply-To: $emailweb\nX-Mailer: PHP"); } ?> <div class="container" > <br> <h1>CDE V2 - FACTURES (ZCRM)</h1>Cliquez sur le bouton rouge d'une facture active pour la désactiver.<br><br> <div class="row"> <div class="col-lg-3" style="border-top-left-radius: 40px 40px; background: #F2F2F2; "> <br> <h2>Période</h2> <?php for($index=2021; $index < date('Y')+1; $index++) {?> <h3 style="letter-spacing: .2rem;"><b><?=$index?></b></h3> <li><a href="?fact_on=<?=$index?>">Factures actives </a></li> <li><a href="?fact_off=<?=$index?>">Factures inactives </a></li> <?php } ?> </div> <div class="col-lg-9"> <?php if($Msg) { ?> <div class="alert alert-secondary" role="alert"><?=utf8_encode($Msg)?></div> <?php } ?> <table class="table table-sm"> <?php // ACTIVE if(isset($_REQUEST['fact_on'])) { echo "<theard><tr><th>#id</th><th>Client</th><th>Processus</th><th>Action</th></tr></theard>"; $Fact = $MyCde->LstCmdZOHO(['etat'=>'active','aaaa'=>$_REQUEST['fact_on']]); foreach($Fact as $key=>$ligne) { $ClassTR = ""; $Go = false; if(isset($_REQUEST['qst']) && $_REQUEST['idu']==$ligne['idunique']) { $ClassTR = "table-danger"; $Go = true; } echo "<tr class='$ClassTR'>"; echo "<td>".$ligne['idunique']."</td>"; echo "<td><b>".strtoupper($ligne['ste'])."</b><br>".$ligne['email']."</td>"; ($ligne['id_rec'])? $Lib='<span class="badge badge-pill badge-success">Fact.Périodique</span>' : $Lib='<span class="badge badge-pill badge-warning">En cours</span>'; echo "<td>".$Lib."</td>"; echo "<td><a href='?fact_on=".$_REQUEST['fact_on']."&qst=".$ligne['id_rec']."&idu=".$ligne['idunique']."' class='btn btn-danger'>X</a></td>"; echo "</tr>"; if($Go) { if($_REQUEST['qst']) $Info = "<br>La facture périodique de ZOHO sera désactivée."; else $Info ="<br>Il n'y a pas de facture périodique."; echo "<tr>"; echo "<td colspan='4' class='$ClassTR'><b>Voulez-vous stopper le processus pour ce client ?</b><br><i>Cela implique l'arret complet d'envoi de mail et de paiements automatiques.</i>".$Info."<br>"; echo "<div style='float:right'><a href='?fact_on=".$_REQUEST['fact_on']."&idr=".$ligne['id_rec']."&idu=".$ligne['idunique']."&ope=xxx' class='btn btn-success'>OUI</a> <a href='?' class='btn btn-secondary'>NON</a></div>"; echo "</td>"; echo "</tr>"; } } } // INCATIVE if(isset($_REQUEST['fact_off'])) { echo "<theard><tr><th>#id</th><th>Client</th><th>Stoppée le</th></tr></theard>"; $Fact = $MyCde->LstCmdZOHO(['etat'=>'inactive','aaaa'=>$_REQUEST['fact_off']]); foreach($Fact as $key=>$ligne) { echo "<tr>"; echo "<td>".$ligne['idunique']."</td>"; echo "<td><b>".$ligne['ste']."</b><br>".$ligne['email']."</td>"; echo "<td>".$ligne['stop']."</td>"; echo "</tr>"; } } ?> </table> <?php // Array // echo "<pre>"; print_r($Fact); echo "</pre>"; ?> </div> </div> <div class="row"> <div class="col-lg-3" style="background: #F2F2F2"><small>Version 1.0</small></div> <div class="col-lg-9" ></div> </div> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
💾 Save
❌ Cancel