Traduction Sqli vers langage SMF

Started by grandseb59, April 28, 2020, 01:50:48 PM

Previous topic - Next topic

grandseb59

Bonjour à mon sauveur  ;D


J'ai pas mal de scripts maison fait par un ancien webmaster.
J'ai lu qu'il fallait pas mettre d'url relative, donc je les ai remplacé par:
$scripturl quand c'est un renvoie à une autre page
et $settings quand on va chercher une image.

Mais arrive les fonctions Sqli ....
J'ai bien vu que "mysqli_query($connect" etait remplacer par  "$ smcFunc ['db_query'] (identifiant, requête, valeurs, connexion)".
Mais qu'en est il de :
mysqli_connect(
mysqli_fetch_array
(mysqli_error($connect))
mysqli_num_rows

Je vous joint un mini script ci dessous, pourriez vous me le traduire en language SMF s'il vous plait que je vois comment ça fonctionne .
Merci d'avance ;)

<?php

include('Settings.php');
$connectmysqli_connect($db_server,$db_user,$db_passwd,$db_name);


// on empêche l'affichage sur les sections non voulu 

if( $context['current_board']== 135 OR $context['current_board']== 172 OR $context['current_board']== 174 OR $context['current_board']== 177 OR $context['current_board']== 163 OR $context['current_board']== 164 OR $context['current_board']== 165 OR $context['current_board']== 166 OR $context['current_board']== 167 OR $context['current_board']== 168 OR $context['current_board']== 170 OR $context['current_board']== 171 OR $context['current_board']== 134  OR $context['current_board']== 154 OR $context['current_board']== '156' OR $context['current_board']== 155  OR $context['current_board']== 3  OR $context['current_board']== OR $context['current_board']== OR $context['current_board']== 110 OR $context['current_board']== 72 OR $context['current_board']==OR $context['current_board']==OR $context['current_board']==OR $context['current_board']==OR $context['current_board']==OR $context['current_board']==OR $context['current_board']==10 OR $context['current_board']==18 OR $context['current_board']==19 OR $context['current_board']==87 OR $context['current_board']== 71 OR $context['current_board']==77 OR $context['current_board']== 78 OR $context['current_board']== 98 OR $context['current_board']==49 OR $context['current_board']==69 OR $context['current_board']==70 OR $context['current_board']==99){}

// IMAGE  RéCAP
elseif ($topic['id'] == 10704 OR $topic['id'] == 10707 OR $topic['id'] == 10710 OR $topic['id'] == 10705 OR $topic['id'] == 10708 OR $topic['id'] == 15719 OR $topic['id'] == 10711 OR $topic['id'] == 15720 OR $topic['id'] == 11177 OR $topic['id'] == 11178 OR $topic['id'] == 10709 OR $topic['id'] == 10712 OR $topic['id'] == 10713 OR $topic['id'] == 10714 OR $topic['id'] == 10715 OR $topic['id'] == 10716 OR $topic['id'] == 10717 OR $topic['id'] == 10718 OR $topic['id'] == 10719 OR $topic['id'] == 10720 OR $topic['id'] == 10721 OR $topic['id'] == 10722 OR $topic['id'] == 10723 OR $topic['id'] == 10724 OR $topic['id'] == 10724 OR $topic['id'] == 10725 OR $topic['id'] == 10726 OR $topic['id'] == 10727 OR $topic['id'] == 10728 OR $topic['id'] == 10729 OR $topic['id'] == 10730 OR $topic['id'] == 10731 OR $topic['id'] == 10732 OR $topic['id'] == 19135 OR $topic['id'] == 10733 OR $topic['id'] == 10738 OR $topic['id'] == 10736 OR $topic['id'] == 10739 OR $topic['id'] == 10734 OR $topic['id'] == 10737 OR $topic['id'] == 10740 OR $topic['id'] == 10741 OR $topic['id'] == 10742 OR $topic['id'] == 10914 OR $topic['id'] == 10915 OR $topic['id'] == 10743 OR $topic['id'] == 10916 OR $topic['id'] == 10744 OR $topic['id'] == 10917 OR $topic['id'] == 10745 OR $topic['id'] == 10746 OR $topic['id'] == 10919 OR $topic['id'] == 10747 OR $topic['id'] == 10748)

  {

    echo 
'<td class="icon1 '$color_class'" ><img src="'$settings['theme_url'], '/images/custom/recap.png"height="140" width="100" /></td>';}
  
  else{

// on affiche les images sur le fofo 


$requetemysqli_query($connect,'SELECT * FROM jaquette WHERE topicnum="'.$topic['id'].'"')or die (mysqli_error($connect));
$affichage mysqli_fetch_array($requete);

// si y'a pas d'image on affiche la "no" images 
if( !isset ($affichage['img'])){
echo
'

<td class="icon1 '
$color_class'"><img src="'$settings['theme_url'], '/images/custom/noimage.png"height="140" width="100" /></td>';


}
else{echo 
'<td class="icon1 '$color_class'" ><a href="index.php/topic, ' $affichage['topicnum'] . '.0.html"><img src="' .$affichage['img'] .'"height="140" width="100" /></a></td>';}

  
?>

maximus23

Bonjour,

On ne sait pas à quoi sert ce code ? Ni ou il est inséré ?

Tel qu'il est là il comporte une faille de sécurité assez forte.

Il faut passer par le SSI et passer par des fonctions sécuritaires avec par exemple un implode / explode pour la sérialisation des variables que tu mettras en mode tableau.

Là j'ai pas le temps de regarder je te donne juste une piste en gros.

:)
Pas de support par PM ou Courrier...Veuillez utiliser le forum pour vous avoir une réponse rapide à votre demande d'aide. Merci.
Amitiés et à Bientôt...
No support by PM or Mail...You will get better and faster responses in the support forums. Thank you.
Have a nice day...

grandseb59

alors ce script sert à afficher ou pas des mini jaquettes devant chaques topic parlant de cinema, donc pas besoin de l'avoir en section presentation ou reglement , etc

après c'est un script qui est à la base et il y a un include dans message index template.

Je vais me penché sur les pistes que tu me donnes pour les prochains, mais si quelqu'un s'y connait et peut me refaire le script ci dessus en mode SMF sécurisé, ce serait super sympa.
Merci d'avance

Advertisement: